/
DeviceResources.h
86 lines (68 loc) · 2.35 KB
/
DeviceResources.h
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
// Copyright (c) 2014 Jérémy Ansel
// Licensed under the MIT license. See LICENSE.txt
#pragma once
class PrimarySurface;
class DepthSurface;
class BackbufferSurface;
class FrontbufferSurface;
class OffscreenSurface;
class DeviceResources
{
public:
DeviceResources();
HRESULT Initialize();
HRESULT OnSizeChanged(HWND hWnd, DWORD dwWidth, DWORD dwHeight);
HRESULT LoadMainResources();
HRESULT LoadResources();
HRESULT RenderMain(char* buffer, DWORD width, DWORD height, DWORD bpp, bool useColorKey = true);
HRESULT RetrieveBackBuffer(char* buffer, DWORD width, DWORD height, DWORD bpp);
UINT GetMaxAnisotropy();
void CheckMultisamplingSupport();
DWORD _displayWidth;
DWORD _displayHeight;
DWORD _displayBpp;
D3D_DRIVER_TYPE _d3dDriverType;
D3D_FEATURE_LEVEL _d3dFeatureLevel;
ComPtr<ID3D11Device> _d3dDevice;
ComPtr<ID3D11DeviceContext> _d3dDeviceContext;
ComPtr<IDXGISwapChain> _swapChain;
ComPtr<ID3D11Texture2D> _backBuffer;
ComPtr<ID3D11Texture2D> _offscreenBuffer;
ComPtr<ID3D11RenderTargetView> _renderTargetView;
ComPtr<ID3D11Texture2D> _depthStencil;
ComPtr<ID3D11DepthStencilView> _depthStencilView;
ComPtr<ID3D11VertexShader> _mainVertexShader;
ComPtr<ID3D11InputLayout> _mainInputLayout;
ComPtr<ID3D11PixelShader> _mainPixelShader;
ComPtr<ID3D11RasterizerState> _mainRasterizerState;
ComPtr<ID3D11SamplerState> _mainSamplerState;
ComPtr<ID3D11BlendState> _mainBlendState;
ComPtr<ID3D11DepthStencilState> _mainDepthState;
ComPtr<ID3D11Buffer> _mainVertexBuffer;
ComPtr<ID3D11Buffer> _mainIndexBuffer;
ComPtr<ID3D11Texture2D> _mainDisplayTexture;
ComPtr<ID3D11ShaderResourceView> _mainDisplayTextureView;
ComPtr<ID3D11VertexShader> _vertexShader;
ComPtr<ID3D11InputLayout> _inputLayout;
ComPtr<ID3D11PixelShader> _pixelShaderTexture;
ComPtr<ID3D11PixelShader> _pixelShaderSolid;
ComPtr<ID3D11RasterizerState> _rasterizerState;
ComPtr<ID3D11Buffer> _constantBuffer;
BOOL _useAnisotropy;
BOOL _useMultisampling;
DXGI_SAMPLE_DESC _sampleDesc;
UINT _backbufferWidth;
UINT _backbufferHeight;
DXGI_RATIONAL _refreshRate;
float clearColor[4];
float clearDepth;
bool sceneRendered;
bool sceneRenderedEmpty;
bool inScene;
bool inSceneBackbufferLocked;
PrimarySurface* _primarySurface;
DepthSurface* _depthSurface;
BackbufferSurface* _backbufferSurface;
FrontbufferSurface* _frontbufferSurface;
OffscreenSurface* _offscreenSurface;
};