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,
72 typedef enum DXGI_RESIDENCY {
73 DXGI_RESIDENCY_FULLY_RESIDENT = 1,
74 DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2,
75 DXGI_RESIDENCY_EVICTED_TO_DISK = 3,
78 typedef struct DXGI_SURFACE_DESC {
82 DXGI_SAMPLE_DESC SampleDesc;
85 typedef struct DXGI_MAPPED_RECT {
90 typedef struct DXGI_OUTPUT_DESC {
92 RECT DesktopCoordinates;
93 BOOL AttachedToDesktop;
94 DXGI_MODE_ROTATION Rotation;
98 typedef struct DXGI_FRAME_STATISTICS {
100 UINT PresentRefreshCount;
101 UINT SyncRefreshCount;
102 LARGE_INTEGER SyncQPCTime;
103 LARGE_INTEGER SyncGPUTime;
104 } DXGI_FRAME_STATISTICS;
106 typedef struct DXGI_ADAPTER_DESC {
107 WCHAR Description[128];
112 SIZE_T DedicatedVideoMemory;
113 SIZE_T DedicatedSystemMemory;
114 SIZE_T SharedSystemMemory;
118 typedef enum DXGI_SWAP_CHAIN_FLAG {
119 DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1,
120 DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2,
121 DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4
122 } DXGI_SWAP_CHAIN_FLAG;
124 typedef struct DXGI_SWAP_CHAIN_DESC {
125 DXGI_MODE_DESC BufferDesc;
126 DXGI_SAMPLE_DESC SampleDesc;
127 DXGI_USAGE BufferUsage;
131 DXGI_SWAP_EFFECT SwapEffect;
133 } DXGI_SWAP_CHAIN_DESC;
135 typedef struct DXGI_SHARED_RESOURCE {
137 } DXGI_SHARED_RESOURCE;
142 uuid(aec22fb8-76f3-4639-9be0-28eb43a67a2e)
144 interface IDXGIObject : IUnknown
146 HRESULT SetPrivateData(
149 [in] const void *data
151 HRESULT SetPrivateDataInterface(
153 [in] const IUnknown *object
155 HRESULT GetPrivateData(
157 [in, out] UINT *data_size,
169 uuid(3d3e0379-f9de-4d58-bb6c-18d62992f1a6)
171 interface IDXGIDeviceSubObject : IDXGIObject
182 uuid(cafcb56c-6ac3-4889-bf47-9e23bbd260ec)
184 interface IDXGISurface : IDXGIDeviceSubObject
187 [out] DXGI_SURFACE_DESC *desc
190 [out] DXGI_MAPPED_RECT *mapped_rect,
200 uuid(ae02eedb-c735-4690-8d52-5a8dc20213aa)
202 interface IDXGIOutput : IDXGIObject
205 [out] DXGI_OUTPUT_DESC *desc
207 HRESULT GetDisplayModeList(
208 [in] DXGI_FORMAT format,
210 [in, out] UINT *mode_count,
211 [out] DXGI_MODE_DESC *desc
213 HRESULT FindClosestMatchingMode(
214 [in] const DXGI_MODE_DESC *mode,
215 [out] DXGI_MODE_DESC *closest_match,
216 [in] IUnknown *device
218 HRESULT WaitForVBlank(
220 HRESULT TakeOwnership(
221 [in] IUnknown *device,
224 void ReleaseOwnership(
226 HRESULT GetGammaControlCapabilities(
227 [out] DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps
229 HRESULT SetGammaControl(
230 [in] const DXGI_GAMMA_CONTROL *gamma_control
232 HRESULT GetGammaControl(
233 [out] DXGI_GAMMA_CONTROL *gamma_control
235 HRESULT SetDisplaySurface(
236 [in] IDXGISurface *surface
238 HRESULT GetDisplaySurfaceData(
239 [in] IDXGISurface *surface
241 HRESULT GetFrameStatistics(
242 [out] DXGI_FRAME_STATISTICS *stats
249 uuid(2411e7e1-12ac-4ccf-bd14-9798e8534dc0)
251 interface IDXGIAdapter : IDXGIObject
254 [in] UINT output_idx,
255 [in, out] IDXGIOutput **output
258 [out] DXGI_ADAPTER_DESC *desc
260 HRESULT CheckInterfaceSupport(
262 [out] LARGE_INTEGER *umd_version
269 uuid(310d36a0-d2e7-4c0a-aa04-6a9d23b8886a)
271 interface IDXGISwapChain : IDXGIDeviceSubObject
274 [in] UINT sync_interval,
278 [in] UINT buffer_idx,
280 [in, out] void **surface
282 HRESULT SetFullscreenState(
283 [in] BOOL fullscreen,
284 [in] IDXGIOutput *target
286 HRESULT GetFullscreenState(
287 [out] BOOL *fullscreen,
288 [out] IDXGIOutput **target
291 [out] DXGI_SWAP_CHAIN_DESC *desc
293 HRESULT ResizeBuffers(
294 [in] UINT buffer_count,
297 [in] DXGI_FORMAT format,
300 HRESULT ResizeTarget(
301 [in] const DXGI_MODE_DESC *target_mode_desc
303 HRESULT GetContainingOutput(
304 [out] IDXGIOutput **output
306 HRESULT GetFrameStatistics(
307 [out] DXGI_FRAME_STATISTICS *stats
309 HRESULT GetLastPresentCount(
310 [out] UINT *last_present_count
314 cpp_quote("#define DXGI_MWA_NO_WINDOW_CHANGES 0x1")
315 cpp_quote("#define DXGI_MWA_NO_ALT_ENTER 0x2")
316 cpp_quote("#define DXGI_MWA_NO_PRINT_SCREEN 0x4")
317 cpp_quote("#define DXGI_MWA_VALID 0x7")
322 uuid(7b7166ec-21c7-44ae-b21a-c9ae321ae369)
324 interface IDXGIFactory : IDXGIObject
326 HRESULT EnumAdapters(
327 [in] UINT adapter_idx,
328 [out] IDXGIAdapter **adapter
330 HRESULT MakeWindowAssociation(
334 HRESULT GetWindowAssociation(
337 HRESULT CreateSwapChain(
338 [in] IUnknown *device,
339 [in] DXGI_SWAP_CHAIN_DESC *desc,
340 [out] IDXGISwapChain **swapchain
342 HRESULT CreateSoftwareAdapter(
344 [out] IDXGIAdapter **adapter
348 [local] HRESULT __stdcall CreateDXGIFactory(REFIID riid, void **factory);
353 uuid(54ec77fa-1377-44e6-8c32-88fd5f44c84c)
355 interface IDXGIDevice : IDXGIObject
358 [out] IDXGIAdapter **adapter
360 HRESULT CreateSurface(
361 [in] const DXGI_SURFACE_DESC *desc,
362 [in] UINT surface_count,
363 [in] DXGI_USAGE usage,
364 [in] const DXGI_SHARED_RESOURCE *shared_resource,
365 [out] IDXGISurface **surface
367 HRESULT QueryResourceResidency(
368 [in] IUnknown *const *resources,
369 [out] DXGI_RESIDENCY *residency,
370 [in] UINT resource_count
372 HRESULT SetGPUThreadPriority(
375 HRESULT GetGPUThreadPriority(