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 MAKE_DXGI_HRESULT(x) MAKE_HRESULT(1, _FACDXGI, x)")
29 typedef HANDLE HMONITOR
;
30 typedef struct _LUID
{
36 typedef UINT DXGI_USAGE
;
37 const DXGI_USAGE DXGI_USAGE_SHADER_INPUT
= 0x10L
;
38 const DXGI_USAGE DXGI_USAGE_RENDER_TARGET_OUTPUT
= 0x20L
;
39 const DXGI_USAGE DXGI_USAGE_BACK_BUFFER
= 0x40L
;
40 const DXGI_USAGE DXGI_USAGE_SHARED
= 0x80L
;
41 const DXGI_USAGE DXGI_USAGE_READ_ONLY
= 0x100L
;
42 const DXGI_USAGE DXGI_USAGE_DISCARD_ON_PRESENT
= 0x200L
;
43 const DXGI_USAGE DXGI_USAGE_UNORDERED_ACCESS
= 0x400L
;
45 const UINT DXGI_ENUM_MODES_INTERLACED
= 1;
46 const UINT DXGI_ENUM_MODES_SCALING
= 2;
48 typedef enum DXGI_SWAP_EFFECT
{
49 DXGI_SWAP_EFFECT_DISCARD
= 0,
50 DXGI_SWAP_EFFECT_SEQUENTIAL
= 1,
51 DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
= 3,
52 DXGI_SWAP_EFFECT_FLIP_DISCARD
= 4
55 typedef enum DXGI_RESIDENCY
{
56 DXGI_RESIDENCY_FULLY_RESIDENT
= 1,
57 DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY
= 2,
58 DXGI_RESIDENCY_EVICTED_TO_DISK
= 3,
61 typedef struct DXGI_SURFACE_DESC
{
65 DXGI_SAMPLE_DESC SampleDesc
;
68 typedef struct DXGI_MAPPED_RECT
{
73 typedef struct DXGI_OUTPUT_DESC
{
75 RECT DesktopCoordinates
;
76 BOOL AttachedToDesktop
;
77 DXGI_MODE_ROTATION Rotation
;
81 typedef struct DXGI_FRAME_STATISTICS
{
83 UINT PresentRefreshCount
;
84 UINT SyncRefreshCount
;
85 LARGE_INTEGER SyncQPCTime
;
86 LARGE_INTEGER SyncGPUTime
;
87 } DXGI_FRAME_STATISTICS
;
89 typedef struct DXGI_ADAPTER_DESC
{
90 WCHAR Description
[128];
95 SIZE_T DedicatedVideoMemory
;
96 SIZE_T DedicatedSystemMemory
;
97 SIZE_T SharedSystemMemory
;
101 typedef enum DXGI_SWAP_CHAIN_FLAG
{
102 DXGI_SWAP_CHAIN_FLAG_NONPREROTATED
= 1,
103 DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
= 2,
104 DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
= 4
105 } DXGI_SWAP_CHAIN_FLAG
;
107 typedef struct DXGI_SWAP_CHAIN_DESC
{
108 DXGI_MODE_DESC BufferDesc
;
109 DXGI_SAMPLE_DESC SampleDesc
;
110 DXGI_USAGE BufferUsage
;
114 DXGI_SWAP_EFFECT SwapEffect
;
116 } DXGI_SWAP_CHAIN_DESC
;
118 typedef struct DXGI_SHARED_RESOURCE
{
120 } DXGI_SHARED_RESOURCE
;
125 uuid(aec22fb8
-76f3
-4639-9be0
-28eb43a67a2e
)
127 interface IDXGIObject
: IUnknown
129 HRESULT SetPrivateData
(
132 [in] const void *data
134 HRESULT SetPrivateDataInterface
(
136 [in] const IUnknown
*object
138 HRESULT GetPrivateData
(
140 [in, out] UINT
*data_size
,
152 uuid(3d3e0379
-f9de
-4d58
-bb6c
-18d62992f1a6
)
154 interface IDXGIDeviceSubObject
: IDXGIObject
164 uuid(035f3ab4
-482e-4e50
-b41f
-8a7f8bd8960b
),
166 pointer_default(unique)
168 interface IDXGIResource
: IDXGIDeviceSubObject
170 HRESULT GetSharedHandle
([out] HANDLE *pSharedHandle
);
171 HRESULT GetUsage
([out] DXGI_USAGE
*pUsage
);
172 HRESULT SetEvictionPriority
([in] UINT EvictionPriority
);
173 HRESULT GetEvictionPriority
([out, retval] UINT
*pEvictionPriority
);
178 uuid(9d8e1289
-d7b3
-465f
-8126-250e349af85d
),
180 pointer_default(unique)
182 interface IDXGIKeyedMutex
: IDXGIDeviceSubObject
184 HRESULT AcquireSync
([in] UINT64 Key
, [in] DWORD dwMilliseconds
);
185 HRESULT ReleaseSync
([in] UINT64 Key
);
191 uuid(cafcb56c
-6ac3
-4889-bf47
-9e23bbd260ec
)
193 interface IDXGISurface
: IDXGIDeviceSubObject
196 [out] DXGI_SURFACE_DESC
*desc
199 [out] DXGI_MAPPED_RECT
*mapped_rect
,
209 uuid(4ae63092
-6327-4c1b
-80ae
-bfe12ea32b86
)
211 interface IDXGISurface1
: IDXGISurface
218 [in] RECT
*dirty_rect
225 uuid(ae02eedb
-c735
-4690-8d52
-5a8dc20213aa
)
227 interface IDXGIOutput
: IDXGIObject
230 [out] DXGI_OUTPUT_DESC
*desc
232 HRESULT GetDisplayModeList
(
233 [in] DXGI_FORMAT format
,
235 [in, out] UINT
*mode_count
,
236 [out] DXGI_MODE_DESC
*desc
238 HRESULT FindClosestMatchingMode
(
239 [in] const DXGI_MODE_DESC
*mode
,
240 [out] DXGI_MODE_DESC
*closest_match
,
241 [in] IUnknown
*device
243 HRESULT WaitForVBlank
(
245 HRESULT TakeOwnership
(
246 [in] IUnknown
*device
,
249 void ReleaseOwnership
(
251 HRESULT GetGammaControlCapabilities
(
252 [out] DXGI_GAMMA_CONTROL_CAPABILITIES
*gamma_caps
254 HRESULT SetGammaControl
(
255 [in] const DXGI_GAMMA_CONTROL
*gamma_control
257 HRESULT GetGammaControl
(
258 [out] DXGI_GAMMA_CONTROL
*gamma_control
260 HRESULT SetDisplaySurface
(
261 [in] IDXGISurface
*surface
263 HRESULT GetDisplaySurfaceData
(
264 [in] IDXGISurface
*surface
266 HRESULT GetFrameStatistics
(
267 [out] DXGI_FRAME_STATISTICS
*stats
274 uuid(2411e7e1
-12ac
-4ccf
-bd14
-9798e8534dc0
)
276 interface IDXGIAdapter
: IDXGIObject
279 [in] UINT output_idx
,
280 [in, out] IDXGIOutput
**output
283 [out] DXGI_ADAPTER_DESC
*desc
285 HRESULT CheckInterfaceSupport
(
287 [out] LARGE_INTEGER
*umd_version
291 cpp_quote
("#define DXGI_MAX_SWAP_CHAIN_BUFFERS (16)")
293 cpp_quote
("#define DXGI_PRESENT_TEST __MSABI_LONG(0x00000001U)")
294 cpp_quote
("#define DXGI_PRESENT_DO_NOT_SEQUENCE __MSABI_LONG(0x00000002U)")
295 cpp_quote
("#define DXGI_PRESENT_RESTART __MSABI_LONG(0x00000004U)")
296 cpp_quote
("#define DXGI_PRESENT_DO_NOT_WAIT __MSABI_LONG(0x00000008U)")
297 cpp_quote
("#define DXGI_PRESENT_STEREO_PREFER_RIGHT __MSABI_LONG(0x00000010U)")
298 cpp_quote
("#define DXGI_PRESENT_STEREO_TEMPORARY_MONO __MSABI_LONG(0x00000020U)")
299 cpp_quote
("#define DXGI_PRESENT_RESTRICT_TO_OUTPUT __MSABI_LONG(0x00000040U)")
304 uuid(310d36a0
-d2e7
-4c0a
-aa04
-6a9d23b8886a
)
306 interface IDXGISwapChain
: IDXGIDeviceSubObject
309 [in] UINT sync_interval
,
313 [in] UINT buffer_idx
,
315 [in, out] void **surface
317 HRESULT SetFullscreenState
(
318 [in] BOOL fullscreen
,
319 [in] IDXGIOutput
*target
321 HRESULT GetFullscreenState
(
322 [out] BOOL
*fullscreen
,
323 [out] IDXGIOutput
**target
326 [out] DXGI_SWAP_CHAIN_DESC
*desc
328 HRESULT ResizeBuffers
(
329 [in] UINT buffer_count
,
332 [in] DXGI_FORMAT format
,
335 HRESULT ResizeTarget
(
336 [in] const DXGI_MODE_DESC
*target_mode_desc
338 HRESULT GetContainingOutput
(
339 [out] IDXGIOutput
**output
341 HRESULT GetFrameStatistics
(
342 [out] DXGI_FRAME_STATISTICS
*stats
344 HRESULT GetLastPresentCount
(
345 [out] UINT
*last_present_count
349 cpp_quote
("#define DXGI_MWA_NO_WINDOW_CHANGES 0x1")
350 cpp_quote
("#define DXGI_MWA_NO_ALT_ENTER 0x2")
351 cpp_quote
("#define DXGI_MWA_NO_PRINT_SCREEN 0x4")
352 cpp_quote
("#define DXGI_MWA_VALID 0x7")
357 uuid(7b7166ec
-21c7
-44ae
-b21a
-c9ae321ae369
)
359 interface IDXGIFactory
: IDXGIObject
361 HRESULT EnumAdapters
(
362 [in] UINT adapter_idx
,
363 [out] IDXGIAdapter
**adapter
365 HRESULT MakeWindowAssociation
(
369 HRESULT GetWindowAssociation
(
372 HRESULT CreateSwapChain
(
373 [in] IUnknown
*device
,
374 [in] DXGI_SWAP_CHAIN_DESC
*desc
,
375 [out] IDXGISwapChain
**swapchain
377 HRESULT CreateSoftwareAdapter
(
379 [out] IDXGIAdapter
**adapter
383 [local] HRESULT __stdcall CreateDXGIFactory
(REFIID riid
, void **factory
);
384 [local] HRESULT __stdcall CreateDXGIFactory1
(REFIID riid
, void **factory
);
389 uuid(54ec77fa
-1377-44e6
-8c32
-88fd5f44c84c
)
391 interface IDXGIDevice
: IDXGIObject
394 [out] IDXGIAdapter
**adapter
396 HRESULT CreateSurface
(
397 [in] const DXGI_SURFACE_DESC
*desc
,
398 [in] UINT surface_count
,
399 [in] DXGI_USAGE usage
,
400 [in] const DXGI_SHARED_RESOURCE
*shared_resource
,
401 [out] IDXGISurface
**surface
403 HRESULT QueryResourceResidency
(
404 [in] IUnknown
*const *resources
,
405 [out] DXGI_RESIDENCY
*residency
,
406 [in] UINT resource_count
408 HRESULT SetGPUThreadPriority
(
411 HRESULT GetGPUThreadPriority
(
416 typedef enum DXGI_ADAPTER_FLAG
{
417 DXGI_ADAPTER_FLAG_NONE
= 0,
418 DXGI_ADAPTER_FLAG_REMOTE
= 1,
419 DXGI_ADAPTER_FLAG_FORCE_DWORD
= 0xFFFFFFFF
422 typedef struct DXGI_ADAPTER_DESC1
{
423 WCHAR Description
[128];
428 SIZE_T DedicatedVideoMemory
;
429 SIZE_T DedicatedSystemMemory
;
430 SIZE_T SharedSystemMemory
;
433 } DXGI_ADAPTER_DESC1
;
437 uuid(29038f61
-3839-4626-91fd
-086879011a05
),
439 pointer_default(unique)
441 interface IDXGIAdapter1
: IDXGIAdapter
443 HRESULT GetDesc1
([out] DXGI_ADAPTER_DESC1
*pDesc
);
448 uuid(77db970f
-6276-48ba
-ba28
-070143b4392c
),
450 pointer_default(unique)
452 interface IDXGIDevice1
: IDXGIDevice
454 HRESULT SetMaximumFrameLatency
([in] UINT MaxLatency
);
455 HRESULT GetMaximumFrameLatency
([out] UINT
*pMaxLatency
);
460 uuid(770aae78
-f26f
-4dba
-a829
-253c83d1b387
),
462 pointer_default(unique)
464 interface IDXGIFactory1
: IDXGIFactory
466 HRESULT EnumAdapters1
([in] UINT Adapter
, [out] IDXGIAdapter1
**ppAdapter
);