1/*
2 * Copyright 2007 Andras Kovacs
3 *
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.
8 *
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.
13 *
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
17 */
18
19/*DXGI 1.1 IDL, and missing DXGI 1.0 parts added by Luca Barbieri on Sep 2010 */
20
21import "dxgitype.idl";
22
23const UINT _FACDXGI = 0x87a;
24
25cpp_quote("#define MAKE_DXGI_STATUS(x)			 MAKE_HRESULT(0, _FACDXGI, x)")
26cpp_quote("#define DXGI_STATUS_OCCLUDED			MAKE_DXGI_STATUS(1)")
27cpp_quote("#define DXGI_STATUS_CLIPPED			 MAKE_DXGI_STATUS(2)")
28cpp_quote("#define DXGI_STATUS_NO_REDIRECTION		 MAKE_DXGI_STATUS(4)")
29cpp_quote("#define DXGI_STATUS_NO_DESKTOP_ACCESS		 MAKE_DXGI_STATUS(5)")
30cpp_quote("#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE	MAKE_DXGI_STATUS(6)")
31cpp_quote("#define DXGI_STATUS_MODE_CHANGED			MAKE_DXGI_STATUS(7)")
32cpp_quote("#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS	 MAKE_DXGI_STATUS(8)")
33
34cpp_quote("#define MAKE_DXGI_HRESULT(x)			MAKE_HRESULT(1, _FACDXGI, x)")
35cpp_quote("#define DXGI_ERROR_INVALID_CALL			 MAKE_DXGI_HRESULT(1)")
36cpp_quote("#define DXGI_ERROR_NOT_FOUND			MAKE_DXGI_HRESULT(2)")
37cpp_quote("#define DXGI_ERROR_MORE_DATA			MAKE_DXGI_HRESULT(3)")
38cpp_quote("#define DXGI_ERROR_UNSUPPORTED			 MAKE_DXGI_HRESULT(4)")
39cpp_quote("#define DXGI_ERROR_DEVICE_REMOVED		 MAKE_DXGI_HRESULT(5)")
40cpp_quote("#define DXGI_ERROR_DEVICE_HUNG			 MAKE_DXGI_HRESULT(6)")
41cpp_quote("#define DXGI_ERROR_DEVICE_RESET			 MAKE_DXGI_HRESULT(7)")
42cpp_quote("#define DXGI_ERROR_WAS_STILL_DRAWING		MAKE_DXGI_HRESULT(10)")
43cpp_quote("#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT	MAKE_DXGI_HRESULT(11)")
44cpp_quote("#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE	 MAKE_DXGI_HRESULT(12)")
45cpp_quote("#define DXGI_ERROR_DRIVER_INTERNAL_ERROR		MAKE_DXGI_HRESULT(32)")
46cpp_quote("#define DXGI_ERROR_NONEXCLUSIVE			 MAKE_DXGI_HRESULT(33)")
47cpp_quote("#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE	 MAKE_DXGI_HRESULT(34)")
48
49cpp_quote("#if 0")
50typedef HANDLE HMONITOR;
51typedef struct _LUID {
52	DWORD LowPart;
53	LONG HighPart;
54} LUID, *PLUID;
55cpp_quote("#endif")
56
57typedef UINT DXGI_USAGE;
58const DXGI_USAGE DXGI_USAGE_SHADER_INPUT		= 0x10L;
59const DXGI_USAGE DXGI_USAGE_RENDER_TARGET_OUTPUT	= 0x20L;
60const DXGI_USAGE DXGI_USAGE_BACK_BUFFER		 = 0x40L;
61const DXGI_USAGE DXGI_USAGE_SHARED		 = 0x80L;
62const DXGI_USAGE DXGI_USAGE_READ_ONLY		 = 0x100L;
63
64typedef enum DXGI_SWAP_EFFECT {
65	DXGI_SWAP_EFFECT_DISCARD	= 0,
66	DXGI_SWAP_EFFECT_SEQUENTIAL = 1,
67} DXGI_SWAP_EFFECT;
68
69typedef enum DXGI_RESIDENCY {
70	DXGI_RESIDENCY_FULLY_RESIDENT		 = 1,
71	DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY	= 2,
72	DXGI_RESIDENCY_EVICTED_TO_DISK		 = 3,
73} DXGI_RESIDENCY;
74
75typedef struct DXGI_SURFACE_DESC {
76	UINT Width;
77	UINT Height;
78	DXGI_FORMAT Format;
79	DXGI_SAMPLE_DESC SampleDesc;
80} DXGI_SURFACE_DESC;
81
82typedef struct DXGI_MAPPED_RECT {
83	INT Pitch;
84	BYTE *pBits;
85} DXGI_MAPPED_RECT;
86
87typedef struct DXGI_OUTPUT_DESC {
88	WCHAR DeviceName[32];
89	RECT DesktopCoordinates;
90	BOOL AttachedToDesktop;
91	DXGI_MODE_ROTATION Rotation;
92	HMONITOR Monitor;
93} DXGI_OUTPUT_DESC;
94
95typedef struct DXGI_FRAME_STATISTICS {
96	UINT PresentCount;
97	UINT PresentRefreshCount;
98	UINT SyncRefreshCount;
99	LARGE_INTEGER SyncQPCTime;
100	LARGE_INTEGER SyncGPUTime;
101} DXGI_FRAME_STATISTICS;
102
103typedef struct DXGI_ADAPTER_DESC {
104	WCHAR Description[128];
105	UINT VendorId;
106	UINT DeviceId;
107	UINT SubSysId;
108	UINT Revision;
109	SIZE_T DedicatedVideoMemory;
110	SIZE_T DedicatedSystemMemory;
111	SIZE_T SharedSystemMemory;
112	LUID AdapterLuid;
113} DXGI_ADAPTER_DESC;
114
115typedef struct DXGI_SWAP_CHAIN_DESC {
116	DXGI_MODE_DESC BufferDesc;
117	DXGI_SAMPLE_DESC SampleDesc;
118	DXGI_USAGE BufferUsage;
119	UINT BufferCount;
120	HWND OutputWindow;
121	BOOL Windowed;
122	DXGI_SWAP_EFFECT SwapEffect;
123	UINT Flags;
124} DXGI_SWAP_CHAIN_DESC;
125
126typedef struct DXGI_SHARED_RESOURCE {
127	HANDLE Handle;
128} DXGI_SHARED_RESOURCE;
129
130[
131	object,
132	local,
133	uuid(aec22fb8-76f3-4639-9be0-28eb43a67a2e)
134]
135interface IDXGIObject : IUnknown
136{
137	HRESULT SetPrivateData(
138	[in] REFGUID a,
139	[in] UINT b,
140	[in] const void *c
141	);
142	HRESULT SetPrivateDataInterface(
143	[in] REFGUID a,
144	[in] const IUnknown *b
145	);
146	HRESULT GetPrivateData(
147	[in] REFGUID a,
148	[in, out] UINT *b,
149	[out] void *c
150	);
151	HRESULT GetParent(
152	[in] REFIID a,
153	[out] void **b
154	);
155}
156
157[
158	object,
159	local,
160	uuid(3d3e0379-f9de-4d58-bb6c-18d62992f1a6)
161]
162interface IDXGIDeviceSubObject : IDXGIObject
163{
164	HRESULT GetDevice(
165	[in] REFIID a,
166	[out] void **b
167	);
168}
169
170[
171	object,
172	local,
173	uuid(cafcb56c-6ac3-4889-bf47-9e23bbd260ec)
174]
175interface IDXGISurface : IDXGIDeviceSubObject
176{
177	HRESULT GetDesc(
178	[out] DXGI_SURFACE_DESC *a
179	);
180	HRESULT Map(
181	[out] DXGI_MAPPED_RECT *a,
182	[in] UINT b
183	);
184	HRESULT Unmap(
185	);
186}
187
188[
189	object,
190	local,
191	uuid(ae02eedb-c735-4690-8d52-5a8dc20213aa)
192]
193interface IDXGIOutput : IDXGIObject
194{
195	HRESULT GetDesc(
196	[out] DXGI_OUTPUT_DESC *a
197	);
198	HRESULT GetDisplayModeList(
199	[in] DXGI_FORMAT a,
200	[in] UINT b,
201	[in, out] UINT *c,
202	[out] DXGI_MODE_DESC *d
203	);
204	HRESULT FindClosestMatchingMode(
205	[in] const DXGI_MODE_DESC *a,
206	[out] DXGI_MODE_DESC *b,
207	[in] IUnknown *c
208	);
209	HRESULT WaitForVBlank(
210	);
211	HRESULT TakeOwnership(
212	[in] IUnknown *a,
213	[in] BOOL b
214	);
215	void ReleaseOwnership(
216	);
217	HRESULT GetGammaControlCapabilities(
218	[out] DXGI_GAMMA_CONTROL_CAPABILITIES *a
219	);
220	HRESULT SetGammaControl(
221	[in] const DXGI_GAMMA_CONTROL *a
222	);
223	HRESULT GetGammaControl(
224	[out] DXGI_GAMMA_CONTROL *a
225	);
226	HRESULT SetDisplaySurface(
227	[in] IDXGISurface *a
228	);
229	HRESULT GetDisplaySurfaceData(
230	[in] IDXGISurface *a
231	);
232	HRESULT GetFrameStatistics(
233	[out] DXGI_FRAME_STATISTICS *a
234	);
235}
236
237[
238	object,
239	local,
240	uuid(2411e7e1-12ac-4ccf-bd14-9798e8534dc0)
241]
242interface IDXGIAdapter : IDXGIObject
243{
244	HRESULT EnumOutputs(
245	[in] UINT a,
246	[in, out] IDXGIOutput **b
247	);
248	HRESULT GetDesc(
249	[out] DXGI_ADAPTER_DESC *a
250	);
251	HRESULT CheckInterfaceSupport(
252	[in] REFGUID a,
253	[out] LARGE_INTEGER *b
254	);
255}
256
257[
258	object,
259	local,
260	uuid(310d36a0-d2e7-4c0a-aa04-6a9d23b8886a)
261]
262interface IDXGISwapChain : IDXGIDeviceSubObject
263{
264	HRESULT Present(
265	[in] UINT a,
266	[in] UINT b
267	);
268	HRESULT GetBuffer(
269	[in] UINT a,
270	[in] REFIID b,
271	[in, out] void **c
272	);
273	HRESULT SetFullscreenState(
274	[in] BOOL a,
275	[in] IDXGIOutput *b
276	);
277	HRESULT GetFullscreenState(
278	[out] BOOL *a,
279	[out] IDXGIOutput **b
280	);
281	HRESULT GetDesc(
282	[out] DXGI_SWAP_CHAIN_DESC *a
283	);
284	HRESULT ResizeBuffers(
285	[in] UINT a,
286	[in] UINT b,
287	[in] UINT c,
288	[in] DXGI_FORMAT d,
289	[in] UINT e
290	);
291	HRESULT ResizeTarget(
292	[in] const DXGI_MODE_DESC *a
293	);
294	HRESULT GetContainingOutput(
295	[out] IDXGIOutput **a
296	);
297	HRESULT GetFrameStatistics(
298	[out] DXGI_FRAME_STATISTICS *a
299	);
300	HRESULT GetLastPresentCount(
301	[out] UINT *a
302	);
303}
304
305[
306	object,
307	local,
308	uuid(7b7166ec-21c7-44ae-b21a-c9ae321ae369)
309]
310interface IDXGIFactory : IDXGIObject
311{
312	HRESULT EnumAdapters(
313	[in] UINT a,
314	[out] IDXGIAdapter **b
315	);
316	HRESULT MakeWindowAssociation(
317	[in] HWND a,
318	[in] UINT b
319	);
320	HRESULT GetWindowAssociation(
321	[in] HWND *a
322	);
323	HRESULT CreateSwapChain(
324	[in] IUnknown *a,
325	[in] DXGI_SWAP_CHAIN_DESC *b,
326	[out] IDXGISwapChain **c
327	);
328	HRESULT CreateSoftwareAdapter(
329	[in] HMODULE a,
330	[out] IDXGIAdapter **b
331	);
332}
333
334[local] HRESULT CreateDXGIFactory(REFIID riid, void **factory);
335
336[
337	object,
338	local,
339	uuid(54ec77fa-1377-44e6-8c32-88fd5f44c84c)
340]
341interface IDXGIDevice : IDXGIObject
342{
343	HRESULT GetAdapter(
344	[out] IDXGIAdapter **a
345	);
346	HRESULT CreateSurface(
347	[in] const DXGI_SURFACE_DESC *a,
348	[in] UINT b,
349	[in] DXGI_USAGE c,
350	[in] const DXGI_SHARED_RESOURCE *d,
351	[out] IDXGISurface **e
352	);
353	HRESULT QueryResourceResidency(
354	[in] IUnknown *const *a,
355	[out] DXGI_RESIDENCY *b,
356	[in] UINT c
357	);
358	HRESULT SetGPUThreadPriority(
359	[in] INT a
360	);
361	HRESULT GetGPUThreadPriority(
362	[out] INT *a
363	);
364}
365
366
367// BEGIN parts added for Gallium
368
369const unsigned int DXGI_MAP_READ = 1;
370const unsigned int DXGI_MAP_WRITE = 2;
371const unsigned int DXGI_MAP_DISCARD = 4;
372
373const unsigned int DXGI_CPU_ACCESS_NONE = 0;
374const unsigned int DXGI_CPU_ACCESS_DYNAMIC = 1;
375const unsigned int DXGI_CPU_ACCESS_READ_WRITE = 2;
376const unsigned int DXGI_CPU_ACCESS_SCRATCH = 3;
377const unsigned int DXGI_CPU_ACCESS_FIELD = 15;
378const unsigned int DXGI_USAGE_DISCARD_ON_PRESENT = 0x200;
379const unsigned int DXGI_USAGE_UNORDERED_ACCESS = 0x400;
380
381const unsigned int DXGI_PRESENT_TEST = 1;
382const unsigned int DXGI_PRESENT_DO_NOT_SEQUENCE = 2;
383const unsigned int DXGI_PRESENT_RESTART = 4;
384
385typedef enum DXGI_SWAP_CHAIN_FLAG
386{
387	DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1,
388	DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2,
389	DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4
390} DXGI_SWAP_CHAIN_FLAG;
391
392typedef struct DXGI_ADAPTER_DESC1
393{
394	WCHAR Description[128];
395	UINT VendorId;
396	UINT DeviceId;
397	UINT SubSysId;
398	UINT Revision;
399	SIZE_T DedicatedVideoMemory;
400	SIZE_T DedicatedSystemMemory;
401	SIZE_T SharedSystemMemory;
402	LUID AdapterLuid;
403	UINT Flags;
404} DXGI_ADAPTER_DESC1;
405
406[object, local, uuid("035f3ab4-482e-4e50-b41f-8a7f8bd8960b")]
407interface IDXGIResource : IDXGIDeviceSubObject
408{
409	HRESULT GetSharedHandle(
410		[out] HANDLE *a
411	);
412
413	HRESULT GetUsage(
414		[out] DXGI_USAGE *a
415	);
416
417	HRESULT SetEvictionPriority(
418		[in] UINT a
419	);
420
421	HRESULT GetEvictionPriority(
422		[out] UINT *a
423	);
424};
425
426[object, local, uuid("4AE63092-6327-4c1b-80AE-BFE12EA32B86")]
427interface IDXGISurface1 : IDXGISurface
428{
429	HRESULT GetDC(
430		[in] BOOL a,
431		[out] HDC *b
432	);
433
434	HRESULT ReleaseDC(
435		[in, optional] RECT *a
436	);
437 };
438
439[object, local, uuid("77db970f-6276-48ba-ba28-070143b4392c")]
440interface IDXGIDevice1 : IDXGIDevice
441{
442	HRESULT SetMaximumFrameLatency(
443		[in] UINT a
444	);
445
446	HRESULT GetMaximumFrameLatency(
447		[out] UINT *a
448	);
449};
450
451[object, local, uuid("29038f61-3839-4626-91fd-086879011a05")]
452interface IDXGIAdapter1 : IDXGIAdapter
453{
454	HRESULT GetDesc1(
455		[out] DXGI_ADAPTER_DESC1 *a
456	);
457};
458
459[object, local, uuid("770aae78-f26f-4dba-a829-253c83d1b387")]
460interface IDXGIFactory1 : IDXGIFactory
461{
462	HRESULT EnumAdapters1(
463		[in] UINT a,
464		[out] IDXGIAdapter1 **b
465	);
466
467	BOOL IsCurrent();
468};
469
470[local] HRESULT CreateDXGIFactory1(REFIID riid, void **factory);
471