Skip to content

Commit 44f45a4

Browse files
committed
xrRender/HW.h: cleanup
1 parent 6fa5530 commit 44f45a4

File tree

2 files changed

+25
-46
lines changed

2 files changed

+25
-46
lines changed

src/Layers/xrRender/HW.h

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,20 @@ class CHW
3636
BOOL support(D3DFORMAT fmt, DWORD type, DWORD usage);
3737
#endif // !USE_OGL
3838

39-
#ifdef DEBUG
40-
#if defined(USE_DX10) || defined(USE_DX11) || defined(USE_OGL)
41-
void Validate(void){};
42-
#else // USE_DX10
43-
void Validate(void)
39+
#if defined(DEBUG) && defined(USE_DX9)
40+
void Validate()
4441
{
4542
VERIFY(pDevice);
4643
VERIFY(pD3D);
4744
};
48-
#endif // USE_DX10
4945
#else
50-
void Validate(void){};
46+
void Validate() {}
5147
#endif
5248

53-
// Variables section
49+
// Variables section
50+
public:
51+
CHWCaps Caps;
52+
5453
#if defined(USE_OGL)
5554
CHW* pDevice;
5655
CHW* pContext;
@@ -61,62 +60,40 @@ class CHW
6160
GLuint pFB;
6261
GLuint pCFB;
6362

64-
CHWCaps Caps;
65-
6663
SDL_Window* m_hWnd;
6764
HDC m_hDC;
6865
SDL_GLContext m_hRC;
69-
#elif defined(USE_DX11)
70-
public:
71-
IDXGIFactory1* m_pFactory = nullptr;
72-
IDXGIAdapter1* m_pAdapter = nullptr; // pD3D equivalent
73-
ID3D11Device* pDevice = nullptr; // combine with DX9 pDevice via typedef
74-
ID3D11DeviceContext* pContext = nullptr; // combine with DX9 pDevice via typedef
75-
IDXGISwapChain* m_pSwapChain = nullptr;
76-
ID3D11RenderTargetView* pBaseRT = nullptr; // combine with DX9 pBaseRT via typedef
77-
ID3D11DepthStencilView* pBaseZB = nullptr;
78-
79-
CHWCaps Caps;
66+
#else // General DirectX
67+
ID3DDevice* pDevice = nullptr; // render device
68+
ID3DRenderTargetView* pBaseRT = nullptr; // base render target
69+
ID3DDepthStencilView* pBaseZB = nullptr; // base depth-stencil buffer
8070

8171
D3D_DRIVER_TYPE m_DriverType;
82-
DXGI_SWAP_CHAIN_DESC m_ChainDesc; // DevPP equivalent
83-
D3D_FEATURE_LEVEL FeatureLevel;
84-
#elif defined(USE_DX10)
85-
public:
72+
#ifndef USE_DX9
8673
IDXGIFactory1* m_pFactory = nullptr;
87-
IDXGIAdapter1* m_pAdapter = nullptr; // pD3D equivalent
88-
ID3D10Device1* pDevice1 = nullptr; // combine with DX9 pDevice via typedef
89-
ID3D10Device* pDevice = nullptr; // combine with DX9 pDevice via typedef
90-
ID3D10Device1* pContext1 = nullptr; // combine with DX9 pDevice via typedef
91-
ID3D10Device* pContext = nullptr; // combine with DX9 pDevice via typedef
74+
IDXGIAdapter1* m_pAdapter = nullptr; // pD3D equivalent
75+
ID3DDeviceContext* pContext = nullptr;
9276
IDXGISwapChain* m_pSwapChain = nullptr;
93-
ID3D10RenderTargetView* pBaseRT = nullptr; // combine with DX9 pBaseRT via typedef
94-
ID3D10DepthStencilView* pBaseZB = nullptr;
95-
96-
CHWCaps Caps;
97-
98-
D3D10_DRIVER_TYPE m_DriverType;
99-
DXGI_SWAP_CHAIN_DESC m_ChainDesc; // DevPP equivalent
77+
DXGI_SWAP_CHAIN_DESC m_ChainDesc; // DevPP equivalent
10078
D3D_FEATURE_LEVEL FeatureLevel;
101-
#else
102-
private:
79+
#if defined(USE_DX10)
80+
ID3D10Device1* pDevice1 = nullptr;
81+
ID3D10Device1* pContext1 = nullptr;
82+
#endif
83+
#else // USE_DX9
10384
#ifdef DEBUG
10485
IDirect3DStateBlock9* dwDebugSB = nullptr;
10586
#endif
87+
private:
10688
XRay::Module hD3D = nullptr;
10789

10890
public:
10991
IDirect3D9* pD3D = nullptr; // D3D
110-
IDirect3DDevice9* pDevice = nullptr; // render device
111-
IDirect3DSurface9* pBaseRT = nullptr;
112-
IDirect3DSurface9* pBaseZB = nullptr;
113-
114-
CHWCaps Caps;
11592

11693
UINT DevAdapter;
117-
D3DDEVTYPE m_DriverType;
11894
D3DPRESENT_PARAMETERS DevPP;
119-
#endif // USE_DX10
95+
#endif // USE_DX9
96+
#endif // USE_OGL
12097

12198
#if !defined(_MAYA_EXPORT) && !defined(USE_OGL)
12299
stats_manager stats_manager;

src/Layers/xrRender/xrD3DDefs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ typedef IDirect3DVertexShader9 ID3DVertexShader;
3535
typedef IDirect3DPixelShader9 ID3DPixelShader;
3636
typedef ID3DXBuffer ID3DBlob;
3737
typedef D3DXMACRO D3D_SHADER_MACRO;
38+
typedef D3DDEVTYPE D3D_DRIVER_TYPE;
3839
typedef IDirect3DQuery9 ID3DQuery;
3940
typedef D3DVIEWPORT9 D3D_VIEWPORT;
4041
typedef ID3DXInclude ID3DInclude;
4142
typedef IDirect3DTexture9 ID3DTexture2D;
4243
typedef IDirect3DSurface9 ID3DRenderTargetView;
4344
typedef IDirect3DSurface9 ID3DDepthStencilView;
45+
typedef IDirect3DDevice9 ID3DDevice;
4446
typedef IDirect3DBaseTexture9 ID3DBaseTexture;
4547
typedef D3DSURFACE_DESC D3D_TEXTURE2D_DESC;
4648
typedef IDirect3DVertexBuffer9 ID3DVertexBuffer;

0 commit comments

Comments
 (0)