1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! Mappings for the contents of dxgi.h
8 use shared
::basetsd
::{SIZE_T, UINT64}
;
9 use shared
::dxgiformat
::DXGI_FORMAT
;
10 use shared
::dxgitype
::{
11 DXGI_GAMMA_CONTROL
, DXGI_GAMMA_CONTROL_CAPABILITIES
, DXGI_MODE_DESC
, DXGI_MODE_ROTATION
,
12 DXGI_SAMPLE_DESC
, DXGI_USAGE
,
14 use shared
::guiddef
::{REFGUID, REFIID}
;
15 use shared
::minwindef
::{BOOL, BYTE, DWORD, FLOAT, HMODULE, UINT}
;
16 use shared
::windef
::{HDC, HMONITOR, HWND, RECT}
;
17 use um
::unknwnbase
::{IUnknown, IUnknownVtbl}
;
18 use um
::winnt
::{HANDLE, HRESULT, INT, LARGE_INTEGER, LUID, WCHAR}
;
19 STRUCT
!{struct DXGI_FRAME_STATISTICS
{
21 PresentRefreshCount
: UINT
,
22 SyncRefreshCount
: UINT
,
23 SyncQPCTime
: LARGE_INTEGER
,
24 SyncGPUTime
: LARGE_INTEGER
,
26 STRUCT
!{struct DXGI_MAPPED_RECT
{
30 STRUCT
!{struct DXGI_ADAPTER_DESC
{
31 Description
: [WCHAR
; 128],
36 DedicatedVideoMemory
: SIZE_T
,
37 DedicatedSystemMemory
: SIZE_T
,
38 SharedSystemMemory
: SIZE_T
,
41 STRUCT
!{struct DXGI_OUTPUT_DESC
{
42 DeviceName
: [WCHAR
; 32],
43 DesktopCoordinates
: RECT
,
44 AttachedToDesktop
: BOOL
,
45 Rotation
: DXGI_MODE_ROTATION
,
48 STRUCT
!{struct DXGI_SHARED_RESOURCE
{
51 pub const DXGI_RESOURCE_PRIORITY_MINIMUM
: DWORD
= 0x28000000;
52 pub const DXGI_RESOURCE_PRIORITY_LOW
: DWORD
= 0x50000000;
53 pub const DXGI_RESOURCE_PRIORITY_NORMAL
: DWORD
= 0x78000000;
54 pub const DXGI_RESOURCE_PRIORITY_HIGH
: DWORD
= 0xa0000000;
55 pub const DXGI_RESOURCE_PRIORITY_MAXIMUM
: DWORD
= 0xc8000000;
56 ENUM
!{enum DXGI_RESIDENCY
{
57 DXGI_RESIDENCY_FULLY_RESIDENT
= 1,
58 DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY
= 2,
59 DXGI_RESIDENCY_EVICTED_TO_DISK
= 3,
61 STRUCT
!{struct DXGI_SURFACE_DESC
{
65 SampleDesc
: DXGI_SAMPLE_DESC
,
67 ENUM
!{enum DXGI_SWAP_EFFECT
{
68 DXGI_SWAP_EFFECT_DISCARD
= 0,
69 DXGI_SWAP_EFFECT_SEQUENTIAL
= 1,
70 DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
= 3,
71 DXGI_SWAP_EFFECT_FLIP_DISCARD
= 4,
73 ENUM
!{enum DXGI_SWAP_CHAIN_FLAG
{
74 DXGI_SWAP_CHAIN_FLAG_NONPREROTATED
= 1,
75 DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
= 2,
76 DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
= 4,
77 DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT
= 8,
78 DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER
= 16,
79 DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY
= 32,
80 DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT
= 64,
81 DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER
= 128,
82 DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO
= 256,
83 DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO
= 512,
84 DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED
= 1024,
85 DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING
= 2048,
87 STRUCT
!{struct DXGI_SWAP_CHAIN_DESC
{
88 BufferDesc
: DXGI_MODE_DESC
,
89 SampleDesc
: DXGI_SAMPLE_DESC
,
90 BufferUsage
: DXGI_USAGE
,
94 SwapEffect
: DXGI_SWAP_EFFECT
,
97 RIDL
!{#[uuid(0xaec22fb8, 0x76f3, 0x4639, 0x9b, 0xe0, 0x28, 0xeb, 0x43, 0xa6, 0x7a, 0x2e)]
98 interface
IDXGIObject(IDXGIObjectVtbl
): IUnknown(IUnknownVtbl
) {
102 pData
: *const c_void
,
104 fn SetPrivateDataInterface(
106 pUnknown
: *const IUnknown
,
110 pDataSize
: *mut UINT
,
115 ppParent
: *mut *mut c_void
,
118 RIDL
!{#[uuid(0x3d3e0379, 0xf9de, 0x4d58, 0xbb, 0x6c, 0x18, 0xd6, 0x29, 0x92, 0xf1, 0xa6)]
119 interface
IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
122 ppDevice
: *mut *mut c_void
,
125 RIDL
!{#[uuid(0x035f3ab4, 0x482e, 0x4e50, 0xb4, 0x1f, 0x8a, 0x7f, 0x8b, 0xd8, 0x96, 0x0b)]
126 interface
IDXGIResource(IDXGIResourceVtbl
): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
) {
128 pSharedHandle
: *mut HANDLE
,
131 pUsage
: *mut DXGI_USAGE
,
133 fn SetEvictionPriority(
134 EvictionPriority
: UINT
,
136 fn GetEvictionPriority(
137 pEvictionPriority
: *mut UINT
,
140 RIDL
!{#[uuid(0x9d8e1289, 0xd7b3, 0x465f, 0x81, 0x26, 0x25, 0x0e, 0x34, 0x9a, 0xf8, 0x5d)]
141 interface
IDXGIKeyedMutex(IDXGIKeyedMutexVtbl
): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
) {
144 dwMilliseconds
: DWORD
,
150 pub const DXGI_MAP_READ
: UINT
= 1;
151 pub const DXGI_MAP_WRITE
: UINT
= 2;
152 pub const DXGI_MAP_DISCARD
: UINT
= 4;
153 RIDL
!{#[uuid(0xcafcb56c, 0x6ac3, 0x4889, 0xbf, 0x47, 0x9e, 0x23, 0xbb, 0xd2, 0x60, 0xec)]
154 interface
IDXGISurface(IDXGISurfaceVtbl
): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
) {
156 pDesc
: *mut DXGI_SURFACE_DESC
,
159 pLockedRect
: *mut DXGI_MAPPED_RECT
,
162 fn Unmap() -> HRESULT
,
164 RIDL
!{#[uuid(0x4ae63092, 0x6327, 0x4c1b, 0x80, 0xae, 0xbf, 0xe1, 0x2e, 0xa3, 0x2b, 0x86)]
165 interface
IDXGISurface1(IDXGISurface1Vtbl
): IDXGISurface(IDXGISurfaceVtbl
) {
171 pDirtyRect
: *mut RECT
,
174 RIDL
!{#[uuid(0x2411e7e1, 0x12ac, 0x4ccf, 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0)]
175 interface
IDXGIAdapter(IDXGIAdapterVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
178 ppOutput
: *mut *mut IDXGIOutput
,
181 pDesc
: *mut DXGI_ADAPTER_DESC
,
183 fn CheckInterfaceSupport(
184 InterfaceName
: REFGUID
,
185 pUMDVersion
: *mut LARGE_INTEGER
,
188 RIDL
!{#[uuid(0xae02eedb, 0xc735, 0x4690, 0x8d, 0x52, 0x5a, 0x8d, 0xc2, 0x02, 0x13, 0xaa)]
189 interface
IDXGIOutput(IDXGIOutputVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
191 pDesc
: *mut DXGI_OUTPUT_DESC
,
193 fn GetDisplayModeList(
194 EnumFormat
: DXGI_FORMAT
,
196 pNumModes
: *mut UINT
,
197 pDesc
: *mut DXGI_MODE_DESC
,
199 fn FindClosestMatchingMode(
200 pModeToMatch
: *const DXGI_MODE_DESC
,
201 pClosestMatch
: *mut DXGI_MODE_DESC
,
202 pConcernedDevice
: *mut IUnknown
,
204 fn WaitForVBlank() -> HRESULT
,
206 pDevice
: *mut IUnknown
,
209 fn ReleaseOwnership() -> (),
210 fn GetGammaControlCapabilities(
211 pGammaCaps
: *mut DXGI_GAMMA_CONTROL_CAPABILITIES
,
214 pArray
: *const DXGI_GAMMA_CONTROL
,
217 pArray
: *mut DXGI_GAMMA_CONTROL
,
219 fn SetDisplaySurface(
220 pScanoutSurface
: *mut IDXGISurface
,
222 fn GetDisplaySurfaceData(
223 pDestination
: *mut IDXGISurface
,
225 fn GetFrameStatistics(
226 pStats
: *mut DXGI_FRAME_STATISTICS
,
229 pub const DXGI_MAX_SWAP_CHAIN_BUFFERS
: DWORD
= 16;
230 pub const DXGI_PRESENT_TEST
: DWORD
= 0x00000001;
231 pub const DXGI_PRESENT_DO_NOT_SEQUENCE
: DWORD
= 0x00000002;
232 pub const DXGI_PRESENT_RESTART
: DWORD
= 0x00000004;
233 pub const DXGI_PRESENT_DO_NOT_WAIT
: DWORD
= 0x00000008;
234 pub const DXGI_PRESENT_STEREO_PREFER_RIGHT
: DWORD
= 0x00000010;
235 pub const DXGI_PRESENT_STEREO_TEMPORARY_MONO
: DWORD
= 0x00000020;
236 pub const DXGI_PRESENT_RESTRICT_TO_OUTPUT
: DWORD
= 0x00000040;
237 pub const DXGI_PRESENT_USE_DURATION
: DWORD
= 0x00000100;
238 pub const DXGI_PRESENT_ALLOW_TEARING
: DWORD
= 0x00000200;
239 pub const DXGI_ENUM_MODES_INTERLACED
: UINT
= 1;
240 pub const DXGI_ENUM_MODES_SCALING
: UINT
= 2;
241 RIDL
!{#[uuid(0x310d36a0, 0xd2e7, 0x4c0a, 0xaa, 0x04, 0x6a, 0x9d, 0x23, 0xb8, 0x88, 0x6a)]
242 interface
IDXGISwapChain(IDXGISwapChainVtbl
): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
) {
250 ppSurface
: *mut *mut c_void
,
252 fn SetFullscreenState(
254 pTarget
: *mut IDXGIOutput
,
256 fn GetFullscreenState(
257 pFullscreen
: *mut BOOL
,
258 ppTarget
: *mut *mut IDXGIOutput
,
261 pDesc
: *mut DXGI_SWAP_CHAIN_DESC
,
267 NewFormat
: DXGI_FORMAT
,
268 SwapChainFlags
: UINT
,
271 pNewTargetParameters
: *const DXGI_MODE_DESC
,
273 fn GetContainingOutput(
274 ppOutput
: *mut *mut IDXGIOutput
,
276 fn GetFrameStatistics(
277 pStats
: *mut DXGI_FRAME_STATISTICS
,
279 fn GetLastPresentCount(
280 pLastPresentCount
: *mut UINT
,
283 RIDL
!{#[uuid(0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69)]
284 interface
IDXGIFactory(IDXGIFactoryVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
287 ppAdapter
: *mut *mut IDXGIAdapter
,
289 fn MakeWindowAssociation(
293 fn GetWindowAssociation(
294 pWindowHandle
: *mut HWND
,
297 pDevice
: *mut IUnknown
,
298 pDesc
: *mut DXGI_SWAP_CHAIN_DESC
,
299 ppSwapChain
: *mut *mut IDXGISwapChain
,
301 fn CreateSoftwareAdapter(
303 ppAdapter
: *mut *mut IDXGIAdapter
,
307 pub fn CreateDXGIFactory(
309 ppFactory
: *mut *mut c_void
,
311 pub fn CreateDXGIFactory1(
313 ppFactory
: *mut *mut c_void
,
316 RIDL
!{#[uuid(0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c)]
317 interface
IDXGIDevice(IDXGIDeviceVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
319 pAdapter
: *mut *mut IDXGIAdapter
,
322 pDesc
: *const DXGI_SURFACE_DESC
,
325 pSharedResource
: *const DXGI_SHARED_RESOURCE
,
326 ppSurface
: *mut *mut IDXGISurface
,
328 fn QueryResourceResidency(
329 ppResources
: *const *mut IUnknown
,
330 pResidencyStatus
: *mut DXGI_RESIDENCY
,
333 fn SetGPUThreadPriority(
336 fn GetGPUThreadPriority(
340 ENUM
!{enum DXGI_ADAPTER_FLAG
{
341 DXGI_ADAPTER_FLAG_NONE
,
342 DXGI_ADAPTER_FLAG_REMOTE
,
343 DXGI_ADAPTER_FLAG_SOFTWARE
,
345 STRUCT
!{struct DXGI_ADAPTER_DESC1
{
346 Description
: [WCHAR
; 128],
351 DedicatedVideoMemory
: SIZE_T
,
352 DedicatedSystemMemory
: SIZE_T
,
353 SharedSystemMemory
: SIZE_T
,
357 STRUCT
!{struct DXGI_DISPLAY_COLOR_SPACE
{
358 PrimaryCoordinates
: [[FLOAT
; 2]; 8],
359 WhitePoints
: [[FLOAT
; 2]; 16],
361 RIDL
!{#[uuid(0x770aae78, 0xf26f, 0x4dba, 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87)]
362 interface
IDXGIFactory1(IDXGIFactory1Vtbl
): IDXGIFactory(IDXGIFactoryVtbl
) {
365 ppAdapter
: *mut *mut IDXGIAdapter1
,
367 fn IsCurrent() -> BOOL
,
369 RIDL
!{#[uuid(0x29038f61, 0x3839, 0x4626, 0x91, 0xfd, 0x08, 0x68, 0x79, 0x01, 0x1a, 0x05)]
370 interface
IDXGIAdapter1(IDXGIAdapter1Vtbl
): IDXGIAdapter(IDXGIAdapterVtbl
) {
372 pDesc
: *mut DXGI_ADAPTER_DESC1
,
375 RIDL
!{#[uuid(0x77db970f, 0x6276, 0x48ba, 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c)]
376 interface
IDXGIDevice1(IDXGIDevice1Vtbl
): IDXGIDevice(IDXGIDeviceVtbl
) {
377 fn SetMaximumFrameLatency(
380 fn GetMaximumFrameLatency(
381 pMaxLatency
: *mut UINT
,
384 DEFINE_GUID
!{IID_IDXGIObject
,
385 0xaec22fb8, 0x76f3, 0x4639, 0x9b, 0xe0, 0x28, 0xeb, 0x43, 0xa6, 0x7a, 0x2e}
386 DEFINE_GUID
!{IID_IDXGIDeviceSubObject
,
387 0x3d3e0379, 0xf9de, 0x4d58, 0xbb, 0x6c, 0x18, 0xd6, 0x29, 0x92, 0xf1, 0xa6}
388 DEFINE_GUID
!{IID_IDXGIResource
,
389 0x035f3ab4, 0x482e, 0x4e50, 0xb4, 0x1f, 0x8a, 0x7f, 0x8b, 0xd8, 0x96, 0x0b}
390 DEFINE_GUID
!{IID_IDXGIKeyedMutex
,
391 0x9d8e1289, 0xd7b3, 0x465f, 0x81, 0x26, 0x25, 0x0e, 0x34, 0x9a, 0xf8, 0x5d}
392 DEFINE_GUID
!{IID_IDXGISurface
,
393 0xcafcb56c, 0x6ac3, 0x4889, 0xbf, 0x47, 0x9e, 0x23, 0xbb, 0xd2, 0x60, 0xec}
394 DEFINE_GUID
!{IID_IDXGISurface1
,
395 0x4ae63092, 0x6327, 0x4c1b, 0x80, 0xae, 0xbf, 0xe1, 0x2e, 0xa3, 0x2b, 0x86}
396 DEFINE_GUID
!{IID_IDXGIAdapter
,
397 0x2411e7e1, 0x12ac, 0x4ccf, 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0}
398 DEFINE_GUID
!{IID_IDXGIOutput
,
399 0xae02eedb, 0xc735, 0x4690, 0x8d, 0x52, 0x5a, 0x8d, 0xc2, 0x02, 0x13, 0xaa}
400 DEFINE_GUID
!{IID_IDXGISwapChain
,
401 0x310d36a0, 0xd2e7, 0x4c0a, 0xaa, 0x04, 0x6a, 0x9d, 0x23, 0xb8, 0x88, 0x6a}
402 DEFINE_GUID
!{IID_IDXGIFactory
,
403 0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69}
404 DEFINE_GUID
!{IID_IDXGIDevice
,
405 0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c}
406 DEFINE_GUID
!{IID_IDXGIFactory1
,
407 0x770aae78, 0xf26f, 0x4dba, 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87}
408 DEFINE_GUID
!{IID_IDXGIAdapter1
,
409 0x29038f61, 0x3839, 0x4626, 0x91, 0xfd, 0x08, 0x68, 0x79, 0x01, 0x1a, 0x05}
410 DEFINE_GUID
!{IID_IDXGIDevice1
,
411 0x77db970f, 0x6276, 0x48ba, 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c}