1 // Copyright © 2015-2017 winapi-rs developers
2 // Licensed under the Apache License, Version 2.0
3 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
5 // All files in the project carrying such notice may not be copied, modified, or distributed
6 // except according to those terms.
7 //! Mappings for the contents of dxgi.h
9 use shared
::basetsd
::{SIZE_T, UINT64}
;
10 use shared
::dxgiformat
::DXGI_FORMAT
;
11 use shared
::dxgitype
::{
12 DXGI_GAMMA_CONTROL
, DXGI_GAMMA_CONTROL_CAPABILITIES
, DXGI_MODE_DESC
, DXGI_MODE_ROTATION
,
13 DXGI_SAMPLE_DESC
, DXGI_USAGE
,
15 use shared
::guiddef
::{REFGUID, REFIID}
;
16 use shared
::minwindef
::{BOOL, BYTE, DWORD, FLOAT, HMODULE, UINT}
;
17 use shared
::windef
::{HDC, HMONITOR, HWND, RECT}
;
18 use um
::unknwnbase
::{IUnknown, IUnknownVtbl}
;
19 use um
::winnt
::{HANDLE, HRESULT, INT, LARGE_INTEGER, LUID, WCHAR}
;
20 STRUCT
!{struct DXGI_FRAME_STATISTICS
{
22 PresentRefreshCount
: UINT
,
23 SyncRefreshCount
: UINT
,
24 SyncQPCTime
: LARGE_INTEGER
,
25 SyncGPUTime
: LARGE_INTEGER
,
27 STRUCT
!{struct DXGI_MAPPED_RECT
{
31 STRUCT
!{struct DXGI_ADAPTER_DESC
{
32 Description
: [WCHAR
; 128],
37 DedicatedVideoMemory
: SIZE_T
,
38 DedicatedSystemMemory
: SIZE_T
,
39 SharedSystemMemory
: SIZE_T
,
42 STRUCT
!{struct DXGI_OUTPUT_DESC
{
43 DeviceName
: [WCHAR
; 32],
44 DesktopCoordinates
: RECT
,
45 AttachedToDesktop
: BOOL
,
46 Rotation
: DXGI_MODE_ROTATION
,
49 STRUCT
!{struct DXGI_SHARED_RESOURCE
{
52 pub const DXGI_RESOURCE_PRIORITY_MINIMUM
: DWORD
= 0x28000000;
53 pub const DXGI_RESOURCE_PRIORITY_LOW
: DWORD
= 0x50000000;
54 pub const DXGI_RESOURCE_PRIORITY_NORMAL
: DWORD
= 0x78000000;
55 pub const DXGI_RESOURCE_PRIORITY_HIGH
: DWORD
= 0xa0000000;
56 pub const DXGI_RESOURCE_PRIORITY_MAXIMUM
: DWORD
= 0xc8000000;
57 ENUM
!{enum DXGI_RESIDENCY
{
58 DXGI_RESIDENCY_FULLY_RESIDENT
= 1,
59 DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY
= 2,
60 DXGI_RESIDENCY_EVICTED_TO_DISK
= 3,
62 STRUCT
!{struct DXGI_SURFACE_DESC
{
66 SampleDesc
: DXGI_SAMPLE_DESC
,
68 ENUM
!{enum DXGI_SWAP_EFFECT
{
69 DXGI_SWAP_EFFECT_DISCARD
= 0,
70 DXGI_SWAP_EFFECT_SEQUENTIAL
= 1,
71 DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
= 3,
72 DXGI_SWAP_EFFECT_FLIP_DISCARD
= 4,
74 ENUM
!{enum DXGI_SWAP_CHAIN_FLAG
{
75 DXGI_SWAP_CHAIN_FLAG_NONPREROTATED
= 1,
76 DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
= 2,
77 DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
= 4,
78 DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT
= 8,
79 DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER
= 16,
80 DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY
= 32,
81 DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT
= 64,
82 DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER
= 128,
83 DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO
= 256,
84 DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO
= 512,
85 DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED
= 1024,
86 DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING
= 2048,
88 STRUCT
!{struct DXGI_SWAP_CHAIN_DESC
{
89 BufferDesc
: DXGI_MODE_DESC
,
90 SampleDesc
: DXGI_SAMPLE_DESC
,
91 BufferUsage
: DXGI_USAGE
,
95 SwapEffect
: DXGI_SWAP_EFFECT
,
98 RIDL
!{#[uuid(0xaec22fb8, 0x76f3, 0x4639, 0x9b, 0xe0, 0x28, 0xeb, 0x43, 0xa6, 0x7a, 0x2e)]
99 interface
IDXGIObject(IDXGIObjectVtbl
): IUnknown(IUnknownVtbl
) {
103 pData
: *const c_void
,
105 fn SetPrivateDataInterface(
107 pUnknown
: *const IUnknown
,
111 pDataSize
: *mut UINT
,
116 ppParent
: *mut *mut c_void
,
119 RIDL
!{#[uuid(0x3d3e0379, 0xf9de, 0x4d58, 0xbb, 0x6c, 0x18, 0xd6, 0x29, 0x92, 0xf1, 0xa6)]
120 interface
IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
123 ppDevice
: *mut *mut c_void
,
126 RIDL
!{#[uuid(0x035f3ab4, 0x482e, 0x4e50, 0xb4, 0x1f, 0x8a, 0x7f, 0x8b, 0xd8, 0x96, 0x0b)]
127 interface
IDXGIResource(IDXGIResourceVtbl
): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
) {
129 pSharedHandle
: *mut HANDLE
,
132 pUsage
: *mut DXGI_USAGE
,
134 fn SetEvictionPriority(
135 EvictionPriority
: UINT
,
137 fn GetEvictionPriority(
138 pEvictionPriority
: *mut UINT
,
141 RIDL
!{#[uuid(0x9d8e1289, 0xd7b3, 0x465f, 0x81, 0x26, 0x25, 0x0e, 0x34, 0x9a, 0xf8, 0x5d)]
142 interface
IDXGIKeyedMutex(IDXGIKeyedMutexVtbl
): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
) {
145 dwMilliseconds
: DWORD
,
151 pub const DXGI_MAP_READ
: UINT
= 1;
152 pub const DXGI_MAP_WRITE
: UINT
= 2;
153 pub const DXGI_MAP_DISCARD
: UINT
= 4;
154 RIDL
!{#[uuid(0xcafcb56c, 0x6ac3, 0x4889, 0xbf, 0x47, 0x9e, 0x23, 0xbb, 0xd2, 0x60, 0xec)]
155 interface
IDXGISurface(IDXGISurfaceVtbl
): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
) {
157 pDesc
: *mut DXGI_SURFACE_DESC
,
160 pLockedRect
: *mut DXGI_MAPPED_RECT
,
163 fn Unmap() -> HRESULT
,
165 RIDL
!{#[uuid(0x4ae63092, 0x6327, 0x4c1b, 0x80, 0xae, 0xbf, 0xe1, 0x2e, 0xa3, 0x2b, 0x86)]
166 interface
IDXGISurface1(IDXGISurface1Vtbl
): IDXGISurface(IDXGISurfaceVtbl
) {
172 pDirtyRect
: *mut RECT
,
175 RIDL
!{#[uuid(0x2411e7e1, 0x12ac, 0x4ccf, 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0)]
176 interface
IDXGIAdapter(IDXGIAdapterVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
179 ppOutput
: *mut *mut IDXGIOutput
,
182 pDesc
: *mut DXGI_ADAPTER_DESC
,
184 fn CheckInterfaceSupport(
185 InterfaceName
: REFGUID
,
186 pUMDVersion
: *mut LARGE_INTEGER
,
189 RIDL
!{#[uuid(0xae02eedb, 0xc735, 0x4690, 0x8d, 0x52, 0x5a, 0x8d, 0xc2, 0x02, 0x13, 0xaa)]
190 interface
IDXGIOutput(IDXGIOutputVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
192 pDesc
: *mut DXGI_OUTPUT_DESC
,
194 fn GetDisplayModeList(
195 EnumFormat
: DXGI_FORMAT
,
197 pNumModes
: *mut UINT
,
198 pDesc
: *mut DXGI_MODE_DESC
,
200 fn FindClosestMatchingMode(
201 pModeToMatch
: *const DXGI_MODE_DESC
,
202 pClosestMatch
: *mut DXGI_MODE_DESC
,
203 pConcernedDevice
: *mut IUnknown
,
205 fn WaitForVBlank() -> HRESULT
,
207 pDevice
: *mut IUnknown
,
210 fn ReleaseOwnership() -> (),
211 fn GetGammaControlCapabilities(
212 pGammaCaps
: *mut DXGI_GAMMA_CONTROL_CAPABILITIES
,
215 pArray
: *const DXGI_GAMMA_CONTROL
,
218 pArray
: *mut DXGI_GAMMA_CONTROL
,
220 fn SetDisplaySurface(
221 pScanoutSurface
: *mut IDXGISurface
,
223 fn GetDisplaySurfaceData(
224 pDestination
: *mut IDXGISurface
,
226 fn GetFrameStatistics(
227 pStats
: *mut DXGI_FRAME_STATISTICS
,
230 pub const DXGI_MAX_SWAP_CHAIN_BUFFERS
: DWORD
= 16;
231 pub const DXGI_PRESENT_TEST
: DWORD
= 0x00000001;
232 pub const DXGI_PRESENT_DO_NOT_SEQUENCE
: DWORD
= 0x00000002;
233 pub const DXGI_PRESENT_RESTART
: DWORD
= 0x00000004;
234 pub const DXGI_PRESENT_DO_NOT_WAIT
: DWORD
= 0x00000008;
235 pub const DXGI_PRESENT_STEREO_PREFER_RIGHT
: DWORD
= 0x00000010;
236 pub const DXGI_PRESENT_STEREO_TEMPORARY_MONO
: DWORD
= 0x00000020;
237 pub const DXGI_PRESENT_RESTRICT_TO_OUTPUT
: DWORD
= 0x00000040;
238 pub const DXGI_PRESENT_USE_DURATION
: DWORD
= 0x00000100;
239 pub const DXGI_PRESENT_ALLOW_TEARING
: DWORD
= 0x00000200;
240 pub const DXGI_ENUM_MODES_INTERLACED
: UINT
= 1;
241 pub const DXGI_ENUM_MODES_SCALING
: UINT
= 2;
242 RIDL
!{#[uuid(0x310d36a0, 0xd2e7, 0x4c0a, 0xaa, 0x04, 0x6a, 0x9d, 0x23, 0xb8, 0x88, 0x6a)]
243 interface
IDXGISwapChain(IDXGISwapChainVtbl
): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl
) {
251 ppSurface
: *mut *mut c_void
,
253 fn SetFullscreenState(
255 pTarget
: *mut IDXGIOutput
,
257 fn GetFullscreenState(
258 pFullscreen
: *mut BOOL
,
259 ppTarget
: *mut *mut IDXGIOutput
,
262 pDesc
: *mut DXGI_SWAP_CHAIN_DESC
,
268 NewFormat
: DXGI_FORMAT
,
269 SwapChainFlags
: UINT
,
272 pNewTargetParameters
: *const DXGI_MODE_DESC
,
274 fn GetContainingOutput(
275 ppOutput
: *mut *mut IDXGIOutput
,
277 fn GetFrameStatistics(
278 pStats
: *mut DXGI_FRAME_STATISTICS
,
280 fn GetLastPresentCount(
281 pLastPresentCount
: *mut UINT
,
284 RIDL
!{#[uuid(0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69)]
285 interface
IDXGIFactory(IDXGIFactoryVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
288 ppAdapter
: *mut *mut IDXGIAdapter
,
290 fn MakeWindowAssociation(
294 fn GetWindowAssociation(
295 pWindowHandle
: *mut HWND
,
298 pDevice
: *mut IUnknown
,
299 pDesc
: *mut DXGI_SWAP_CHAIN_DESC
,
300 ppSwapChain
: *mut *mut IDXGISwapChain
,
302 fn CreateSoftwareAdapter(
304 ppAdapter
: *mut *mut IDXGIAdapter
,
308 pub fn CreateDXGIFactory(
310 ppFactory
: *mut *mut c_void
,
312 pub fn CreateDXGIFactory1(
314 ppFactory
: *mut *mut c_void
,
317 RIDL
!{#[uuid(0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c)]
318 interface
IDXGIDevice(IDXGIDeviceVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
320 pAdapter
: *mut *mut IDXGIAdapter
,
323 pDesc
: *const DXGI_SURFACE_DESC
,
326 pSharedResource
: *const DXGI_SHARED_RESOURCE
,
327 ppSurface
: *mut *mut IDXGISurface
,
329 fn QueryResourceResidency(
330 ppResources
: *const *mut IUnknown
,
331 pResidencyStatus
: *mut DXGI_RESIDENCY
,
334 fn SetGPUThreadPriority(
337 fn GetGPUThreadPriority(
341 ENUM
!{enum DXGI_ADAPTER_FLAG
{
342 DXGI_ADAPTER_FLAG_NONE
,
343 DXGI_ADAPTER_FLAG_REMOTE
,
344 DXGI_ADAPTER_FLAG_SOFTWARE
,
346 STRUCT
!{struct DXGI_ADAPTER_DESC1
{
347 Description
: [WCHAR
; 128],
352 DedicatedVideoMemory
: SIZE_T
,
353 DedicatedSystemMemory
: SIZE_T
,
354 SharedSystemMemory
: SIZE_T
,
358 STRUCT
!{struct DXGI_DISPLAY_COLOR_SPACE
{
359 PrimaryCoordinates
: [[FLOAT
; 2]; 8],
360 WhitePoints
: [[FLOAT
; 2]; 16],
362 RIDL
!{#[uuid(0x770aae78, 0xf26f, 0x4dba, 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87)]
363 interface
IDXGIFactory1(IDXGIFactory1Vtbl
): IDXGIFactory(IDXGIFactoryVtbl
) {
366 ppAdapter
: *mut *mut IDXGIAdapter1
,
368 fn IsCurrent() -> BOOL
,
370 RIDL
!{#[uuid(0x29038f61, 0x3839, 0x4626, 0x91, 0xfd, 0x08, 0x68, 0x79, 0x01, 0x1a, 0x05)]
371 interface
IDXGIAdapter1(IDXGIAdapter1Vtbl
): IDXGIAdapter(IDXGIAdapterVtbl
) {
373 pDesc
: *mut DXGI_ADAPTER_DESC1
,
376 RIDL
!{#[uuid(0x77db970f, 0x6276, 0x48ba, 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c)]
377 interface
IDXGIDevice1(IDXGIDevice1Vtbl
): IDXGIDevice(IDXGIDeviceVtbl
) {
378 fn SetMaximumFrameLatency(
381 fn GetMaximumFrameLatency(
382 pMaxLatency
: *mut UINT
,
385 DEFINE_GUID
!{IID_IDXGIObject
,
386 0xaec22fb8, 0x76f3, 0x4639, 0x9b, 0xe0, 0x28, 0xeb, 0x43, 0xa6, 0x7a, 0x2e}
387 DEFINE_GUID
!{IID_IDXGIDeviceSubObject
,
388 0x3d3e0379, 0xf9de, 0x4d58, 0xbb, 0x6c, 0x18, 0xd6, 0x29, 0x92, 0xf1, 0xa6}
389 DEFINE_GUID
!{IID_IDXGIResource
,
390 0x035f3ab4, 0x482e, 0x4e50, 0xb4, 0x1f, 0x8a, 0x7f, 0x8b, 0xd8, 0x96, 0x0b}
391 DEFINE_GUID
!{IID_IDXGIKeyedMutex
,
392 0x9d8e1289, 0xd7b3, 0x465f, 0x81, 0x26, 0x25, 0x0e, 0x34, 0x9a, 0xf8, 0x5d}
393 DEFINE_GUID
!{IID_IDXGISurface
,
394 0xcafcb56c, 0x6ac3, 0x4889, 0xbf, 0x47, 0x9e, 0x23, 0xbb, 0xd2, 0x60, 0xec}
395 DEFINE_GUID
!{IID_IDXGISurface1
,
396 0x4ae63092, 0x6327, 0x4c1b, 0x80, 0xae, 0xbf, 0xe1, 0x2e, 0xa3, 0x2b, 0x86}
397 DEFINE_GUID
!{IID_IDXGIAdapter
,
398 0x2411e7e1, 0x12ac, 0x4ccf, 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0}
399 DEFINE_GUID
!{IID_IDXGIOutput
,
400 0xae02eedb, 0xc735, 0x4690, 0x8d, 0x52, 0x5a, 0x8d, 0xc2, 0x02, 0x13, 0xaa}
401 DEFINE_GUID
!{IID_IDXGISwapChain
,
402 0x310d36a0, 0xd2e7, 0x4c0a, 0xaa, 0x04, 0x6a, 0x9d, 0x23, 0xb8, 0x88, 0x6a}
403 DEFINE_GUID
!{IID_IDXGIFactory
,
404 0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69}
405 DEFINE_GUID
!{IID_IDXGIDevice
,
406 0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c}
407 DEFINE_GUID
!{IID_IDXGIFactory1
,
408 0x770aae78, 0xf26f, 0x4dba, 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87}
409 DEFINE_GUID
!{IID_IDXGIAdapter1
,
410 0x29038f61, 0x3839, 0x4626, 0x91, 0xfd, 0x08, 0x68, 0x79, 0x01, 0x1a, 0x05}
411 DEFINE_GUID
!{IID_IDXGIDevice1
,
412 0x77db970f, 0x6276, 0x48ba, 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c}