blob: e3a486d65220d09e1e208fc9d1a186aae3e1f530 (
plain) (
blame)
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
|
/*
* Copyright 2011-2023 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#ifndef BGFX_DXGI_H_HEADER_GUARD
#define BGFX_DXGI_H_HEADER_GUARD
#include <sal.h>
#include <unknwn.h>
#if BX_PLATFORM_LINUX || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
# include <d3dcommon.h>
# include <dxgi1_6.h>
#else
# include <d3d11_x.h>
#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
namespace bgfx
{
#if BX_PLATFORM_LINUX || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
typedef ::IUnknown IUnknown;
#else
typedef ::IGraphicsUnknown IUnknown;
#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
typedef HRESULT (WINAPI* PFN_CREATE_DXGI_FACTORY)(REFIID _riid, void** _factory);
typedef HRESULT (WINAPI* PFN_GET_DEBUG_INTERFACE)(REFIID _riid, void** _debug);
typedef HRESULT (WINAPI* PFN_GET_DEBUG_INTERFACE1)(UINT _flags, REFIID _riid, void** _debug);
struct SwapChainDesc
{
uint32_t width;
uint32_t height;
DXGI_FORMAT format;
bool stereo;
DXGI_SAMPLE_DESC sampleDesc;
DXGI_USAGE bufferUsage;
uint32_t bufferCount;
DXGI_SCALING scaling;
DXGI_SWAP_EFFECT swapEffect;
DXGI_ALPHA_MODE alphaMode;
uint32_t flags;
uint8_t maxFrameLatency;
void* nwh;
void* ndt;
bool windowed;
};
struct DxgiSwapChain
{
///
DxgiSwapChain();
};
///
struct Dxgi
{
#if BX_PLATFORM_LINUX || BX_PLATFORM_WINDOWS
typedef ::IDXGIAdapter3 AdapterI;
typedef ::IDXGIFactory5 FactoryI;
typedef ::IDXGISwapChain3 SwapChainI;
typedef ::IDXGIOutput OutputI;
#elif BX_PLATFORM_WINRT
typedef ::IDXGIAdapter AdapterI;
typedef ::IDXGIFactory4 FactoryI;
typedef ::IDXGISwapChain1 SwapChainI;
typedef ::IDXGIOutput OutputI;
#else
typedef ::IDXGIAdapter AdapterI;
typedef ::IDXGIFactory2 FactoryI;
typedef ::IDXGISwapChain1 SwapChainI;
typedef ::IDXGIOutput OutputI;
#endif // BX_PLATFORM_WINDOWS
///
Dxgi();
///
bool init(Caps& _caps);
///
void shutdown();
///
void update(IUnknown* _device);
///
HRESULT createSwapChain(IUnknown* _device, const SwapChainDesc& _scd, SwapChainI** _swapChain);
#if BX_PLATFORM_WINRT
///
HRESULT removeSwapChain(const SwapChainDesc& _scd);
#endif
///
void updateHdr10(SwapChainI* _swapChain, const SwapChainDesc& _scd);
///
HRESULT resizeBuffers(SwapChainI* _swapChain, const SwapChainDesc& _scd, const uint32_t* _nodeMask = NULL, IUnknown* const* _presentQueue = NULL);
///
void trim();
///
bool tearingSupported() const;
///
void* m_dxgiDll;
void* m_dxgiDebugDll;
D3D_DRIVER_TYPE m_driverType;
DXGI_ADAPTER_DESC m_adapterDesc;
FactoryI* m_factory;
AdapterI* m_adapter;
OutputI* m_output;
bool m_tearingSupported;
};
} // namespace bgfx
#endif // BGFX_DXGI_H_HEADER_GUARD
|