dxgi: Add a separate function for surface initialization.
[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 #include "winnls.h"
30
31 #include "dxgi.h"
32 #ifdef DXGI_INIT_GUID
33 #include "initguid.h"
34 #endif
35 #include "wine/wined3d.h"
36 #include "wine/winedxgi.h"
37
38 extern CRITICAL_SECTION dxgi_cs DECLSPEC_HIDDEN;
39
40 /* Layered device */
41 enum dxgi_device_layer_id
42 {
43     DXGI_DEVICE_LAYER_DEBUG1        = 0x8,
44     DXGI_DEVICE_LAYER_THREAD_SAFE   = 0x10,
45     DXGI_DEVICE_LAYER_DEBUG2        = 0x20,
46     DXGI_DEVICE_LAYER_SWITCH_TO_REF = 0x30,
47     DXGI_DEVICE_LAYER_D3D10_DEVICE  = 0xffffffff,
48 };
49
50 struct layer_get_size_args
51 {
52     DWORD unknown0;
53     DWORD unknown1;
54     DWORD *unknown2;
55     DWORD *unknown3;
56     IDXGIAdapter *adapter;
57     WORD interface_major;
58     WORD interface_minor;
59     WORD version_build;
60     WORD version_revision;
61 };
62
63 struct dxgi_device_layer
64 {
65     enum dxgi_device_layer_id id;
66     HRESULT (WINAPI *init)(enum dxgi_device_layer_id id, DWORD *count, DWORD *values);
67     UINT (WINAPI *get_size)(enum dxgi_device_layer_id id, struct layer_get_size_args *args, DWORD unknown0);
68     HRESULT (WINAPI *create)(enum dxgi_device_layer_id id, void **layer_base, DWORD unknown0,
69             void *device_object, REFIID riid, void **device_layer);
70 };
71
72 /* TRACE helper functions */
73 const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
74
75 WINED3DFORMAT wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
76
77 /* IDXGIFactory */
78 extern const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl DECLSPEC_HIDDEN;
79 struct dxgi_factory
80 {
81     const struct IWineDXGIFactoryVtbl *vtbl;
82     LONG refcount;
83     IWineD3D *wined3d;
84     UINT adapter_count;
85     IDXGIAdapter **adapters;
86 };
87
88 /* IDXGIDevice */
89 struct dxgi_device
90 {
91     const struct IWineDXGIDeviceVtbl *vtbl;
92     IUnknown *child_layer;
93     LONG refcount;
94     IWineD3DDevice *wined3d_device;
95     IWineDXGIFactory *factory;
96 };
97
98 HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *layer,
99         IDXGIFactory *factory, IDXGIAdapter *adapter) DECLSPEC_HIDDEN;
100
101 /* IDXGIOutput */
102 struct dxgi_output
103 {
104     const struct IDXGIOutputVtbl *vtbl;
105     LONG refcount;
106     struct dxgi_adapter *adapter;
107 };
108
109 void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *adapter) DECLSPEC_HIDDEN;
110
111 /* IDXGIAdapter */
112 struct dxgi_adapter
113 {
114     const struct IWineDXGIAdapterVtbl *vtbl;
115     IWineDXGIFactory *parent;
116     LONG refcount;
117     UINT ordinal;
118     IDXGIOutput *output;
119 };
120
121 HRESULT dxgi_adapter_init(struct dxgi_adapter *adapter, IWineDXGIFactory *parent, UINT ordinal) DECLSPEC_HIDDEN;
122
123 /* IDXGISwapChain */
124 extern const struct IDXGISwapChainVtbl dxgi_swapchain_vtbl DECLSPEC_HIDDEN;
125 struct dxgi_swapchain
126 {
127     const struct IDXGISwapChainVtbl *vtbl;
128     LONG refcount;
129     IWineD3DSwapChain *wined3d_swapchain;
130 };
131
132 /* IDXGISurface */
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 HRESULT dxgi_surface_init(struct dxgi_surface *surface, IUnknown *outer) DECLSPEC_HIDDEN;
142
143 #endif /* __WINE_DXGI_PRIVATE_H */