2 * Copyright 2007 Andras Kovacs
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 const UINT _FACDXGI
= 0x87a;
25 cpp_quote
("#define MAKE_DXGI_STATUS(x) MAKE_HRESULT(0, _FACDXGI, x)")
26 cpp_quote
("#define DXGI_STATUS_OCCLUDED MAKE_DXGI_STATUS(1)")
27 cpp_quote
("#define DXGI_STATUS_CLIPPED MAKE_DXGI_STATUS(2)")
28 cpp_quote
("#define DXGI_STATUS_NO_REDIRECTION MAKE_DXGI_STATUS(4)")
29 cpp_quote
("#define DXGI_STATUS_NO_DESKTOP_ACCESS MAKE_DXGI_STATUS(5)")
30 cpp_quote
("#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_STATUS(6)")
31 cpp_quote
("#define DXGI_STATUS_MODE_CHANGED MAKE_DXGI_STATUS(7)")
32 cpp_quote
("#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS MAKE_DXGI_STATUS(8)")
34 cpp_quote
("#define MAKE_DXGI_HRESULT(x) MAKE_HRESULT(1, _FACDXGI, x)")
35 cpp_quote
("#define DXGI_ERROR_INVALID_CALL MAKE_DXGI_HRESULT(1)")
36 cpp_quote
("#define DXGI_ERROR_NOT_FOUND MAKE_DXGI_HRESULT(2)")
37 cpp_quote
("#define DXGI_ERROR_MORE_DATA MAKE_DXGI_HRESULT(3)")
38 cpp_quote
("#define DXGI_ERROR_UNSUPPORTED MAKE_DXGI_HRESULT(4)")
39 cpp_quote
("#define DXGI_ERROR_DEVICE_REMOVED MAKE_DXGI_HRESULT(5)")
40 cpp_quote
("#define DXGI_ERROR_DEVICE_HUNG MAKE_DXGI_HRESULT(6)")
41 cpp_quote
("#define DXGI_ERROR_DEVICE_RESET MAKE_DXGI_HRESULT(7)")
42 cpp_quote
("#define DXGI_ERROR_WAS_STILL_DRAWING MAKE_DXGI_HRESULT(10)")
43 cpp_quote
("#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT MAKE_DXGI_HRESULT(11)")
44 cpp_quote
("#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_HRESULT(12)")
45 cpp_quote
("#define DXGI_ERROR_DRIVER_INTERNAL_ERROR MAKE_DXGI_HRESULT(32)")
46 cpp_quote
("#define DXGI_ERROR_NONEXCLUSIVE MAKE_DXGI_HRESULT(33)")
47 cpp_quote
("#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE MAKE_DXGI_HRESULT(34)")
50 typedef HANDLE HMONITOR
;
51 typedef struct _LUID
{
57 typedef UINT DXGI_USAGE
;
58 const DXGI_USAGE DXGI_USAGE_SHADER_INPUT
= 0x10L
;
59 const DXGI_USAGE DXGI_USAGE_RENDER_TARGET_OUTPUT
= 0x20L
;
60 const DXGI_USAGE DXGI_USAGE_BACK_BUFFER
= 0x40L
;
61 const DXGI_USAGE DXGI_USAGE_SHARED
= 0x80L
;
62 const DXGI_USAGE DXGI_USAGE_READ_ONLY
= 0x100L
;
64 const UINT DXGI_ENUM_MODES_INTERLACED
= 1;
65 const UINT DXGI_ENUM_MODES_SCALING
= 2;
67 typedef enum DXGI_SWAP_EFFECT
{
68 DXGI_SWAP_EFFECT_DISCARD
= 0,
69 DXGI_SWAP_EFFECT_SEQUENTIAL
= 1,
70 DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
= 3
73 typedef enum DXGI_RESIDENCY
{
74 DXGI_RESIDENCY_FULLY_RESIDENT
= 1,
75 DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY
= 2,
76 DXGI_RESIDENCY_EVICTED_TO_DISK
= 3,
79 typedef struct DXGI_SURFACE_DESC
{
83 DXGI_SAMPLE_DESC SampleDesc
;
86 typedef struct DXGI_MAPPED_RECT
{
91 typedef struct DXGI_OUTPUT_DESC
{
93 RECT DesktopCoordinates
;
94 BOOL AttachedToDesktop
;
95 DXGI_MODE_ROTATION Rotation
;
99 typedef struct DXGI_FRAME_STATISTICS
{
101 UINT PresentRefreshCount
;
102 UINT SyncRefreshCount
;
103 LARGE_INTEGER SyncQPCTime
;
104 LARGE_INTEGER SyncGPUTime
;
105 } DXGI_FRAME_STATISTICS
;
107 typedef struct DXGI_ADAPTER_DESC
{
108 WCHAR Description
[128];
113 SIZE_T DedicatedVideoMemory
;
114 SIZE_T DedicatedSystemMemory
;
115 SIZE_T SharedSystemMemory
;
119 typedef enum DXGI_SWAP_CHAIN_FLAG
{
120 DXGI_SWAP_CHAIN_FLAG_NONPREROTATED
= 1,
121 DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
= 2,
122 DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
= 4
123 } DXGI_SWAP_CHAIN_FLAG
;
125 typedef struct DXGI_SWAP_CHAIN_DESC
{
126 DXGI_MODE_DESC BufferDesc
;
127 DXGI_SAMPLE_DESC SampleDesc
;
128 DXGI_USAGE BufferUsage
;
132 DXGI_SWAP_EFFECT SwapEffect
;
134 } DXGI_SWAP_CHAIN_DESC
;
136 typedef struct DXGI_SHARED_RESOURCE
{
138 } DXGI_SHARED_RESOURCE
;
143 uuid(aec22fb8
-76f3
-4639-9be0
-28eb43a67a2e
)
145 interface IDXGIObject
: IUnknown
147 HRESULT SetPrivateData
(
150 [in] const void *data
152 HRESULT SetPrivateDataInterface
(
154 [in] const IUnknown
*object
156 HRESULT GetPrivateData
(
158 [in, out] UINT
*data_size
,
170 uuid(3d3e0379
-f9de
-4d58
-bb6c
-18d62992f1a6
)
172 interface IDXGIDeviceSubObject
: IDXGIObject
182 uuid(035f3ab4
-482e-4e50
-b41f
-8a7f8bd8960b
),
184 pointer_default(unique)
186 interface IDXGIResource
: IDXGIDeviceSubObject
188 HRESULT GetSharedHandle
([out] HANDLE *pSharedHandle
);
189 HRESULT GetUsage
([out] DXGI_USAGE
*pUsage
);
190 HRESULT SetEvictionPriority
([in] UINT EvictionPriority
);
191 HRESULT GetEvictionPriority
([out, retval] UINT
*pEvictionPriority
);
196 uuid(9d8e1289
-d7b3
-465f
-8126-250e349af85d
),
198 pointer_default(unique)
200 interface IDXGIKeyedMutex
: IDXGIDeviceSubObject
202 HRESULT AcquireSync
([in] UINT64 Key
, [in] DWORD dwMilliseconds
);
203 HRESULT ReleaseSync
([in] UINT64 Key
);
209 uuid(cafcb56c
-6ac3
-4889-bf47
-9e23bbd260ec
)
211 interface IDXGISurface
: IDXGIDeviceSubObject
214 [out] DXGI_SURFACE_DESC
*desc
217 [out] DXGI_MAPPED_RECT
*mapped_rect
,
227 uuid(ae02eedb
-c735
-4690-8d52
-5a8dc20213aa
)
229 interface IDXGIOutput
: IDXGIObject
232 [out] DXGI_OUTPUT_DESC
*desc
234 HRESULT GetDisplayModeList
(
235 [in] DXGI_FORMAT format
,
237 [in, out] UINT
*mode_count
,
238 [out] DXGI_MODE_DESC
*desc
240 HRESULT FindClosestMatchingMode
(
241 [in] const DXGI_MODE_DESC
*mode
,
242 [out] DXGI_MODE_DESC
*closest_match
,
243 [in] IUnknown
*device
245 HRESULT WaitForVBlank
(
247 HRESULT TakeOwnership
(
248 [in] IUnknown
*device
,
251 void ReleaseOwnership
(
253 HRESULT GetGammaControlCapabilities
(
254 [out] DXGI_GAMMA_CONTROL_CAPABILITIES
*gamma_caps
256 HRESULT SetGammaControl
(
257 [in] const DXGI_GAMMA_CONTROL
*gamma_control
259 HRESULT GetGammaControl
(
260 [out] DXGI_GAMMA_CONTROL
*gamma_control
262 HRESULT SetDisplaySurface
(
263 [in] IDXGISurface
*surface
265 HRESULT GetDisplaySurfaceData
(
266 [in] IDXGISurface
*surface
268 HRESULT GetFrameStatistics
(
269 [out] DXGI_FRAME_STATISTICS
*stats
276 uuid(2411e7e1
-12ac
-4ccf
-bd14
-9798e8534dc0
)
278 interface IDXGIAdapter
: IDXGIObject
281 [in] UINT output_idx
,
282 [in, out] IDXGIOutput
**output
285 [out] DXGI_ADAPTER_DESC
*desc
287 HRESULT CheckInterfaceSupport
(
289 [out] LARGE_INTEGER
*umd_version
293 cpp_quote
("#define DXGI_MAX_SWAP_CHAIN_BUFFERS (16)")
295 cpp_quote
("#define DXGI_PRESENT_TEST __MSABI_LONG(0x00000001U)")
296 cpp_quote
("#define DXGI_PRESENT_DO_NOT_SEQUENCE __MSABI_LONG(0x00000002U)")
297 cpp_quote
("#define DXGI_PRESENT_RESTART __MSABI_LONG(0x00000004U)")
298 cpp_quote
("#define DXGI_PRESENT_DO_NOT_WAIT __MSABI_LONG(0x00000008U)")
299 cpp_quote
("#define DXGI_PRESENT_STEREO_PREFER_RIGHT __MSABI_LONG(0x00000010U)")
300 cpp_quote
("#define DXGI_PRESENT_STEREO_TEMPORARY_MONO __MSABI_LONG(0x00000020U)")
301 cpp_quote
("#define DXGI_PRESENT_RESTRICT_TO_OUTPUT __MSABI_LONG(0x00000040U)")
306 uuid(310d36a0
-d2e7
-4c0a
-aa04
-6a9d23b8886a
)
308 interface IDXGISwapChain
: IDXGIDeviceSubObject
311 [in] UINT sync_interval
,
315 [in] UINT buffer_idx
,
317 [in, out] void **surface
319 HRESULT SetFullscreenState
(
320 [in] BOOL fullscreen
,
321 [in] IDXGIOutput
*target
323 HRESULT GetFullscreenState
(
324 [out] BOOL
*fullscreen
,
325 [out] IDXGIOutput
**target
328 [out] DXGI_SWAP_CHAIN_DESC
*desc
330 HRESULT ResizeBuffers
(
331 [in] UINT buffer_count
,
334 [in] DXGI_FORMAT format
,
337 HRESULT ResizeTarget
(
338 [in] const DXGI_MODE_DESC
*target_mode_desc
340 HRESULT GetContainingOutput
(
341 [out] IDXGIOutput
**output
343 HRESULT GetFrameStatistics
(
344 [out] DXGI_FRAME_STATISTICS
*stats
346 HRESULT GetLastPresentCount
(
347 [out] UINT
*last_present_count
351 cpp_quote
("#define DXGI_MWA_NO_WINDOW_CHANGES 0x1")
352 cpp_quote
("#define DXGI_MWA_NO_ALT_ENTER 0x2")
353 cpp_quote
("#define DXGI_MWA_NO_PRINT_SCREEN 0x4")
354 cpp_quote
("#define DXGI_MWA_VALID 0x7")
359 uuid(7b7166ec
-21c7
-44ae
-b21a
-c9ae321ae369
)
361 interface IDXGIFactory
: IDXGIObject
363 HRESULT EnumAdapters
(
364 [in] UINT adapter_idx
,
365 [out] IDXGIAdapter
**adapter
367 HRESULT MakeWindowAssociation
(
371 HRESULT GetWindowAssociation
(
374 HRESULT CreateSwapChain
(
375 [in] IUnknown
*device
,
376 [in] DXGI_SWAP_CHAIN_DESC
*desc
,
377 [out] IDXGISwapChain
**swapchain
379 HRESULT CreateSoftwareAdapter
(
381 [out] IDXGIAdapter
**adapter
385 [local] HRESULT __stdcall CreateDXGIFactory
(REFIID riid
, void **factory
);
386 [local] HRESULT __stdcall CreateDXGIFactory1
(REFIID riid
, void **factory
);
391 uuid(54ec77fa
-1377-44e6
-8c32
-88fd5f44c84c
)
393 interface IDXGIDevice
: IDXGIObject
396 [out] IDXGIAdapter
**adapter
398 HRESULT CreateSurface
(
399 [in] const DXGI_SURFACE_DESC
*desc
,
400 [in] UINT surface_count
,
401 [in] DXGI_USAGE usage
,
402 [in] const DXGI_SHARED_RESOURCE
*shared_resource
,
403 [out] IDXGISurface
**surface
405 HRESULT QueryResourceResidency
(
406 [in] IUnknown
*const *resources
,
407 [out] DXGI_RESIDENCY
*residency
,
408 [in] UINT resource_count
410 HRESULT SetGPUThreadPriority
(
413 HRESULT GetGPUThreadPriority
(
418 typedef enum DXGI_ADAPTER_FLAG
{
419 DXGI_ADAPTER_FLAG_NONE
= 0,
420 DXGI_ADAPTER_FLAG_REMOTE
= 1,
421 DXGI_ADAPTER_FLAG_FORCE_DWORD
= 0xFFFFFFFF
424 typedef struct DXGI_ADAPTER_DESC1
{
425 WCHAR Description
[128];
430 SIZE_T DedicatedVideoMemory
;
431 SIZE_T DedicatedSystemMemory
;
432 SIZE_T SharedSystemMemory
;
435 } DXGI_ADAPTER_DESC1
;
439 uuid(29038f61
-3839-4626-91fd
-086879011a05
),
441 pointer_default(unique)
443 interface IDXGIAdapter1
: IDXGIAdapter
445 HRESULT GetDesc1
([out] DXGI_ADAPTER_DESC1
*pDesc
);
450 uuid(77db970f
-6276-48ba
-ba28
-070143b4392c
),
452 pointer_default(unique)
454 interface IDXGIDevice1
: IDXGIDevice
456 HRESULT SetMaximumFrameLatency
([in] UINT MaxLatency
);
457 HRESULT GetMaximumFrameLatency
([out] UINT
*pMaxLatency
);
462 uuid(770aae78
-f26f
-4dba
-a829
-253c83d1b387
),
464 pointer_default(unique)
466 interface IDXGIFactory1
: IDXGIFactory
468 HRESULT EnumAdapters1
([in] UINT Adapter
, [out] IDXGIAdapter1
**ppAdapter
);