]> git.proxmox.com Git - rustc.git/blob - src/vendor/winapi/src/shared/dxgi.rs
New upstream version 1.31.0+dfsg1
[rustc.git] / src / vendor / winapi / src / shared / dxgi.rs
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
8 use ctypes::c_void;
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,
14 };
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 {
21 PresentCount: UINT,
22 PresentRefreshCount: UINT,
23 SyncRefreshCount: UINT,
24 SyncQPCTime: LARGE_INTEGER,
25 SyncGPUTime: LARGE_INTEGER,
26 }}
27 STRUCT!{struct DXGI_MAPPED_RECT {
28 Pitch: INT,
29 pBits: *mut BYTE,
30 }}
31 STRUCT!{struct DXGI_ADAPTER_DESC {
32 Description: [WCHAR; 128],
33 VendorId: UINT,
34 DeviceId: UINT,
35 SubSysId: UINT,
36 Revision: UINT,
37 DedicatedVideoMemory: SIZE_T,
38 DedicatedSystemMemory: SIZE_T,
39 SharedSystemMemory: SIZE_T,
40 AdapterLuid: LUID,
41 }}
42 STRUCT!{struct DXGI_OUTPUT_DESC {
43 DeviceName: [WCHAR; 32],
44 DesktopCoordinates: RECT,
45 AttachedToDesktop: BOOL,
46 Rotation: DXGI_MODE_ROTATION,
47 Monitor: HMONITOR,
48 }}
49 STRUCT!{struct DXGI_SHARED_RESOURCE {
50 Handle: HANDLE,
51 }}
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,
61 }}
62 STRUCT!{struct DXGI_SURFACE_DESC {
63 Width: UINT,
64 Height: UINT,
65 Format: DXGI_FORMAT,
66 SampleDesc: DXGI_SAMPLE_DESC,
67 }}
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,
73 }}
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,
87 }}
88 STRUCT!{struct DXGI_SWAP_CHAIN_DESC {
89 BufferDesc: DXGI_MODE_DESC,
90 SampleDesc: DXGI_SAMPLE_DESC,
91 BufferUsage: DXGI_USAGE,
92 BufferCount: UINT,
93 OutputWindow: HWND,
94 Windowed: BOOL,
95 SwapEffect: DXGI_SWAP_EFFECT,
96 Flags: UINT,
97 }}
98 RIDL!{#[uuid(0xaec22fb8, 0x76f3, 0x4639, 0x9b, 0xe0, 0x28, 0xeb, 0x43, 0xa6, 0x7a, 0x2e)]
99 interface IDXGIObject(IDXGIObjectVtbl): IUnknown(IUnknownVtbl) {
100 fn SetPrivateData(
101 Name: REFGUID,
102 DataSize: UINT,
103 pData: *const c_void,
104 ) -> HRESULT,
105 fn SetPrivateDataInterface(
106 Name: REFGUID,
107 pUnknown: *const IUnknown,
108 ) -> HRESULT,
109 fn GetPrivateData(
110 Name: REFGUID,
111 pDataSize: *mut UINT,
112 pData: *mut c_void,
113 ) -> HRESULT,
114 fn GetParent(
115 riid: REFIID,
116 ppParent: *mut *mut c_void,
117 ) -> HRESULT,
118 }}
119 RIDL!{#[uuid(0x3d3e0379, 0xf9de, 0x4d58, 0xbb, 0x6c, 0x18, 0xd6, 0x29, 0x92, 0xf1, 0xa6)]
120 interface IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl): IDXGIObject(IDXGIObjectVtbl) {
121 fn GetDevice(
122 riid: REFIID,
123 ppDevice: *mut *mut c_void,
124 ) -> HRESULT,
125 }}
126 RIDL!{#[uuid(0x035f3ab4, 0x482e, 0x4e50, 0xb4, 0x1f, 0x8a, 0x7f, 0x8b, 0xd8, 0x96, 0x0b)]
127 interface IDXGIResource(IDXGIResourceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) {
128 fn GetSharedHandle(
129 pSharedHandle: *mut HANDLE,
130 ) -> HRESULT,
131 fn GetUsage(
132 pUsage: *mut DXGI_USAGE,
133 ) -> HRESULT,
134 fn SetEvictionPriority(
135 EvictionPriority: UINT,
136 ) -> HRESULT,
137 fn GetEvictionPriority(
138 pEvictionPriority: *mut UINT,
139 ) -> HRESULT,
140 }}
141 RIDL!{#[uuid(0x9d8e1289, 0xd7b3, 0x465f, 0x81, 0x26, 0x25, 0x0e, 0x34, 0x9a, 0xf8, 0x5d)]
142 interface IDXGIKeyedMutex(IDXGIKeyedMutexVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) {
143 fn AcquireSync(
144 Key: UINT64,
145 dwMilliseconds: DWORD,
146 ) -> HRESULT,
147 fn ReleaseSync(
148 Key: UINT64,
149 ) -> HRESULT,
150 }}
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) {
156 fn GetDesc(
157 pDesc: *mut DXGI_SURFACE_DESC,
158 ) -> HRESULT,
159 fn Map(
160 pLockedRect: *mut DXGI_MAPPED_RECT,
161 MapFlags: UINT,
162 ) -> HRESULT,
163 fn Unmap() -> HRESULT,
164 }}
165 RIDL!{#[uuid(0x4ae63092, 0x6327, 0x4c1b, 0x80, 0xae, 0xbf, 0xe1, 0x2e, 0xa3, 0x2b, 0x86)]
166 interface IDXGISurface1(IDXGISurface1Vtbl): IDXGISurface(IDXGISurfaceVtbl) {
167 fn GetDC(
168 Discard: BOOL,
169 phdc: *mut HDC,
170 ) -> HRESULT,
171 fn ReleaseDC(
172 pDirtyRect: *mut RECT,
173 ) -> HRESULT,
174 }}
175 RIDL!{#[uuid(0x2411e7e1, 0x12ac, 0x4ccf, 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0)]
176 interface IDXGIAdapter(IDXGIAdapterVtbl): IDXGIObject(IDXGIObjectVtbl) {
177 fn EnumOutputs(
178 Output: UINT,
179 ppOutput: *mut *mut IDXGIOutput,
180 ) -> HRESULT,
181 fn GetDesc(
182 pDesc: *mut DXGI_ADAPTER_DESC,
183 ) -> HRESULT,
184 fn CheckInterfaceSupport(
185 InterfaceName: REFGUID,
186 pUMDVersion: *mut LARGE_INTEGER,
187 ) -> HRESULT,
188 }}
189 RIDL!{#[uuid(0xae02eedb, 0xc735, 0x4690, 0x8d, 0x52, 0x5a, 0x8d, 0xc2, 0x02, 0x13, 0xaa)]
190 interface IDXGIOutput(IDXGIOutputVtbl): IDXGIObject(IDXGIObjectVtbl) {
191 fn GetDesc(
192 pDesc: *mut DXGI_OUTPUT_DESC,
193 ) -> HRESULT,
194 fn GetDisplayModeList(
195 EnumFormat: DXGI_FORMAT,
196 Flags: UINT,
197 pNumModes: *mut UINT,
198 pDesc: *mut DXGI_MODE_DESC,
199 ) -> HRESULT,
200 fn FindClosestMatchingMode(
201 pModeToMatch: *const DXGI_MODE_DESC,
202 pClosestMatch: *mut DXGI_MODE_DESC,
203 pConcernedDevice: *mut IUnknown,
204 ) -> HRESULT,
205 fn WaitForVBlank() -> HRESULT,
206 fn TakeOwnership(
207 pDevice: *mut IUnknown,
208 Exclusive: BOOL,
209 ) -> HRESULT,
210 fn ReleaseOwnership() -> (),
211 fn GetGammaControlCapabilities(
212 pGammaCaps: *mut DXGI_GAMMA_CONTROL_CAPABILITIES,
213 ) -> HRESULT,
214 fn SetGammaControl(
215 pArray: *const DXGI_GAMMA_CONTROL,
216 ) -> HRESULT,
217 fn GetGammaControl(
218 pArray: *mut DXGI_GAMMA_CONTROL,
219 ) -> HRESULT,
220 fn SetDisplaySurface(
221 pScanoutSurface: *mut IDXGISurface,
222 ) -> HRESULT,
223 fn GetDisplaySurfaceData(
224 pDestination: *mut IDXGISurface,
225 ) -> HRESULT,
226 fn GetFrameStatistics(
227 pStats: *mut DXGI_FRAME_STATISTICS,
228 ) -> HRESULT,
229 }}
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) {
244 fn Present(
245 SyncInterval: UINT,
246 Flags: UINT,
247 ) -> HRESULT,
248 fn GetBuffer(
249 Buffer: UINT,
250 riid: REFIID,
251 ppSurface: *mut *mut c_void,
252 ) -> HRESULT,
253 fn SetFullscreenState(
254 Fullscreen: BOOL,
255 pTarget: *mut IDXGIOutput,
256 ) -> HRESULT,
257 fn GetFullscreenState(
258 pFullscreen: *mut BOOL,
259 ppTarget: *mut *mut IDXGIOutput,
260 ) -> HRESULT,
261 fn GetDesc(
262 pDesc: *mut DXGI_SWAP_CHAIN_DESC,
263 ) -> HRESULT,
264 fn ResizeBuffers(
265 BufferCount: UINT,
266 Width: UINT,
267 Height: UINT,
268 NewFormat: DXGI_FORMAT,
269 SwapChainFlags: UINT,
270 ) -> HRESULT,
271 fn ResizeTarget(
272 pNewTargetParameters: *const DXGI_MODE_DESC,
273 ) -> HRESULT,
274 fn GetContainingOutput(
275 ppOutput: *mut *mut IDXGIOutput,
276 ) -> HRESULT,
277 fn GetFrameStatistics(
278 pStats: *mut DXGI_FRAME_STATISTICS,
279 ) -> HRESULT,
280 fn GetLastPresentCount(
281 pLastPresentCount: *mut UINT,
282 ) -> HRESULT,
283 }}
284 RIDL!{#[uuid(0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69)]
285 interface IDXGIFactory(IDXGIFactoryVtbl): IDXGIObject(IDXGIObjectVtbl) {
286 fn EnumAdapters(
287 Adapter: UINT,
288 ppAdapter: *mut *mut IDXGIAdapter,
289 ) -> HRESULT,
290 fn MakeWindowAssociation(
291 WindowHandle: HWND,
292 Flags: UINT,
293 ) -> HRESULT,
294 fn GetWindowAssociation(
295 pWindowHandle: *mut HWND,
296 ) -> HRESULT,
297 fn CreateSwapChain(
298 pDevice: *mut IUnknown,
299 pDesc: *mut DXGI_SWAP_CHAIN_DESC,
300 ppSwapChain: *mut *mut IDXGISwapChain,
301 ) -> HRESULT,
302 fn CreateSoftwareAdapter(
303 Module: HMODULE,
304 ppAdapter: *mut *mut IDXGIAdapter,
305 ) -> HRESULT,
306 }}
307 extern "system" {
308 pub fn CreateDXGIFactory(
309 riid: REFIID,
310 ppFactory: *mut *mut c_void,
311 ) -> HRESULT;
312 pub fn CreateDXGIFactory1(
313 riid: REFIID,
314 ppFactory: *mut *mut c_void,
315 ) -> HRESULT;
316 }
317 RIDL!{#[uuid(0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c)]
318 interface IDXGIDevice(IDXGIDeviceVtbl): IDXGIObject(IDXGIObjectVtbl) {
319 fn GetAdapter(
320 pAdapter: *mut *mut IDXGIAdapter,
321 ) -> HRESULT,
322 fn CreateSurface(
323 pDesc: *const DXGI_SURFACE_DESC,
324 NumSurfaces: UINT,
325 Usage: DXGI_USAGE,
326 pSharedResource: *const DXGI_SHARED_RESOURCE,
327 ppSurface: *mut *mut IDXGISurface,
328 ) -> HRESULT,
329 fn QueryResourceResidency(
330 ppResources: *const *mut IUnknown,
331 pResidencyStatus: *mut DXGI_RESIDENCY,
332 NumResources: UINT,
333 ) -> HRESULT,
334 fn SetGPUThreadPriority(
335 Priority: INT,
336 ) -> HRESULT,
337 fn GetGPUThreadPriority(
338 pPriority: *mut INT,
339 ) -> HRESULT,
340 }}
341 ENUM!{enum DXGI_ADAPTER_FLAG {
342 DXGI_ADAPTER_FLAG_NONE,
343 DXGI_ADAPTER_FLAG_REMOTE,
344 DXGI_ADAPTER_FLAG_SOFTWARE,
345 }}
346 STRUCT!{struct DXGI_ADAPTER_DESC1 {
347 Description: [WCHAR; 128],
348 VendorId: UINT,
349 DeviceId: UINT,
350 SubSysId: UINT,
351 Revision: UINT,
352 DedicatedVideoMemory: SIZE_T,
353 DedicatedSystemMemory: SIZE_T,
354 SharedSystemMemory: SIZE_T,
355 AdapterLuid: LUID,
356 Flags: UINT,
357 }}
358 STRUCT!{struct DXGI_DISPLAY_COLOR_SPACE {
359 PrimaryCoordinates: [[FLOAT; 2]; 8],
360 WhitePoints: [[FLOAT; 2]; 16],
361 }}
362 RIDL!{#[uuid(0x770aae78, 0xf26f, 0x4dba, 0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87)]
363 interface IDXGIFactory1(IDXGIFactory1Vtbl): IDXGIFactory(IDXGIFactoryVtbl) {
364 fn EnumAdapters1(
365 Adapter: UINT,
366 ppAdapter: *mut *mut IDXGIAdapter1,
367 ) -> HRESULT,
368 fn IsCurrent() -> BOOL,
369 }}
370 RIDL!{#[uuid(0x29038f61, 0x3839, 0x4626, 0x91, 0xfd, 0x08, 0x68, 0x79, 0x01, 0x1a, 0x05)]
371 interface IDXGIAdapter1(IDXGIAdapter1Vtbl): IDXGIAdapter(IDXGIAdapterVtbl) {
372 fn GetDesc1(
373 pDesc: *mut DXGI_ADAPTER_DESC1,
374 ) -> HRESULT,
375 }}
376 RIDL!{#[uuid(0x77db970f, 0x6276, 0x48ba, 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c)]
377 interface IDXGIDevice1(IDXGIDevice1Vtbl): IDXGIDevice(IDXGIDeviceVtbl) {
378 fn SetMaximumFrameLatency(
379 MaxLatency: UINT,
380 ) -> HRESULT,
381 fn GetMaximumFrameLatency(
382 pMaxLatency: *mut UINT,
383 ) -> HRESULT,
384 }}
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}