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 dxgi1_2.h
8 use shared
::basetsd
::SIZE_T
;
10 DXGI_MAPPED_RECT
, DXGI_SWAP_EFFECT
, IDXGIAdapter1
, IDXGIAdapter1Vtbl
, IDXGIDevice1
,
11 IDXGIDevice1Vtbl
, IDXGIFactory1
, IDXGIFactory1Vtbl
, IDXGIObject
, IDXGIObjectVtbl
, IDXGIOutput
,
12 IDXGIOutputVtbl
, IDXGIResource
, IDXGIResourceVtbl
, IDXGISurface1
, IDXGISurface1Vtbl
,
13 IDXGISwapChain
, IDXGISwapChainVtbl
,
15 use shared
::dxgiformat
::DXGI_FORMAT
;
16 use shared
::dxgitype
::{
17 DXGI_MODE_DESC
, DXGI_MODE_ROTATION
, DXGI_MODE_SCALING
, DXGI_MODE_SCANLINE_ORDER
, DXGI_RATIONAL
,
18 DXGI_RGBA
, DXGI_SAMPLE_DESC
, DXGI_USAGE
,
20 use shared
::guiddef
::REFGUID
;
21 use shared
::minwindef
::{BOOL, DWORD, UINT}
;
22 use shared
::windef
::{HWND, POINT, RECT}
;
23 use um
::minwinbase
::SECURITY_ATTRIBUTES
;
24 use um
::unknwnbase
::{IUnknown, IUnknownVtbl}
;
25 use um
::winnt
::{HANDLE, HRESULT, LARGE_INTEGER, LPCWSTR, LUID, WCHAR}
;
26 ENUM
!{enum DXGI_ALPHA_MODE
{
27 DXGI_ALPHA_MODE_UNSPECIFIED
= 0,
28 DXGI_ALPHA_MODE_PREMULTIPLIED
= 1,
29 DXGI_ALPHA_MODE_STRAIGHT
= 2,
30 DXGI_ALPHA_MODE_IGNORE
= 3,
31 DXGI_ALPHA_MODE_FORCE_DWORD
= 0xFFFFFFFF,
33 ENUM
!{enum DXGI_COMPUTE_PREEMPTION_GRANULARITY
{
34 DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY
= 0,
35 DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY
= 1,
36 DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY
= 2,
37 DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY
= 3,
38 DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY
= 4,
40 ENUM
!{enum DXGI_GRAPHICS_PREEMPTION_GRANULARITY
{
41 DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY
= 0,
42 DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY
= 1,
43 DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY
= 2,
44 DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY
= 3,
45 DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY
= 4,
47 ENUM
!{enum DXGI_OUTDUPL_POINTER_SHAPE_TYPE
{
48 DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME
= 1,
49 DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR
= 2,
50 DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR
= 4,
52 ENUM
!{enum DXGI_SCALING
{
53 DXGI_SCALING_STRETCH
= 0,
54 DXGI_SCALING_NONE
= 1,
55 DXGI_SCALING_ASPECT_RATIO_STRETCH
= 2,
57 ENUM
!{enum _DXGI_OFFER_RESOURCE_PRIORITY
{
58 DXGI_OFFER_RESOURCE_PRIORITY_LOW
= 1,
59 DXGI_OFFER_RESOURCE_PRIORITY_NORMAL
= 2,
60 DXGI_OFFER_RESOURCE_PRIORITY_HIGH
= 3,
62 STRUCT
!{struct DXGI_ADAPTER_DESC2
{
63 Description
: [WCHAR
; 128],
68 DedicatedVideoMemory
: SIZE_T
,
69 DedicatedSystemMemory
: SIZE_T
,
70 SharedSystemMemory
: SIZE_T
,
73 GraphicsPreemptionGranularity
: DXGI_GRAPHICS_PREEMPTION_GRANULARITY
,
74 ComputePreemptionGranularity
: DXGI_COMPUTE_PREEMPTION_GRANULARITY
,
76 STRUCT
!{struct DXGI_MODE_DESC1
{
79 RefreshRate
: DXGI_RATIONAL
,
81 ScanlineOrdering
: DXGI_MODE_SCANLINE_ORDER
,
82 Scaling
: DXGI_MODE_SCALING
,
85 STRUCT
!{struct DXGI_OUTDUPL_DESC
{
86 ModeDesc
: DXGI_MODE_DESC
,
87 Rotation
: DXGI_MODE_ROTATION
,
88 DesktopImageInSystemMemory
: BOOL
,
90 STRUCT
!{struct DXGI_OUTDUPL_FRAME_INFO
{
91 LastPresentTime
: LARGE_INTEGER
,
92 LastMouseUpdateTime
: LARGE_INTEGER
,
93 AccumulatedFrames
: UINT
,
95 ProtectedContentMaskedOut
: BOOL
,
96 PointerPosition
: DXGI_OUTDUPL_POINTER_POSITION
,
97 TotalMetadataBufferSize
: UINT
,
98 PointerShapeBufferSize
: UINT
,
100 STRUCT
!{struct DXGI_OUTDUPL_MOVE_RECT
{
102 DestinationRect
: RECT
,
104 STRUCT
!{struct DXGI_OUTDUPL_POINTER_POSITION
{
108 STRUCT
!{struct DXGI_OUTDUPL_POINTER_SHAPE_INFO
{
115 STRUCT
!{struct DXGI_PRESENT_PARAMETERS
{
116 DirtyRectsCount
: UINT
,
117 pDirtyRects
: *mut RECT
,
118 pScrollRect
: *mut RECT
,
119 pScrollOffset
: *mut POINT
,
121 STRUCT
!{struct DXGI_SWAP_CHAIN_DESC1
{
126 SampleDesc
: DXGI_SAMPLE_DESC
,
127 BufferUsage
: DXGI_USAGE
,
129 Scaling
: DXGI_SCALING
,
130 SwapEffect
: DXGI_SWAP_EFFECT
,
131 AlphaMode
: DXGI_ALPHA_MODE
,
134 STRUCT
!{struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC
{
135 RefreshRate
: DXGI_RATIONAL
,
136 ScanlineOrdering
: DXGI_MODE_SCANLINE_ORDER
,
137 Scaling
: DXGI_MODE_SCALING
,
140 RIDL
!{#[uuid(0x0aa1ae0a, 0xfa0e, 0x4b84, 0x86, 0x44, 0xe0, 0x5f, 0xf8, 0xe5, 0xac, 0xb5)]
141 interface
IDXGIAdapter2(IDXGIAdapter2Vtbl
): IDXGIAdapter1(IDXGIAdapter1Vtbl
) {
143 pDesc
: *mut DXGI_ADAPTER_DESC2
,
146 RIDL
!{#[uuid(0x05008617, 0xfbfd, 0x4051, 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9)]
147 interface
IDXGIDevice2(IDXGIDevice2Vtbl
): IDXGIDevice1(IDXGIDevice1Vtbl
) {
150 ppResources
: *mut *mut IDXGIResource
,
151 Priority
: DXGI_OFFER_RESOURCE_PRIORITY
,
155 ppResources
: *mut *mut IDXGIResource
,
156 pDiscarded
: *mut BOOL
,
162 RIDL
!{#[uuid(0xea9dbf1a, 0xc88e, 0x4486, 0x85, 0x4a, 0x98, 0xaa, 0x01, 0x38, 0xf3, 0x0c)]
163 interface
IDXGIDisplayControl(IDXGIDisplayControlVtbl
): IUnknown(IUnknownVtbl
) {
164 fn IsStereoEnabled() -> BOOL
,
169 RIDL
!{#[uuid(0x50c83a1c, 0xe072, 0x4c48, 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0)]
170 interface
IDXGIFactory2(IDXGIFactory2Vtbl
): IDXGIFactory1(IDXGIFactory1Vtbl
) {
171 fn IsWindowedStereoEnabled() -> BOOL
,
172 fn CreateSwapChainForHwnd(
173 pDevice
: *mut IUnknown
,
175 pDesc
: *const DXGI_SWAP_CHAIN_DESC1
,
176 pFullscreenDesc
: *const DXGI_SWAP_CHAIN_FULLSCREEN_DESC
,
177 pRestrictToOutput
: *mut IDXGIOutput
,
178 ppSwapChain
: *mut *mut IDXGISwapChain1
,
180 fn CreateSwapChainForCoreWindow(
181 pDevice
: *mut IUnknown
,
182 pWindow
: *mut IUnknown
,
183 pDesc
: *const DXGI_SWAP_CHAIN_DESC1
,
184 pRestrictToOutput
: *mut IDXGIOutput
,
185 ppSwapChain
: *mut *mut IDXGISwapChain1
,
187 fn GetSharedResourceAdapterLuid(
191 fn RegisterStereoStatusWindow(
194 pdwCookie
: *mut DWORD
,
196 fn RegisterStereoStatusEvent(
198 pdwCookie
: *mut DWORD
,
200 fn UnregisterStereoStatus(
203 fn RegisterOcclusionStatusWindow(
206 pdwCookie
: *mut DWORD
,
208 fn RegisterOcclusionStatusEvent(
210 pdwCookie
: *mut DWORD
,
212 fn UnregisterOcclusionStatus(
215 fn CreateSwapChainForComposition(
216 pDevice
: *mut IUnknown
,
217 pDesc
: *const DXGI_SWAP_CHAIN_DESC1
,
218 pRestrictToOutput
: *mut IDXGIOutput
,
219 ppSwapChain
: *mut *mut IDXGISwapChain1
,
222 RIDL
!{#[uuid(0x00cddea8, 0x939b, 0x4b83, 0xa3, 0x40, 0xa6, 0x85, 0x22, 0x66, 0x66, 0xcc)]
223 interface
IDXGIOutput1(IDXGIOutput1Vtbl
): IDXGIOutput(IDXGIOutputVtbl
) {
224 fn GetDisplayModeList1(
225 EnumFormat
: DXGI_FORMAT
,
227 pNumModes
: *mut UINT
,
228 pDesc
: *mut DXGI_MODE_DESC1
,
230 fn FindClosestMatchingMode1(
231 pModeToMatch
: *const DXGI_MODE_DESC1
,
232 pClosestMatch
: *mut DXGI_MODE_DESC1
,
233 pConcernedDevice
: *mut IUnknown
,
235 fn GetDisplaySurfaceData1(
236 pDestination
: *mut IDXGIResource
,
239 pDevice
: *mut IUnknown
,
240 ppOutputDuplication
: *mut *mut IDXGIOutputDuplication
,
243 RIDL
!{#[uuid(0x191cfac3, 0xa341, 0x470d, 0xb2, 0x6e, 0xa8, 0x64, 0xf4, 0x28, 0x31, 0x9c)]
244 interface
IDXGIOutputDuplication(IDXGIOutputDuplicationVtbl
): IDXGIObject(IDXGIObjectVtbl
) {
246 pDesc
: *mut DXGI_OUTDUPL_DESC
,
249 TimeoutInMilliseconds
: UINT
,
250 pFrameInfo
: *mut DXGI_OUTDUPL_FRAME_INFO
,
251 ppDesktopResource
: *mut *mut IDXGIResource
,
253 fn GetFrameDirtyRects(
254 DirtyRectsBufferSize
: UINT
,
255 pDirtyRectsBuffer
: *mut RECT
,
256 pDirtyRectsBufferSizeRequired
: *mut UINT
,
258 fn GetFrameMoveRects(
259 MoveRectsBufferSize
: UINT
,
260 pMoveRectBuffer
: *mut DXGI_OUTDUPL_MOVE_RECT
,
261 pMoveRectsBufferSizeRequired
: *mut UINT
,
263 fn GetFramePointerShape(
264 PointerShapeBufferSize
: UINT
,
265 pPointerShapeBuffer
: *mut c_void
,
266 pPointerShapeBufferSizeRequired
: *mut UINT
,
267 pPointerShapeInfo
: *mut DXGI_OUTDUPL_POINTER_SHAPE_INFO
,
269 fn MapDesktopSurface(
270 pLockedRect
: *mut DXGI_MAPPED_RECT
,
272 fn UnMapDesktopSurface() -> HRESULT
,
273 fn ReleaseFrame() -> HRESULT
,
275 RIDL
!{#[uuid(0x30961379, 0x4609, 0x4a41, 0x99, 0x8e, 0x54, 0xfe, 0x56, 0x7e, 0xe0, 0xc1)]
276 interface
IDXGIResource1(IDXGIResource1Vtbl
): IDXGIResource(IDXGIResourceVtbl
) {
277 fn CreateSubresourceSurface(
279 ppSurface
: *mut *mut IDXGISurface2
,
281 fn CreateSharedHandle(
282 pAttributes
: *const SECURITY_ATTRIBUTES
,
285 pHandle
: *mut HANDLE
,
288 RIDL
!{#[uuid(0xaba496dd, 0xb617, 0x4cb8, 0xa8, 0x66, 0xbc, 0x44, 0xd7, 0xeb, 0x1f, 0xa2)]
289 interface
IDXGISurface2(IDXGISurface2Vtbl
): IDXGISurface1(IDXGISurface1Vtbl
) {
292 ppParentResource
: *mut *mut c_void
,
293 pSubresourceIndex
: *mut UINT
,
296 RIDL
!{#[uuid(0x790a45f7, 0x0d42, 0x4876, 0x98, 0x3a, 0x0a, 0x55, 0xcf, 0xe6, 0xf4, 0xaa)]
297 interface
IDXGISwapChain1(IDXGISwapChain1Vtbl
): IDXGISwapChain(IDXGISwapChainVtbl
) {
299 pDesc
: *mut DXGI_SWAP_CHAIN_DESC1
,
301 fn GetFullscreenDesc(
302 pDesc
: *mut DXGI_SWAP_CHAIN_FULLSCREEN_DESC
,
309 ppUnk
: *mut *mut c_void
,
314 pPresentParameters
: *const DXGI_PRESENT_PARAMETERS
,
316 fn IsTemporaryMonoSupported() -> BOOL
,
317 fn GetRestrictToOutput(
318 ppRestrictToOutput
: *mut *mut IDXGIOutput
,
320 fn SetBackgroundColor(
321 pColor
: *const DXGI_RGBA
,
323 fn GetBackgroundColor(
324 pColor
: *mut DXGI_RGBA
,
327 Rotation
: DXGI_MODE_ROTATION
,
330 pRotation
: *mut DXGI_MODE_ROTATION
,
333 pub type DXGI_OFFER_RESOURCE_PRIORITY
= _DXGI_OFFER_RESOURCE_PRIORITY
;
334 pub const DXGI_ENUM_MODES_DISABLED_STEREO
: UINT
= 8;
335 pub const DXGI_ENUM_MODES_STEREO
: UINT
= 4;
336 pub const DXGI_SHARED_RESOURCE_READ
: UINT
= 0x80000000;
337 pub const DXGI_SHARED_RESOURCE_WRITE
: UINT
= 1;
338 DEFINE_GUID
!{IID_IDXGIDisplayControl
,
339 0xea9dbf1a, 0xc88e, 0x4486, 0x85, 0x4a, 0x98, 0xaa, 0x01, 0x38, 0xf3, 0x0c}
340 DEFINE_GUID
!{IID_IDXGIOutputDuplication
,
341 0x191cfac3, 0xa341, 0x470d, 0xb2, 0x6e, 0xa8, 0x64, 0xf4, 0x28, 0x31, 0x9c}
342 DEFINE_GUID
!{IID_IDXGISurface2
,
343 0xaba496dd, 0xb617, 0x4cb8, 0xa8, 0x66, 0xbc, 0x44, 0xd7, 0xeb, 0x1f, 0xa2}
344 DEFINE_GUID
!{IID_IDXGIResource1
,
345 0x30961379, 0x4609, 0x4a41, 0x99, 0x8e, 0x54, 0xfe, 0x56, 0x7e, 0xe0, 0xc1}
346 DEFINE_GUID
!{IID_IDXGIDevice2
,
347 0x05008617, 0xfbfd, 0x4051, 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9}
348 DEFINE_GUID
!{IID_IDXGISwapChain1
,
349 0x790a45f7, 0x0d42, 0x4876, 0x98, 0x3a, 0x0a, 0x55, 0xcf, 0xe6, 0xf4, 0xaa}
350 DEFINE_GUID
!{IID_IDXGIFactory2
,
351 0x50c83a1c, 0xe072, 0x4c48, 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0}
352 DEFINE_GUID
!{IID_IDXGIAdapter2
,
353 0x0aa1ae0a, 0xfa0e, 0x4b84, 0x86, 0x44, 0xe0, 0x5f, 0xf8, 0xe5, 0xac, 0xb5}
354 DEFINE_GUID
!{IID_IDXGIOutput1
,
355 0x00cddea8, 0x939b, 0x4b83, 0xa3, 0x40, 0xa6, 0x85, 0x22, 0x66, 0x66, 0xcc}