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