quartz: Use proper alloc/free functions for COM objects.
[wine] / dlls / d3d9 / directx.c
1 /*
2  * IDirect3D9 implementation
3  *
4  * Copyright 2002 Jason Edmeades
5  * Copyright 2005 Oliver Stieber
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include "config.h"
23 #include "d3d9_private.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
26
27 /* IDirect3D9 IUnknown parts follow: */
28 static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID* ppobj)
29 {
30     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
31
32     if (IsEqualGUID(riid, &IID_IUnknown)
33         || IsEqualGUID(riid, &IID_IDirect3D9)) {
34         IUnknown_AddRef(iface);
35         *ppobj = This;
36         return S_OK;
37     }
38
39     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
40     *ppobj = NULL;
41     return E_NOINTERFACE;
42 }
43
44 static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9 iface) {
45     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
46     ULONG ref = InterlockedIncrement(&This->ref);
47
48     TRACE("(%p) : AddRef from %d\n", This, ref - 1);
49
50     return ref;
51 }
52
53 static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9 iface) {
54     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
55     ULONG ref = InterlockedDecrement(&This->ref);
56
57     TRACE("(%p) : ReleaseRef to %d\n", This, ref);
58
59     if (ref == 0) {
60         IWineD3D_Release(This->WineD3D);
61         HeapFree(GetProcessHeap(), 0, This);
62     }
63
64     return ref;
65 }
66
67 /* IDirect3D9 Interface follow: */
68 static HRESULT  WINAPI  IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9 iface, void* pInitializeFunction) {
69     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
70     return IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction);
71 }
72
73 static UINT     WINAPI  IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface) {
74     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
75     return IWineD3D_GetAdapterCount(This->WineD3D);
76 }
77
78 static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) {
79     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
80     WINED3DADAPTER_IDENTIFIER adapter_id;
81
82     /* dx8 and dx9 have different structures to be filled in, with incompatible 
83        layouts so pass in pointers to the places to be filled via an internal 
84        structure                                                                */
85     adapter_id.Driver           = pIdentifier->Driver;          
86     adapter_id.Description      = pIdentifier->Description;     
87     adapter_id.DeviceName       = pIdentifier->DeviceName;      
88     adapter_id.DriverVersion    = &pIdentifier->DriverVersion;   
89     adapter_id.VendorId         = &pIdentifier->VendorId;        
90     adapter_id.DeviceId         = &pIdentifier->DeviceId;        
91     adapter_id.SubSysId         = &pIdentifier->SubSysId;        
92     adapter_id.Revision         = &pIdentifier->Revision;        
93     adapter_id.DeviceIdentifier = &pIdentifier->DeviceIdentifier;
94     adapter_id.WHQLLevel        = &pIdentifier->WHQLLevel;       
95
96     return IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id);
97 }
98
99 static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format) {
100     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
101     return IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, Format);
102 }
103
104 static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) {
105     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
106     /* We can't pass this to WineD3D, otherwise it'll think it came from D3D8.
107        It's supposed to fail anyway, so no harm returning failure. */
108     if(Format == D3DFMT_UNKNOWN)
109         return D3DERR_INVALIDCALL;
110     return IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, Format, Mode, (WINED3DDISPLAYMODE *) pMode);
111 }
112
113 static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9 iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
114     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
115     return IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode);
116 }
117
118 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9 iface,
119                                               UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat,
120                                               D3DFORMAT BackBufferFormat, BOOL Windowed) {
121     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
122     return IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, DisplayFormat,
123                                     BackBufferFormat, Windowed);
124 }
125
126 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9 iface,
127                                                   UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
128                                                   DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
129     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
130     return IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, AdapterFormat,
131                                     Usage, RType, CheckFormat);
132 }
133
134 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9 iface,
135                                                            UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
136                                                            BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) {
137     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
138     return IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, SurfaceFormat,
139                                                Windowed, MultiSampleType, pQualityLevels);
140 }
141
142 static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9 iface, 
143                                                        UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
144                                                        D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
145     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
146     return IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, AdapterFormat,
147                                            RenderTargetFormat, DepthStencilFormat);
148 }
149
150 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) {
151     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
152     return IWineD3D_CheckDeviceFormatConversion(This->WineD3D, Adapter, DeviceType, SourceFormat,
153                                                 TargetFormat);
154 }
155
156 static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) {
157     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
158     HRESULT hrc = D3D_OK;
159     WINED3DCAPS *pWineCaps;
160
161     TRACE("(%p) Relay %d %u %p\n", This, Adapter, DeviceType, pCaps);
162
163     if(NULL == pCaps){
164         return D3DERR_INVALIDCALL;
165     }
166     pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS));
167     if(pWineCaps == NULL){
168         return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/
169     }
170     D3D9CAPSTOWINECAPS(pCaps, pWineCaps)
171     hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps);
172     HeapFree(GetProcessHeap(), 0, pWineCaps);
173
174     /* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */
175     pCaps->DevCaps2 |= D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES;
176     TRACE("(%p) returning %p\n", This, pCaps);
177     return hrc;
178 }
179
180 static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapter) {
181     IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
182     return IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter);
183 }
184
185 /* Internal function called back during the CreateDevice to create a render target */
186 HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
187                                          WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
188                                          DWORD MultisampleQuality, BOOL Lockable,
189                                          IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
190     HRESULT res = D3D_OK;
191     IDirect3DSurface9Impl *d3dSurface = NULL;
192     TRACE("(%p) call back\n", device);
193     res = IDirect3DDevice9_CreateRenderTarget((IDirect3DDevice9 *)device, Width, Height, 
194                                          (D3DFORMAT)Format, MultiSample, MultisampleQuality, Lockable,
195                                          (IDirect3DSurface9 **)&d3dSurface, pSharedHandle);
196
197     if (SUCCEEDED(res)) {
198         *ppSurface = d3dSurface->wineD3DSurface;
199         d3dSurface->container = pSuperior;
200         d3dSurface->isImplicit = TRUE;
201         /* Implicit surfaces are created with an refcount of 0 */
202         IUnknown_Release((IUnknown *)d3dSurface);
203     } else {
204         *ppSurface = NULL;
205     }
206     return res;
207 }
208
209 ULONG WINAPI D3D9CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {
210     IDirect3DSurface9Impl* surfaceParent;
211     TRACE("(%p) call back\n", pSurface);
212
213     IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);
214     surfaceParent->isImplicit = FALSE;
215     /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */
216     return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);
217 }
218
219 static HRESULT WINAPI D3D9CB_CreateAdditionalSwapChain(IUnknown *device,
220                                                        WINED3DPRESENT_PARAMETERS* pPresentationParameters,
221                                                        IWineD3DSwapChain ** ppSwapChain) {
222     HRESULT res = D3D_OK;
223     IDirect3DSwapChain9Impl *d3dSwapChain = NULL;
224     D3DPRESENT_PARAMETERS localParameters;
225     TRACE("(%p) call back\n", device);
226
227     /* Copy the presentation parameters */
228     localParameters.BackBufferWidth                     = pPresentationParameters->BackBufferWidth;
229     localParameters.BackBufferHeight                    = pPresentationParameters->BackBufferHeight;
230     localParameters.BackBufferFormat                    = pPresentationParameters->BackBufferFormat;
231     localParameters.BackBufferCount                     = pPresentationParameters->BackBufferCount;
232     localParameters.MultiSampleType                     = pPresentationParameters->MultiSampleType;
233     localParameters.MultiSampleQuality                  = pPresentationParameters->MultiSampleQuality;
234     localParameters.SwapEffect                          = pPresentationParameters->SwapEffect;
235     localParameters.hDeviceWindow                       = pPresentationParameters->hDeviceWindow;
236     localParameters.Windowed                            = pPresentationParameters->Windowed;
237     localParameters.EnableAutoDepthStencil              = pPresentationParameters->EnableAutoDepthStencil;
238     localParameters.AutoDepthStencilFormat              = pPresentationParameters->AutoDepthStencilFormat;
239     localParameters.Flags                               = pPresentationParameters->Flags;
240     localParameters.FullScreen_RefreshRateInHz          = pPresentationParameters->FullScreen_RefreshRateInHz;
241     localParameters.PresentationInterval                = pPresentationParameters->PresentationInterval;
242
243     res = IDirect3DDevice9_CreateAdditionalSwapChain((IDirect3DDevice9 *)device, &localParameters, (IDirect3DSwapChain9 **)&d3dSwapChain);
244
245     if (SUCCEEDED(res)) {
246         *ppSwapChain = d3dSwapChain->wineD3DSwapChain;
247         d3dSwapChain->isImplicit = TRUE;
248         /* Implicit swap chains are created with an refcount of 0 */
249         IUnknown_Release((IUnknown *)d3dSwapChain);
250     } else {
251         *ppSwapChain = NULL;
252     }
253
254     /* Copy back the presentation parameters */
255     pPresentationParameters->BackBufferWidth            = localParameters.BackBufferWidth;
256     pPresentationParameters->BackBufferHeight           = localParameters.BackBufferHeight;
257     pPresentationParameters->BackBufferFormat           = localParameters.BackBufferFormat;
258     pPresentationParameters->BackBufferCount            = localParameters.BackBufferCount;
259     pPresentationParameters->MultiSampleType            = localParameters.MultiSampleType;
260     pPresentationParameters->MultiSampleQuality         = localParameters.MultiSampleQuality;
261     pPresentationParameters->SwapEffect                 = localParameters.SwapEffect;
262     pPresentationParameters->hDeviceWindow              = localParameters.hDeviceWindow;
263     pPresentationParameters->Windowed                   = localParameters.Windowed;
264     pPresentationParameters->EnableAutoDepthStencil     = localParameters.EnableAutoDepthStencil;
265     pPresentationParameters->AutoDepthStencilFormat     = localParameters.AutoDepthStencilFormat;
266     pPresentationParameters->Flags                      = localParameters.Flags;
267     pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
268     pPresentationParameters->PresentationInterval       = localParameters.PresentationInterval;
269
270     return res;
271 }
272
273 ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
274     IDirect3DSwapChain9Impl* swapChainParent;
275     TRACE("(%p) call back\n", pSwapChain);
276
277     IWineD3DSwapChain_GetParent(pSwapChain,(IUnknown **) &swapChainParent);
278     swapChainParent->isImplicit = FALSE;
279     /* Swap chain had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */
280     return IDirect3DSwapChain9_Release((IDirect3DSwapChain9*) swapChainParent);
281 }
282
283 /* Internal function called back during the CreateDevice to create a render target */
284 HRESULT WINAPI D3D9CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
285                                          WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
286                                          DWORD MultisampleQuality, BOOL Discard,
287                                          IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
288     HRESULT res = D3D_OK;
289     IDirect3DSurface9Impl *d3dSurface = NULL;
290     TRACE("(%p) call back\n", device);
291
292     res = IDirect3DDevice9_CreateDepthStencilSurface((IDirect3DDevice9 *)device, Width, Height, 
293                                          (D3DFORMAT)Format, MultiSample, MultisampleQuality, Discard, 
294                                          (IDirect3DSurface9 **)&d3dSurface, pSharedHandle);
295     if (SUCCEEDED(res)) {
296         *ppSurface = d3dSurface->wineD3DSurface;
297         d3dSurface->container = device;
298         d3dSurface->isImplicit = TRUE;
299         /* Implicit surfaces are created with an refcount of 0 */
300         IUnknown_Release((IUnknown *)d3dSurface);
301     }
302     return res;
303 }
304
305 ULONG WINAPI D3D9CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {
306     IDirect3DSurface9Impl* surfaceParent;
307     TRACE("(%p) call back\n", pSurface);
308
309     IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);
310     surfaceParent->isImplicit = FALSE;
311     /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */
312     return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);
313 }
314
315 static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
316                                                   HWND hFocusWindow, DWORD BehaviourFlags,
317                                                   D3DPRESENT_PARAMETERS* pPresentationParameters,
318                                                   IDirect3DDevice9** ppReturnedDeviceInterface) {
319
320     IDirect3D9Impl       *This   = (IDirect3D9Impl *)iface;
321     IDirect3DDevice9Impl *object = NULL;
322     WINED3DPRESENT_PARAMETERS localParameters;
323     HRESULT hr;
324     TRACE("(%p) Relay\n", This);
325
326     /* Check the validity range of the adapter parameter */
327     if (Adapter >= IDirect3D9Impl_GetAdapterCount(iface)) {
328         *ppReturnedDeviceInterface = NULL;
329         return D3DERR_INVALIDCALL;
330     }
331
332     /* Allocate the storage for the device object */
333     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice9Impl));
334     if (NULL == object) {
335         FIXME("Allocation of memory failed\n");
336         *ppReturnedDeviceInterface = NULL;
337         return D3DERR_OUTOFVIDEOMEMORY;
338     }
339
340     object->lpVtbl = &Direct3DDevice9_Vtbl;
341     object->ref = 1;
342     *ppReturnedDeviceInterface = (IDirect3DDevice9 *)object;
343
344     /* Allocate an associated WineD3DDevice object */
345     hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object);
346
347     if (hr != D3D_OK) {
348         HeapFree(GetProcessHeap(), 0, object);
349         *ppReturnedDeviceInterface = NULL;
350         return hr;
351     }
352
353     TRACE("(%p) : Created Device %p\n", This, object);
354
355     localParameters.BackBufferWidth                     = pPresentationParameters->BackBufferWidth;
356     localParameters.BackBufferHeight                    = pPresentationParameters->BackBufferHeight;
357     localParameters.BackBufferFormat                    = pPresentationParameters->BackBufferFormat;
358     localParameters.BackBufferCount                     = pPresentationParameters->BackBufferCount;
359     localParameters.MultiSampleType                     = pPresentationParameters->MultiSampleType;
360     localParameters.MultiSampleQuality                  = pPresentationParameters->MultiSampleQuality;
361     localParameters.SwapEffect                          = pPresentationParameters->SwapEffect;
362     localParameters.hDeviceWindow                       = pPresentationParameters->hDeviceWindow;
363     localParameters.Windowed                            = pPresentationParameters->Windowed;
364     localParameters.EnableAutoDepthStencil              = pPresentationParameters->EnableAutoDepthStencil;
365     localParameters.AutoDepthStencilFormat              = pPresentationParameters->AutoDepthStencilFormat;
366     localParameters.Flags                               = pPresentationParameters->Flags;
367     localParameters.FullScreen_RefreshRateInHz          = pPresentationParameters->FullScreen_RefreshRateInHz;
368     localParameters.PresentationInterval                = pPresentationParameters->PresentationInterval;
369
370     hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D9CB_CreateAdditionalSwapChain);
371
372     pPresentationParameters->BackBufferWidth            = localParameters.BackBufferWidth;
373     pPresentationParameters->BackBufferHeight           = localParameters.BackBufferHeight;
374     pPresentationParameters->BackBufferFormat           = localParameters.BackBufferFormat;
375     pPresentationParameters->BackBufferCount            = localParameters.BackBufferCount;
376     pPresentationParameters->MultiSampleType            = localParameters.MultiSampleType;
377     pPresentationParameters->MultiSampleQuality         = localParameters.MultiSampleQuality;
378     pPresentationParameters->SwapEffect                 = localParameters.SwapEffect;
379     pPresentationParameters->hDeviceWindow              = localParameters.hDeviceWindow;
380     pPresentationParameters->Windowed                   = localParameters.Windowed;
381     pPresentationParameters->EnableAutoDepthStencil     = localParameters.EnableAutoDepthStencil;
382     pPresentationParameters->AutoDepthStencilFormat     = localParameters.AutoDepthStencilFormat;
383     pPresentationParameters->Flags                      = localParameters.Flags;
384     pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
385     pPresentationParameters->PresentationInterval       = localParameters.PresentationInterval;
386
387     if (hr != D3D_OK) {
388         FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
389         HeapFree(GetProcessHeap(), 0, object);
390         *ppReturnedDeviceInterface = NULL;
391     }
392     return hr;
393 }
394
395
396
397 const IDirect3D9Vtbl Direct3D9_Vtbl =
398 {
399     /* IUnknown */
400     IDirect3D9Impl_QueryInterface,
401     IDirect3D9Impl_AddRef,
402     IDirect3D9Impl_Release,
403     /* IDirect3D9 */
404     IDirect3D9Impl_RegisterSoftwareDevice,
405     IDirect3D9Impl_GetAdapterCount,
406     IDirect3D9Impl_GetAdapterIdentifier,
407     IDirect3D9Impl_GetAdapterModeCount,
408     IDirect3D9Impl_EnumAdapterModes,
409     IDirect3D9Impl_GetAdapterDisplayMode,
410     IDirect3D9Impl_CheckDeviceType,
411     IDirect3D9Impl_CheckDeviceFormat,
412     IDirect3D9Impl_CheckDeviceMultiSampleType,
413     IDirect3D9Impl_CheckDepthStencilMatch,
414     IDirect3D9Impl_CheckDeviceFormatConversion,
415     IDirect3D9Impl_GetDeviceCaps,
416     IDirect3D9Impl_GetAdapterMonitor,
417     IDirect3D9Impl_CreateDevice
418 };