hlink: Fix memory leaks in test.
[wine] / dlls / dxgi / dxgi_private.h
1 /*
2  * Copyright 2008 Henri Verbeet for CodeWeavers
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 #ifndef __WINE_DXGI_PRIVATE_H
20 #define __WINE_DXGI_PRIVATE_H
21
22 #include "wine/debug.h"
23
24 #define COBJMACROS
25 #include "winbase.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "objbase.h"
29
30 #include "dxgi.h"
31 #ifdef DXGI_INIT_GUID
32 #include "initguid.h"
33 #endif
34 #include "wine/wined3d.h"
35 #include "wine/winedxgi.h"
36
37 extern CRITICAL_SECTION dxgi_cs DECLSPEC_HIDDEN;
38
39 /* Layered device */
40 enum dxgi_device_layer_id
41 {
42     DXGI_DEVICE_LAYER_DEBUG1        = 0x8,
43     DXGI_DEVICE_LAYER_THREAD_SAFE   = 0x10,
44     DXGI_DEVICE_LAYER_DEBUG2        = 0x20,
45     DXGI_DEVICE_LAYER_SWITCH_TO_REF = 0x30,
46     DXGI_DEVICE_LAYER_D3D10_DEVICE  = 0xffffffff,
47 };
48
49 struct layer_get_size_args
50 {
51     DWORD unknown0;
52     DWORD unknown1;
53     DWORD *unknown2;
54     DWORD *unknown3;
55     IDXGIAdapter *adapter;
56     WORD interface_major;
57     WORD interface_minor;
58     WORD version_build;
59     WORD version_revision;
60 };
61
62 struct dxgi_device_layer
63 {
64     enum dxgi_device_layer_id id;
65     HRESULT (WINAPI *init)(enum dxgi_device_layer_id id, DWORD *count, DWORD *values);
66     UINT (WINAPI *get_size)(enum dxgi_device_layer_id id, struct layer_get_size_args *args, DWORD unknown0);
67     HRESULT (WINAPI *create)(enum dxgi_device_layer_id id, void **layer_base, DWORD unknown0,
68             void *device_object, REFIID riid, void **device_layer);
69 };
70
71 /* TRACE helper functions */
72 const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
73
74 WINED3DFORMAT wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
75
76 /* IDXGIFactory */
77 extern const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl DECLSPEC_HIDDEN;
78 struct dxgi_factory
79 {
80     const struct IWineDXGIFactoryVtbl *vtbl;
81     LONG refcount;
82     IWineD3D *wined3d;
83     UINT adapter_count;
84     IDXGIAdapter **adapters;
85 };
86
87 /* IDXGIDevice */
88 struct dxgi_device
89 {
90     const struct IWineDXGIDeviceVtbl *vtbl;
91     IUnknown *child_layer;
92     LONG refcount;
93     IWineD3DDevice *wined3d_device;
94     IWineDXGIFactory *factory;
95 };
96
97 HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *layer,
98         IDXGIFactory *factory, IDXGIAdapter *adapter) DECLSPEC_HIDDEN;
99
100 /* IDXGIOutput */
101 struct dxgi_output
102 {
103     const struct IDXGIOutputVtbl *vtbl;
104     LONG refcount;
105 };
106
107 void dxgi_output_init(struct dxgi_output *output) DECLSPEC_HIDDEN;
108
109 /* IDXGIAdapter */
110 struct dxgi_adapter
111 {
112     const struct IWineDXGIAdapterVtbl *vtbl;
113     IDXGIFactory *parent;
114     LONG refcount;
115     UINT ordinal;
116     IDXGIOutput *output;
117 };
118
119 HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, IDXGIFactory *parent, UINT ordinal) DECLSPEC_HIDDEN;
120
121 /* IDXGISwapChain */
122 extern const struct IDXGISwapChainVtbl dxgi_swapchain_vtbl DECLSPEC_HIDDEN;
123 struct dxgi_swapchain
124 {
125     const struct IDXGISwapChainVtbl *vtbl;
126     LONG refcount;
127     IWineD3DSwapChain *wined3d_swapchain;
128 };
129
130 /* IDXGISurface */
131 extern const struct IDXGISurfaceVtbl dxgi_surface_vtbl DECLSPEC_HIDDEN;
132 extern const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl DECLSPEC_HIDDEN;
133 struct dxgi_surface
134 {
135     const struct IDXGISurfaceVtbl *vtbl;
136     const struct IUnknownVtbl *inner_unknown_vtbl;
137     IUnknown *outer_unknown;
138     LONG refcount;
139 };
140
141 #endif /* __WINE_DXGI_PRIVATE_H */