forked from themrdemonized/xray-monolith
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHW.h
More file actions
136 lines (110 loc) · 3.53 KB
/
HW.h
File metadata and controls
136 lines (110 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// HW.h: interface for the CHW class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_HW_H__0E25CF4A_FFEC_11D3_B4E3_4854E82A090D__INCLUDED_)
#define AFX_HW_H__0E25CF4A_FFEC_11D3_B4E3_4854E82A090D__INCLUDED_
#pragma once
#if defined(USE_DX11)
#include <d3d11_4.h>
#include <dxgi1_4.h>
#endif
#include "hwcaps.h"
#include "../../build_config_defines.h"
#ifndef _MAYA_EXPORT
#include "stats_manager.h"
#endif
class CHW
#if defined(USE_DX10) || defined(USE_DX11)
: public pureAppActivate,
public pureAppDeactivate
#endif // USE_DX10
{
// Functions section
public:
int maxRefreshRate; //ECO_RENDER add
CHW();
~CHW();
void CreateD3D();
void DestroyD3D();
void CreateDevice(HWND hw, bool move_window);
void DestroyDevice();
void Reset(HWND hw);
void selectResolution(u32& dwWidth, u32& dwHeight, BOOL bWindowed);
D3DFORMAT selectDepthStencil(D3DFORMAT);
u32 selectPresentInterval();
u32 selectGPU();
u32 selectRefresh(u32 dwWidth, u32 dwHeight, D3DFORMAT fmt);
void updateWindowProps(HWND hw);
BOOL support(D3DFORMAT fmt, DWORD type, DWORD usage);
#ifdef DEBUG
#if defined(USE_DX10) || defined(USE_DX11)
void Validate(void) {};
#else // USE_DX10
void Validate(void) { VERIFY(pDevice); VERIFY(pD3D); };
#endif // USE_DX10
#else
void Validate(void)
{
};
#endif
// Variables section
#if defined(USE_DX11) // USE_DX10
public:
IDXGIFactory2* m_pFactory; // DXGI factory
IDXGIAdapter1* m_pAdapter; // pD3D equivalent
ID3D11Device1* pDevice; // combine with DX9 pDevice via typedef
ID3D11DeviceContext1* pContext; // combine with DX9 pDevice via typedef
IDXGISwapChain1* m_pSwapChain;
ID3D11RenderTargetView* pBaseRT; // combine with DX9 pBaseRT via typedef
ID3D11DepthStencilView* pBaseZB;
ID3DUserDefinedAnnotation* pAnnotation;
CHWCaps Caps;
D3D_DRIVER_TYPE m_DriverType; // DevT equivalent
DXGI_SWAP_CHAIN_DESC1 m_ChainDesc; // DevPP equivalent
DXGI_SWAP_CHAIN_FULLSCREEN_DESC m_ChainDescFullscreen;
HWND m_hWnd;
bool m_bUsePerfhud;
D3D_FEATURE_LEVEL FeatureLevel;
bool m_SupportsVRR; // whether we can use DXGI_PRESENT_ALLOW_TEARING etc.
#elif defined(USE_DX10)
public:
IDXGIAdapter* m_pAdapter; // pD3D equivalent
ID3D10Device1* pDevice1; // combine with DX9 pDevice via typedef
ID3D10Device* pDevice; // combine with DX9 pDevice via typedef
ID3D10Device1* pContext1; // combine with DX9 pDevice via typedef
ID3D10Device* pContext; // combine with DX9 pDevice via typedef
IDXGISwapChain* m_pSwapChain;
ID3D10RenderTargetView* pBaseRT; // combine with DX9 pBaseRT via typedef
ID3D10DepthStencilView* pBaseZB;
CHWCaps Caps;
D3D10_DRIVER_TYPE m_DriverType; // DevT equivalent
DXGI_SWAP_CHAIN_DESC m_ChainDesc; // DevPP equivalent
bool m_bUsePerfhud;
D3D_FEATURE_LEVEL FeatureLevel;
#else
private:
HINSTANCE hD3D;
public:
IDirect3D9* pD3D; // D3D
IDirect3DDevice9* pDevice; // render device
IDirect3DSurface9* pBaseRT;
IDirect3DSurface9* pBaseZB;
CHWCaps Caps;
UINT DevAdapter;
D3DDEVTYPE DevT;
D3DPRESENT_PARAMETERS DevPP;
#endif // USE_DX10
#ifndef _MAYA_EXPORT
stats_manager stats_manager;
#endif
#if defined(USE_DX10) || defined(USE_DX11)
void UpdateViews();
DXGI_RATIONAL selectRefresh(u32 dwWidth, u32 dwHeight, DXGI_FORMAT fmt);
virtual void OnAppActivate();
virtual void OnAppDeactivate();
#endif // USE_DX10
private:
bool m_move_window;
};
extern ECORE_API CHW HW;
#endif // !defined(AFX_HW_H__0E25CF4A_FFEC_11D3_B4E3_4854E82A090D__INCLUDED_)