ddraw: Keep a function declaration within the include guard.
[wine] / include / dxgi.idl
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 import "dxgitype.idl";
20
21 const UINT _FACDXGI = 0x87a;
22
23 cpp_quote("#define MAKE_DXGI_STATUS(x)                         MAKE_HRESULT(0, _FACDXGI, x)")
24 cpp_quote("#define DXGI_STATUS_OCCLUDED                        MAKE_DXGI_STATUS(1)")
25 cpp_quote("#define DXGI_STATUS_CLIPPED                         MAKE_DXGI_STATUS(2)")
26 cpp_quote("#define DXGI_STATUS_NO_REDIRECTION                  MAKE_DXGI_STATUS(4)")
27 cpp_quote("#define DXGI_STATUS_NO_DESKTOP_ACCESS               MAKE_DXGI_STATUS(5)")
28 cpp_quote("#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE    MAKE_DXGI_STATUS(6)")
29 cpp_quote("#define DXGI_STATUS_MODE_CHANGED                    MAKE_DXGI_STATUS(7)")
30 cpp_quote("#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS         MAKE_DXGI_STATUS(8)")
31
32 cpp_quote("#define MAKE_DXGI_HRESULT(x)                        MAKE_HRESULT(1, _FACDXGI, x)")
33 cpp_quote("#define DXGI_ERROR_INVALID_CALL                     MAKE_DXGI_HRESULT(1)")
34 cpp_quote("#define DXGI_ERROR_NOT_FOUND                        MAKE_DXGI_HRESULT(2)")
35 cpp_quote("#define DXGI_ERROR_MORE_DATA                        MAKE_DXGI_HRESULT(3)")
36 cpp_quote("#define DXGI_ERROR_UNSUPPORTED                      MAKE_DXGI_HRESULT(4)")
37 cpp_quote("#define DXGI_ERROR_DEVICE_REMOVED                   MAKE_DXGI_HRESULT(5)")
38 cpp_quote("#define DXGI_ERROR_DEVICE_HUNG                      MAKE_DXGI_HRESULT(6)")
39 cpp_quote("#define DXGI_ERROR_DEVICE_RESET                     MAKE_DXGI_HRESULT(7)")
40 cpp_quote("#define DXGI_ERROR_WAS_STILL_DRAWING                MAKE_DXGI_HRESULT(10)")
41 cpp_quote("#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT        MAKE_DXGI_HRESULT(11)")
42 cpp_quote("#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE     MAKE_DXGI_HRESULT(12)")
43 cpp_quote("#define DXGI_ERROR_DRIVER_INTERNAL_ERROR            MAKE_DXGI_HRESULT(32)")
44 cpp_quote("#define DXGI_ERROR_NONEXCLUSIVE                     MAKE_DXGI_HRESULT(33)")
45 cpp_quote("#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE          MAKE_DXGI_HRESULT(34)")
46
47 cpp_quote("#if 0")
48 typedef HANDLE HMONITOR;
49 typedef struct _LUID {
50     DWORD LowPart;
51     LONG HighPart;
52 } LUID, *PLUID;
53 cpp_quote("#endif")
54
55 typedef UINT DXGI_USAGE;
56 const DXGI_USAGE DXGI_USAGE_SHADER_INPUT            = 0x10L;
57 const DXGI_USAGE DXGI_USAGE_RENDER_TARGET_OUTPUT    = 0x20L;
58 const DXGI_USAGE DXGI_USAGE_BACK_BUFFER             = 0x40L;
59 const DXGI_USAGE DXGI_USAGE_SHARED                  = 0x80L;
60 const DXGI_USAGE DXGI_USAGE_READ_ONLY               = 0x100L;
61
62 const UINT DXGI_ENUM_MODES_INTERLACED               = 1;
63 const UINT DXGI_ENUM_MODES_SCALING                  = 2;
64
65 typedef enum DXGI_SWAP_EFFECT {
66     DXGI_SWAP_EFFECT_DISCARD    = 0,
67     DXGI_SWAP_EFFECT_SEQUENTIAL = 1,
68 } DXGI_SWAP_EFFECT;
69
70 typedef enum DXGI_RESIDENCY {
71     DXGI_RESIDENCY_FULLY_RESIDENT               = 1,
72     DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY    = 2,
73     DXGI_RESIDENCY_EVICTED_TO_DISK              = 3,
74 } DXGI_RESIDENCY;
75
76 typedef struct DXGI_SURFACE_DESC {
77     UINT Width;
78     UINT Height;
79     DXGI_FORMAT Format;
80     DXGI_SAMPLE_DESC SampleDesc;
81 } DXGI_SURFACE_DESC;
82
83 typedef struct DXGI_MAPPED_RECT {
84     INT Pitch;
85     BYTE *pBits;
86 } DXGI_MAPPED_RECT;
87
88 typedef struct DXGI_OUTPUT_DESC {
89     WCHAR DeviceName[32];
90     RECT DesktopCoordinates;
91     BOOL AttachedToDesktop;
92     DXGI_MODE_ROTATION Rotation;
93     HMONITOR Monitor;
94 } DXGI_OUTPUT_DESC;
95
96 typedef struct DXGI_FRAME_STATISTICS {
97     UINT PresentCount;
98     UINT PresentRefreshCount;
99     UINT SyncRefreshCount;
100     LARGE_INTEGER SyncQPCTime;
101     LARGE_INTEGER SyncGPUTime;
102 } DXGI_FRAME_STATISTICS;
103
104 typedef struct DXGI_ADAPTER_DESC {
105     WCHAR Description[128];
106     UINT VendorId;
107     UINT DeviceId;
108     UINT SubSysId;
109     UINT Revision;
110     SIZE_T DedicatedVideoMemory;
111     SIZE_T DedicatedSystemMemory;
112     SIZE_T SharedSystemMemory;
113     LUID AdapterLuid;
114 } DXGI_ADAPTER_DESC;
115
116 typedef struct DXGI_SWAP_CHAIN_DESC {
117     DXGI_MODE_DESC BufferDesc;
118     DXGI_SAMPLE_DESC SampleDesc;
119     DXGI_USAGE BufferUsage;
120     UINT BufferCount;
121     HWND OutputWindow;
122     BOOL Windowed;
123     DXGI_SWAP_EFFECT SwapEffect;
124     UINT Flags;
125 } DXGI_SWAP_CHAIN_DESC;
126
127 typedef struct DXGI_SHARED_RESOURCE {
128     HANDLE Handle;
129 } DXGI_SHARED_RESOURCE;
130
131 [
132     object,
133     local,
134     uuid(aec22fb8-76f3-4639-9be0-28eb43a67a2e)
135 ]
136 interface IDXGIObject : IUnknown
137 {
138     HRESULT SetPrivateData(
139         [in] REFGUID guid,
140         [in] UINT data_size,
141         [in] const void *data
142     );
143     HRESULT SetPrivateDataInterface(
144         [in] REFGUID guid,
145         [in] const IUnknown *object
146     );
147     HRESULT GetPrivateData(
148         [in] REFGUID guid,
149         [in, out] UINT *data_size,
150         [out] void *data
151     );
152     HRESULT GetParent(
153         [in] REFIID riid,
154         [out] void **parent
155     );
156 }
157
158 [
159     object,
160     local,
161     uuid(3d3e0379-f9de-4d58-bb6c-18d62992f1a6)
162 ]
163 interface IDXGIDeviceSubObject : IDXGIObject
164 {
165     HRESULT GetDevice(
166         [in] REFIID riid,
167         [out] void **device
168     );
169 }
170
171 [
172     object,
173     local,
174     uuid(cafcb56c-6ac3-4889-bf47-9e23bbd260ec)
175 ]
176 interface IDXGISurface : IDXGIDeviceSubObject
177 {
178     HRESULT GetDesc(
179         [out] DXGI_SURFACE_DESC *desc
180     );
181     HRESULT Map(
182         [out] DXGI_MAPPED_RECT *mapped_rect,
183         [in] UINT flags
184     );
185     HRESULT Unmap(
186     );
187 }
188
189 [
190     object,
191     local,
192     uuid(ae02eedb-c735-4690-8d52-5a8dc20213aa)
193 ]
194 interface IDXGIOutput : IDXGIObject
195 {
196     HRESULT GetDesc(
197         [out] DXGI_OUTPUT_DESC *desc
198     );
199     HRESULT GetDisplayModeList(
200         [in] DXGI_FORMAT format,
201         [in] UINT flags,
202         [in, out] UINT *mode_count,
203         [out] DXGI_MODE_DESC *desc
204     );
205     HRESULT FindClosestMatchingMode(
206         [in] const DXGI_MODE_DESC *mode,
207         [out] DXGI_MODE_DESC *closest_match,
208         [in] IUnknown *device
209     );
210     HRESULT WaitForVBlank(
211     );
212     HRESULT TakeOwnership(
213         [in] IUnknown *device,
214         [in] BOOL exclusive
215     );
216     void ReleaseOwnership(
217     );
218     HRESULT GetGammaControlCapabilities(
219         [out] DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps
220     );
221     HRESULT SetGammaControl(
222         [in] const DXGI_GAMMA_CONTROL *gamma_control
223     );
224     HRESULT GetGammaControl(
225         [out] DXGI_GAMMA_CONTROL *gamma_control
226     );
227     HRESULT SetDisplaySurface(
228         [in] IDXGISurface *surface
229     );
230     HRESULT GetDisplaySurfaceData(
231         [in] IDXGISurface *surface
232     );
233     HRESULT GetFrameStatistics(
234         [out] DXGI_FRAME_STATISTICS *stats
235     );
236 }
237
238 [
239     object,
240     local,
241     uuid(2411e7e1-12ac-4ccf-bd14-9798e8534dc0)
242 ]
243 interface IDXGIAdapter : IDXGIObject
244 {
245     HRESULT EnumOutputs(
246         [in] UINT output_idx,
247         [in, out] IDXGIOutput **output
248     );
249     HRESULT GetDesc(
250         [out] DXGI_ADAPTER_DESC *desc
251     );
252     HRESULT CheckInterfaceSupport(
253         [in] REFGUID guid,
254         [out] LARGE_INTEGER *umd_version
255     );
256 }
257
258 [
259     object,
260     local,
261     uuid(310d36a0-d2e7-4c0a-aa04-6a9d23b8886a)
262 ]
263 interface IDXGISwapChain : IDXGIDeviceSubObject
264 {
265     HRESULT Present(
266         [in] UINT sync_interval,
267         [in] UINT flags
268     );
269     HRESULT GetBuffer(
270         [in] UINT buffer_idx,
271         [in] REFIID riid,
272         [in, out] void **surface
273     );
274     HRESULT SetFullscreenState(
275         [in] BOOL fullscreen,
276         [in] IDXGIOutput *target
277     );
278     HRESULT GetFullscreenState(
279         [out] BOOL *fullscreen,
280         [out] IDXGIOutput **target
281     );
282     HRESULT GetDesc(
283         [out] DXGI_SWAP_CHAIN_DESC *desc
284     );
285     HRESULT ResizeBuffers(
286         [in] UINT buffer_count,
287         [in] UINT width,
288         [in] UINT height,
289         [in] DXGI_FORMAT format,
290         [in] UINT flags
291     );
292     HRESULT ResizeTarget(
293         [in] const DXGI_MODE_DESC *target_mode_desc
294     );
295     HRESULT GetContainingOutput(
296         [out] IDXGIOutput **output
297     );
298     HRESULT GetFrameStatistics(
299         [out] DXGI_FRAME_STATISTICS *stats
300     );
301     HRESULT GetLastPresentCount(
302         [out] UINT *last_present_count
303     );
304 }
305
306 [
307     object,
308     local,
309     uuid(7b7166ec-21c7-44ae-b21a-c9ae321ae369)
310 ]
311 interface IDXGIFactory : IDXGIObject
312 {
313     HRESULT EnumAdapters(
314         [in] UINT adapter_idx,
315         [out] IDXGIAdapter **adapter
316     );
317     HRESULT MakeWindowAssociation(
318         [in] HWND window,
319         [in] UINT flags
320     );
321     HRESULT GetWindowAssociation(
322         [in] HWND *window
323     );
324     HRESULT CreateSwapChain(
325         [in] IUnknown *device,
326         [in] DXGI_SWAP_CHAIN_DESC *desc,
327         [out] IDXGISwapChain **swapchain
328     );
329     HRESULT CreateSoftwareAdapter(
330         [in] HMODULE swrast,
331         [out] IDXGIAdapter **adapter
332     );
333 }
334
335 [local] HRESULT __stdcall CreateDXGIFactory(REFIID riid, void **factory);
336
337 [
338     object,
339     local,
340     uuid(54ec77fa-1377-44e6-8c32-88fd5f44c84c)
341 ]
342 interface IDXGIDevice : IDXGIObject
343 {
344     HRESULT GetAdapter(
345         [out] IDXGIAdapter **adapter
346     );
347     HRESULT CreateSurface(
348         [in] const DXGI_SURFACE_DESC *desc,
349         [in] UINT surface_count,
350         [in] DXGI_USAGE usage,
351         [in] const DXGI_SHARED_RESOURCE *shared_resource,
352         [out] IDXGISurface **surface
353     );
354     HRESULT QueryResourceResidency(
355         [in] IUnknown *const *resources,
356         [out] DXGI_RESIDENCY *residency,
357         [in] UINT resource_count
358     );
359     HRESULT SetGPUThreadPriority(
360         [in] INT priority
361     );
362     HRESULT GetGPUThreadPriority(
363         [out] INT *priority
364     );
365 }