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_3.h
7 use ctypes::c_void;
8 use shared::dxgi::{IDXGIOutput, IDXGIResource};
9 use shared::dxgi1_2::{
10     DXGI_SWAP_CHAIN_DESC1, IDXGIDevice2, IDXGIDevice2Vtbl, IDXGIFactory2, IDXGIFactory2Vtbl,
11     IDXGIOutput1, IDXGIOutput1Vtbl, IDXGISwapChain1, IDXGISwapChain1Vtbl,
12 };
13 use shared::dxgiformat::DXGI_FORMAT;
14 use shared::guiddef::REFIID;
15 use shared::minwindef::{BOOL, FLOAT, UINT};
16 use shared::windef::RECT;
17 use um::unknwnbase::{IUnknown, IUnknownVtbl};
18 use um::winnt::{HANDLE, HRESULT, LARGE_INTEGER};
19 ENUM!{enum DXGI_FRAME_PRESENTATION_MODE {
20     DXGI_FRAME_PRESENTATION_MODE_COMPOSED = 0,
21     DXGI_FRAME_PRESENTATION_MODE_OVERLAY = 1,
22     DXGI_FRAME_PRESENTATION_MODE_NONE = 2,
23     DXGI_FRAME_PRESENTATION_MODE_COMPOSITION_FAILURE = 3,
24 }}
25 ENUM!{enum DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS {
26     DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1,
27     DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709 = 0x2,
28     DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC = 0x4,
29 }}
30 ENUM!{enum DXGI_OVERLAY_SUPPORT_FLAG {
31     DXGI_OVERLAY_SUPPORT_FLAG_DIRECT = 0x1,
32     DXGI_OVERLAY_SUPPORT_FLAG_SCALING = 0x2,
33 }}
34 STRUCT!{struct DXGI_DECODE_SWAP_CHAIN_DESC {
35     Flags: UINT,
36 }}
37 STRUCT!{struct DXGI_FRAME_STATISTICS_MEDIA {
38     PresentCount: UINT,
39     PresentRefreshCount: UINT,
40     SyncRefreshCount: UINT,
41     SyncQPCTime: LARGE_INTEGER,
42     SyncGPUTime: LARGE_INTEGER,
43     CompositionMode: DXGI_FRAME_PRESENTATION_MODE,
44     ApprovedPresentDuration: UINT,
45 }}
46 STRUCT!{struct DXGI_MATRIX_3X2_F {
47     _11: FLOAT,
48     _12: FLOAT,
49     _21: FLOAT,
50     _22: FLOAT,
51     _31: FLOAT,
52     _32: FLOAT,
53 }}
54 RIDL!{#[uuid(0x2633066b, 0x4514, 0x4c7a, 0x8f, 0xd8, 0x12, 0xea, 0x98, 0x05, 0x9d, 0x18)]
55 interface IDXGIDecodeSwapChain(IDXGIDecodeSwapChainVtbl): IUnknown(IUnknownVtbl) {
56     fn PresentBuffer(
57         BufferToPresent: UINT,
58         SyncInterval: UINT,
59         Flags: UINT,
60     ) -> HRESULT,
61     fn SetSourceRect(
62         pRect: *const RECT,
63     ) -> HRESULT,
64     fn SetTargetRect(
65         pRect: *const RECT,
66     ) -> HRESULT,
67     fn SetDestSize(
68         Width: UINT,
69         Height: UINT,
70     ) -> HRESULT,
71     fn GetSourceRect(
72         pRect: *mut RECT,
73     ) -> HRESULT,
74     fn GetTargetRect(
75         pRect: *mut RECT,
76     ) -> HRESULT,
77     fn GetDestSize(
78         pWidth: *mut UINT,
79         pHeight: *mut UINT,
80     ) -> HRESULT,
81     fn SetColorSpace(
82         ColorSpace: DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS,
83     ) -> HRESULT,
84     fn GetColorSpace() -> DXGI_MULTIPLANE_OVERLAY_YCbCr_FLAGS,
85 }}
86 extern "system" {
CreateDXGIFactory2( Flags: UINT, riid: REFIID, ppFactory: *mut *mut c_void, ) -> HRESULT87     pub fn CreateDXGIFactory2(
88         Flags: UINT,
89         riid: REFIID,
90         ppFactory: *mut *mut c_void,
91     ) -> HRESULT;
DXGIGetDebugInterface1( Flags: UINT, riid: REFIID, pDebug: *mut *mut c_void, ) -> HRESULT92     pub fn DXGIGetDebugInterface1(
93         Flags: UINT,
94         riid: REFIID,
95         pDebug: *mut *mut c_void,
96     ) -> HRESULT;
97 }
98 RIDL!{#[uuid(0x6007896c, 0x3244, 0x4afd, 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23)]
99 interface IDXGIDevice3(IDXGIDevice3Vtbl): IDXGIDevice2(IDXGIDevice2Vtbl) {
100     fn Trim() -> (),
101 }}
102 RIDL!{#[uuid(0x25483823, 0xcd46, 0x4c7d, 0x86, 0xca, 0x47, 0xaa, 0x95, 0xb8, 0x37, 0xbd)]
103 interface IDXGIFactory3(IDXGIFactory3Vtbl): IDXGIFactory2(IDXGIFactory2Vtbl) {
104     fn GetCreationFlags() -> UINT,
105 }}
106 RIDL!{#[uuid(0x41e7d1f2, 0xa591, 0x4f7b, 0xa2, 0xe5, 0xfa, 0x9c, 0x84, 0x3e, 0x1c, 0x12)]
107 interface IDXGIFactoryMedia(IDXGIFactoryMediaVtbl): IUnknown(IUnknownVtbl) {
108     fn CreateSwapChainForCompositionSurfaceHandle(
109         pDevice: *mut IUnknown,
110         hSurface: HANDLE,
111         pDesc: *const DXGI_SWAP_CHAIN_DESC1,
112         pRestrictToOutput: *mut IDXGIOutput,
113         ppSwapChain: *mut *mut IDXGISwapChain1,
114     ) -> HRESULT,
115     fn CreateDecodeSwapChainForCompositionSurfaceHandle(
116         pDevice: *mut IUnknown,
117         hSurface: HANDLE,
118         pDesc: *mut DXGI_DECODE_SWAP_CHAIN_DESC,
119         pYuvDecodeBuffers: *mut IDXGIResource,
120         pRestrictToOutput: *mut IDXGIOutput,
121         ppSwapChain: *mut *mut IDXGIDecodeSwapChain,
122     ) -> HRESULT,
123 }}
124 RIDL!{#[uuid(0x595e39d1, 0x2724, 0x4663, 0x99, 0xb1, 0xda, 0x96, 0x9d, 0xe2, 0x83, 0x64)]
125 interface IDXGIOutput2(IDXGIOutput2Vtbl): IDXGIOutput1(IDXGIOutput1Vtbl) {
126     fn SupportsOverlays() -> BOOL,
127 }}
128 RIDL!{#[uuid(0x8a6bb301, 0x7e7e, 0x41f4, 0xa8, 0xe0, 0x5b, 0x32, 0xf7, 0xf9, 0x9b, 0x18)]
129 interface IDXGIOutput3(IDXGIOutput3Vtbl): IDXGIOutput2(IDXGIOutput2Vtbl) {
130     fn CheckOverlaySupport(
131         EnumFormat: DXGI_FORMAT,
132         pConcernedDevice: *mut IUnknown,
133         pFlags: *mut UINT,
134     ) -> HRESULT,
135 }}
136 RIDL!{#[uuid(0xa8be2ac4, 0x199f, 0x4946, 0xb3, 0x31, 0x79, 0x59, 0x9f, 0xb9, 0x8d, 0xe7)]
137 interface IDXGISwapChain2(IDXGISwapChain2Vtbl): IDXGISwapChain1(IDXGISwapChain1Vtbl) {
138     fn SetSourceSize(
139         Width: UINT,
140         Height: UINT,
141     ) -> HRESULT,
142     fn GetSourceSize(
143         pWidth: *mut UINT,
144         pHeight: *mut UINT,
145     ) -> HRESULT,
146     fn SetMaximumFrameLatency(
147         MaxLatency: UINT,
148     ) -> HRESULT,
149     fn GetMaximumFrameLatency(
150         pMaxLatency: *mut UINT,
151     ) -> HRESULT,
152     fn GetFrameLatencyWaitableObject() -> HANDLE,
153     fn SetMatrixTransform(
154         pMatrix: *const DXGI_MATRIX_3X2_F,
155     ) -> HRESULT,
156     fn GetMatrixTransform(
157         pMatrix: *mut DXGI_MATRIX_3X2_F,
158     ) -> HRESULT,
159 }}
160 RIDL!{#[uuid(0xdd95b90b, 0xf05f, 0x4f6a, 0xbd, 0x65, 0x25, 0xbf, 0xb2, 0x64, 0xbd, 0x84)]
161 interface IDXGISwapChainMedia(IDXGISwapChainMediaVtbl): IUnknown(IUnknownVtbl) {
162     fn GetFrameStatisticsMedia(
163         pStats: *mut DXGI_FRAME_STATISTICS_MEDIA,
164     ) -> HRESULT,
165     fn SetPresentDuration(
166         Duration: UINT,
167     ) -> HRESULT,
168     fn CheckPresentDurationSupport(
169         DesiredPresentDuration: UINT,
170         pClosestSmallerPresentDuration: *mut UINT,
171         pClosestLargerPresentDuration: *mut UINT,
172     ) -> HRESULT,
173 }}
174 pub const DXGI_CREATE_FACTORY_DEBUG: UINT = 0x1;
175 DEFINE_GUID!{IID_IDXGIDevice3,
176     0x6007896c, 0x3244, 0x4afd, 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23}
177 DEFINE_GUID!{IID_IDXGISwapChain2,
178     0xa8be2ac4, 0x199f, 0x4946, 0xb3, 0x31, 0x79, 0x59, 0x9f, 0xb9, 0x8d, 0xe7}
179 DEFINE_GUID!{IID_IDXGIOutput2,
180     0x595e39d1, 0x2724, 0x4663, 0x99, 0xb1, 0xda, 0x96, 0x9d, 0xe2, 0x83, 0x64}
181 DEFINE_GUID!{IID_IDXGIFactory3,
182     0x25483823, 0xcd46, 0x4c7d, 0x86, 0xca, 0x47, 0xaa, 0x95, 0xb8, 0x37, 0xbd}
183 DEFINE_GUID!{IID_IDXGIDecodeSwapChain,
184     0x2633066b, 0x4514, 0x4c7a, 0x8f, 0xd8, 0x12, 0xea, 0x98, 0x05, 0x9d, 0x18}
185 DEFINE_GUID!{IID_IDXGIFactoryMedia,
186     0x41e7d1f2, 0xa591, 0x4f7b, 0xa2, 0xe5, 0xfa, 0x9c, 0x84, 0x3e, 0x1c, 0x12}
187 DEFINE_GUID!{IID_IDXGISwapChainMedia,
188     0xdd95b90b, 0xf05f, 0x4f6a, 0xbd, 0x65, 0x25, 0xbf, 0xb2, 0x64, 0xbd, 0x84}
189 DEFINE_GUID!{IID_IDXGIOutput3,
190     0x8a6bb301, 0x7e7e, 0x41f4, 0xa8, 0xe0, 0x5b, 0x32, 0xf7, 0xf9, 0x9b, 0x18}
191