Skip to content

Commit

Permalink
Merge pull request #392 from orbitersim/d3d9on12
Browse files Browse the repository at this point in the history
D3D9on12 driver support
  • Loading branch information
jarmonik authored Dec 27, 2023
2 parents cb176ec + 21e9229 commit 0d0bdf9
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 117 deletions.
2 changes: 2 additions & 0 deletions OVP/D3D9Client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ configure_file(D3D9ClientConfig.h.in D3D9ClientConfig.h)
# set(CMAKE_CXX_STANDARD_REQUIRED True)

set(DXSDK_LIB_DIR ${DXSDK_DIR}/lib/${ARCH})
set(DXSDK_LIB_DIR2 "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/${ARCH}") #Must acquire d3d9.lib from here

set(D3D9_SOURCE_DIR ${CMAKE_SOURCE_DIR}/OVP/D3D9Client)
set(ShaderDir ${D3D9_SOURCE_DIR}/shaders)
Expand Down Expand Up @@ -174,6 +175,7 @@ target_include_directories(D3D9Client PUBLIC

target_link_directories(D3D9Client PUBLIC
${ORBITER_BINARY_SDK_DIR}/lib
${DXSDK_LIB_DIR2}
${DXSDK_LIB_DIR}
)

Expand Down
34 changes: 29 additions & 5 deletions OVP/D3D9Client/D3D9Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "gcCore.h"
#include "gcConst.h"
#include <unordered_map>
#include <d3d9on12.h>


#if defined(_MSC_VER) && (_MSC_VER <= 1700 ) // Microsoft Visual Studio Version 2012 and lower
Expand All @@ -65,6 +66,7 @@ using namespace oapi;
HINSTANCE g_hInst = 0;
D3D9Client *g_client = 0;
class gcConst* g_pConst = 0;
IDirect3D9* g_pD3DObject = 0; // Made valid when VideoTab is created

D3D9Catalog<LPDIRECT3DTEXTURE9> *TileCatalog;

Expand Down Expand Up @@ -277,6 +279,7 @@ D3D9Client::~D3D9Client()
{
LogAlw("D3D9Client destructor called");
SAFE_DELETE(vtab);
SAFE_RELEASE(g_pD3DObject);
}


Expand Down Expand Up @@ -313,11 +316,28 @@ bool D3D9Client::clbkInitialise()
LogAlw("================ clbkInitialise ===============");
LogAlw("Orbiter Version = %d",oapiGetOrbiterVersion());

D3D9ON12_ARGS args = {};
args.Enable9On12 = Config->Enable9On12 != 0;

// NOTE: Link error 'unresolved external symbol' means that d3d9.lib is outdated, use the latest one.
g_pD3DObject = Direct3DCreate9On12(D3D_SDK_VERSION, &args, 1);

if (g_pD3DObject) {
oapiWriteLog("[D3D9] DirectX9 Created...");
if (Config->Enable9On12) oapiWriteLog("[D3D9] DX9 emulation via DX12");
else oapiWriteLog("[D3D9] Native Interface");
}
else {
oapiWriteLog("[D3D9][ERROR] Failed to create DirectX9");
return false;
}

// Perform default setup
if (GraphicsClient::clbkInitialise()==false) return false;
//Create the Launchpad video tab interface
oapiWriteLog("[D3D9] Initialize VideoTab...");
vtab = new VideoTab(this, ModuleInstance(), OrbiterInstance(), LaunchpadVideoTab());

oapiWriteLog("[D3D9] VideoTab Created...");
return true;
}

Expand All @@ -331,6 +351,8 @@ HWND D3D9Client::clbkCreateRenderWindow()

LogAlw("================ clbkCreateRenderWindow ===============");

if (!g_pD3DObject) return NULL;

Config->WriteParams();

uEnableLog = Config->DebugLvl;
Expand Down Expand Up @@ -378,8 +400,6 @@ HWND D3D9Client::clbkCreateRenderWindow()

pFramework = new CD3DFramework9();

if (pFramework->GetDirect3D()==NULL) return NULL;

WriteLog("[DirectX 9 Initialized]");

HRESULT hr = pFramework->Initialize(hRenderWnd, GetVideoData());
Expand Down Expand Up @@ -2900,10 +2920,14 @@ void D3D9Client::SplashScreen()
DWORD m = d/100; d-=m*100;
if (m>12) m=0;

char dataA[256];
strcpy(dataA, "D3D9Client");
if (Config->Enable9On12) strcat_s(dataA, 256, " via D3D9on12 emulator");

#ifdef _DEBUG
char dataA[]={"Using D3D9Client (Debug Build)"};
strcat_s(dataA, 256, " (Debug Build)");
#else
char dataA[]={"Using D3D9Client (Release Build)"};
strcat_s(dataA, 256, " (Release Build)");
#endif

char dataB[128]; sprintf_s(dataB,128,"Build %s %lu 20%lu [%u]", months[m], d, y, oapiGetOrbiterVersion());
Expand Down
1 change: 1 addition & 0 deletions OVP/D3D9Client/D3D9Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ typedef class SurfNative* lpSurfNative;
extern D3D9Catalog<LPDIRECT3DTEXTURE9> *TileCatalog;
extern set<D3D9Mesh*> MeshCatalog;
extern set<SurfNative*> SurfaceCatalog;
extern IDirect3D9* g_pD3DObject;


/**
Expand Down
3 changes: 3 additions & 0 deletions OVP/D3D9Client/D3D9Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ D3D9Config::~D3D9Config ()

void D3D9Config::Reset ()
{
Enable9On12 = 0;
OrbitalShadowMult = 0.85;
PlanetPreloadMode = 0;
PlanetLoadFrequency = 20;
Expand Down Expand Up @@ -129,6 +130,7 @@ bool D3D9Config::ReadParams ()
FILEHANDLE hFile = oapiOpenFile(cfgfile, FILE_IN_ZEROONFAIL, ROOT);
if (!hFile) return false;

if (oapiReadItem_int (hFile, (char*)"EnableDX12Wrapper", i)) Enable9On12 = max(0, min(1, i));
if (oapiReadItem_float (hFile, (char*)"FrameRate", d)) FrameRate = max(0.0, min(300.0, d));
if (oapiReadItem_int (hFile, (char*)"EnableLimiter", i)) EnableLimiter = max(0, min(1, i));
if (oapiReadItem_int (hFile, (char*)"CustomCamMode", i)) CustomCamMode = max(0, min(1, i));
Expand Down Expand Up @@ -219,6 +221,7 @@ void D3D9Config::WriteParams ()
{
FILEHANDLE hFile = oapiOpenFile (cfgfile, FILE_OUT, ROOT);

oapiWriteItem_int (hFile, (char*)"EnableDX12Wrapper", Enable9On12);
oapiWriteItem_float (hFile, (char*)"FrameRate", FrameRate);
oapiWriteItem_int (hFile, (char*)"EnableLimiter", EnableLimiter);
oapiWriteItem_int (hFile, (char*)"CustomCamMode", CustomCamMode);
Expand Down
2 changes: 1 addition & 1 deletion OVP/D3D9Client/D3D9Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class D3D9Config {
static const int LABEL_DISPLAY_RECORD = 0x1; ///< Display label "Record" on active recording session
static const int LABEL_DISPLAY_REPLAY = 0x2; ///< Display label "Replay" on active playback session


int Enable9On12; ///< Enable DX9 through DX12
int PlanetPreloadMode; ///< Planet preload mode setting (0=load on demand, 1=preload)
int PlanetLoadFrequency; ///< Load frequency for on-demand textures \[Hz\] (1...1000)
int Anisotrophy; ///< Anisotropic filtering setting \[factor\] (1...16)
Expand Down
64 changes: 28 additions & 36 deletions OVP/D3D9Client/D3D9Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,9 @@ static const char *d3dmessage={"Required DirectX version (June 2010 or newer) no

CD3DFramework9::CD3DFramework9()
{
pD3D = NULL;
Clear();

// Create the Direct3D9 ---------------------------------------------
//
pD3D = Direct3DCreate9(D3D_SDK_VERSION);

if (pD3D==NULL) {
if (g_pD3DObject == NULL) {
LogErr("ERROR: [Direct3D9 Creation Failed]");
LogErr(d3dmessage);
MessageBoxA(NULL, d3dmessage, "D3D9Client Initialization Failed",MB_OK);
Expand All @@ -65,13 +60,10 @@ CD3DFramework9::CD3DFramework9()
CD3DFramework9::~CD3DFramework9 ()
{
LogAlw("Deleting Framework");
SAFE_RELEASE(pD3D);
}

void CD3DFramework9::Clear()
{
// NOTE: pD3D won't be cleared in here

hWnd = NULL;
bIsFullscreen = false;
bVertexTexture = false;
Expand Down Expand Up @@ -172,7 +164,7 @@ HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData)
LogAlw("[VideoConfiguration] Adapter=%u, ModeIndex=%u", Adapter, Mode);

D3DADAPTER_IDENTIFIER9 info;
pD3D->GetAdapterIdentifier(Adapter, 0, &info);
g_pD3DObject->GetAdapterIdentifier(Adapter, 0, &info);
LogOapi("3D-Adapter.............. : %s",info.Description);
LogAlw("dwFSMode................ : %u",dwFSMode);

Expand All @@ -187,9 +179,9 @@ HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData)
{
dwDisplayMode = 0;
D3DDISPLAYMODE mode;
if (Adapter<pD3D->GetAdapterCount()) {
if (Mode<pD3D->GetAdapterModeCount(Adapter, D3DFMT_X8R8G8B8)) {
pD3D->EnumAdapterModes(Adapter, D3DFMT_X8R8G8B8, Mode, &mode);
if (Adapter<g_pD3DObject->GetAdapterCount()) {
if (Mode<g_pD3DObject->GetAdapterModeCount(Adapter, D3DFMT_X8R8G8B8)) {
g_pD3DObject->EnumAdapterModes(Adapter, D3DFMT_X8R8G8B8, Mode, &mode);
dwRenderWidth = mode.Width;
dwRenderHeight = mode.Height;
}
Expand Down Expand Up @@ -233,19 +225,19 @@ HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData)

// Hardware CAPS Checks --------------------------------------------------
//
HRESULT hr = pD3D->GetDeviceCaps(Adapter, D3DDEVTYPE_HAL, &caps);
HRESULT hr = g_pD3DObject->GetDeviceCaps(Adapter, D3DDEVTYPE_HAL, &caps);

if (hr!=S_OK) {
LogErr("pD3D->GetDeviceCaps(Adapter, D3DDEVTYPE_HAL, &caps)");
LogErr("g_pD3DObject->GetDeviceCaps(Adapter, D3DDEVTYPE_HAL, &caps)");
return hr;
}

// AA CAPS Checks --------------------------------------------------
//
DWORD aamax = 0;
if (pD3D->CheckDeviceMultiSampleType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, D3DMULTISAMPLE_2_SAMPLES, NULL)==S_OK) aamax=2;
if (pD3D->CheckDeviceMultiSampleType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, D3DMULTISAMPLE_4_SAMPLES, NULL)==S_OK) aamax=4;
if (pD3D->CheckDeviceMultiSampleType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, D3DMULTISAMPLE_8_SAMPLES, NULL)==S_OK) aamax=8;
if (g_pD3DObject->CheckDeviceMultiSampleType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, D3DMULTISAMPLE_2_SAMPLES, NULL)==S_OK) aamax=2;
if (g_pD3DObject->CheckDeviceMultiSampleType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, D3DMULTISAMPLE_4_SAMPLES, NULL)==S_OK) aamax=4;
if (g_pD3DObject->CheckDeviceMultiSampleType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, D3DMULTISAMPLE_8_SAMPLES, NULL)==S_OK) aamax=8;

MultiSample = min(aamax, DWORD(Config->SceneAntialias));

Expand Down Expand Up @@ -314,23 +306,23 @@ HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData)
// Check shadow mapping support
//
bool bShadowMap = true;
if (pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_R32F)!=S_OK) bShadowMap = false;
if (pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_R32F, D3DFMT_D24X8)!=S_OK) bShadowMap = false;
if (g_pD3DObject->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_R32F)!=S_OK) bShadowMap = false;
if (g_pD3DObject->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_R32F, D3DFMT_D24X8)!=S_OK) bShadowMap = false;

if (bShadowMap) LogOapi("Shadow Mapping.......... : Yes");
else LogOapi("Shadow Mapping.......... : No");

bool bFloat16BB = true;
if (pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)!=S_OK) bFloat16BB = false;
if (pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_A16B16G16R16F, D3DFMT_D24X8)!=S_OK) bFloat16BB = false;
if (g_pD3DObject->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)!=S_OK) bFloat16BB = false;
if (g_pD3DObject->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_A16B16G16R16F, D3DFMT_D24X8)!=S_OK) bFloat16BB = false;

if (bFloat16BB) LogOapi("D3DFMT_A16B16G16R16F.... : Yes");
else LogOapi("D3DFMT_A16B16G16R16F.... : No");

HRESULT VT16BB = pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F);
HRESULT VT32BB = pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F);
HRESULT VT16BC = pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F);
HRESULT VT32BC = pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R32F);
HRESULT VT16BB = g_pD3DObject->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F);
HRESULT VT32BB = g_pD3DObject->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F);
HRESULT VT16BC = g_pD3DObject->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F);
HRESULT VT32BC = g_pD3DObject->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R32F);

if (VT16BB == S_OK) LogOapi("Vertex_A16B16G16R16F.... : Yes");
else LogOapi("Vertex_A16B16G16R16F.... : No");
Expand All @@ -345,23 +337,23 @@ HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData)


bool bFloat32BB = true;
if (pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)!=S_OK) bFloat32BB = false;
if (g_pD3DObject->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)!=S_OK) bFloat32BB = false;

if (bFloat32BB) LogOapi("D3DFMT_A32B32G32R32F.... : Yes");
else LogOapi("D3DFMT_A32B32G32R32F.... : No");

HRESULT D32F = pD3D->CheckDeviceFormat(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D32F_LOCKABLE);
HRESULT D32F = g_pD3DObject->CheckDeviceFormat(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D32F_LOCKABLE);

if (D32F==S_OK) LogOapi("D3DFMT_D32F_LOCKABLE.... : Yes");
else LogOapi("D3DFMT_D32F_LOCKABLE.... : No");

HRESULT AR10 = pD3D->CheckDeviceFormat(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_A2R10G10B10);
HRESULT AR10 = g_pD3DObject->CheckDeviceFormat(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_A2R10G10B10);

if (AR10==S_OK) LogOapi("D3DFMT_A2R10G10B10...... : Yes");
else LogOapi("D3DFMT_A2R10G10B10...... : No");

HRESULT L8 = pD3D->CheckDeviceFormat(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_L8);
if (pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_L8, D3DFMT_D24X8) != S_OK) L8 = S_FALSE;//-1;
HRESULT L8 = g_pD3DObject->CheckDeviceFormat(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_L8);
if (g_pD3DObject->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_L8, D3DFMT_D24X8) != S_OK) L8 = S_FALSE;//-1;

if (L8 == S_OK) LogOapi("D3DFMT_L8............... : Yes");
else LogOapi("D3DFMT_L8............... : No");
Expand Down Expand Up @@ -486,7 +478,7 @@ HRESULT CD3DFramework9::CreateFullscreenMode()
// Store the rectangle which contains the renderer
SetRect(&rcScreenRect, 0, 0, dwRenderWidth, dwRenderHeight);

HR(pD3D->CheckDeviceType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, false));
HR(g_pD3DObject->CheckDeviceType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, false));

LogAlw("[FULLSCREEN MODE] %u x %u, hWindow=%s", dwRenderWidth, dwRenderHeight, _PTR(hWnd));

Expand Down Expand Up @@ -519,7 +511,7 @@ HRESULT CD3DFramework9::CreateFullscreenMode()

if (DDM) devBehaviorFlags |= D3DCREATE_DISABLE_DRIVER_MANAGEMENT;

HR(pD3D->CreateDevice(
HR(g_pD3DObject->CreateDevice(
Adapter, // primary adapter
D3DDEVTYPE_HAL, // device type
hWnd, // window associated with device
Expand Down Expand Up @@ -566,7 +558,7 @@ HRESULT CD3DFramework9::CreateWindowedMode()
if (MultiSample) {

DWORD level;
HR(pD3D->CheckDeviceMultiSampleType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, (D3DMULTISAMPLE_TYPE)MultiSample, &level));
HR(g_pD3DObject->CheckDeviceMultiSampleType(Adapter, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, true, (D3DMULTISAMPLE_TYPE)MultiSample, &level));

d3dPP.BackBufferWidth = dwRenderWidth;
d3dPP.BackBufferHeight = dwRenderHeight;
Expand Down Expand Up @@ -614,7 +606,7 @@ HRESULT CD3DFramework9::CreateWindowedMode()

LogErr("[WARNING] NVPerfHUD mode is Active (Disable from D3D9Client.cfg) [WARNING]");

hr = pD3D->CreateDevice(
hr = g_pD3DObject->CreateDevice(
Adapter, // primary adapter
D3DDEVTYPE_REF, // device type
hWnd, // window associated with device
Expand All @@ -624,7 +616,7 @@ HRESULT CD3DFramework9::CreateWindowedMode()
}
else {

hr = pD3D->CreateDevice(
hr = g_pD3DObject->CreateDevice(
Adapter, // primary adapter
D3DDEVTYPE_HAL, // device type
hWnd, // window associated with device
Expand Down
2 changes: 0 additions & 2 deletions OVP/D3D9Client/D3D9Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class CD3DFramework9
DWORD dwRenderWidth; // Dimensions of the render target
DWORD dwRenderHeight; // Dimensions of the render target
DWORD dwFSMode;
LPDIRECT3D9 pD3D; // The Direct3D object
LPDIRECT3DDEVICE9 pDevice; // The D3D device
LPD3DXFONT pLargeFont;
LPD3DXFONT pSmallFont;
Expand All @@ -84,7 +83,6 @@ class CD3DFramework9

// Access functions for DirectX objects
inline HWND GetRenderWindow() const { return hWnd; }
inline LPDIRECT3D9 GetDirect3D() const { return pD3D; }
inline LPDIRECT3DDEVICE9 GetD3DDevice() const { return pDevice; }
inline DWORD GetZBufferBitDepth() const { return dwZBufferBitDepth; }
inline DWORD GetStencilBitDepth() const { return dwStencilBitDepth; }
Expand Down
Loading

0 comments on commit 0d0bdf9

Please sign in to comment.