2 * IDirect3D9 implementation
4 * Copyright 2002 Jason Edmeades
5 * Copyright 2005 Oliver Stieber
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.
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.
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
23 #include "d3d9_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d9
);
27 /* IDirect3D9 IUnknown parts follow: */
28 static HRESULT WINAPI
IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface
, REFIID riid
, LPVOID
* ppobj
)
30 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
32 if (IsEqualGUID(riid
, &IID_IUnknown
)
33 || IsEqualGUID(riid
, &IID_IDirect3D9
)) {
34 IUnknown_AddRef(iface
);
39 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
44 static ULONG WINAPI
IDirect3D9Impl_AddRef(LPDIRECT3D9 iface
) {
45 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
46 ULONG ref
= InterlockedIncrement(&This
->ref
);
48 TRACE("(%p) : AddRef from %d\n", This
, ref
- 1);
53 static ULONG WINAPI
IDirect3D9Impl_Release(LPDIRECT3D9 iface
) {
54 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
55 ULONG ref
= InterlockedDecrement(&This
->ref
);
57 TRACE("(%p) : ReleaseRef to %d\n", This
, ref
);
60 EnterCriticalSection(&d3d9_cs
);
61 IWineD3D_Release(This
->WineD3D
);
62 LeaveCriticalSection(&d3d9_cs
);
63 HeapFree(GetProcessHeap(), 0, This
);
69 /* IDirect3D9 Interface follow: */
70 static HRESULT WINAPI
IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9 iface
, void* pInitializeFunction
) {
71 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
73 TRACE("(%p)->(%p)\n", This
, pInitializeFunction
);
75 EnterCriticalSection(&d3d9_cs
);
76 hr
= IWineD3D_RegisterSoftwareDevice(This
->WineD3D
, pInitializeFunction
);
77 LeaveCriticalSection(&d3d9_cs
);
81 static UINT WINAPI
IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface
) {
82 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
86 EnterCriticalSection(&d3d9_cs
);
87 hr
= IWineD3D_GetAdapterCount(This
->WineD3D
);
88 LeaveCriticalSection(&d3d9_cs
);
92 static HRESULT WINAPI
IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface
, UINT Adapter
, DWORD Flags
, D3DADAPTER_IDENTIFIER9
* pIdentifier
) {
93 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
94 WINED3DADAPTER_IDENTIFIER adapter_id
;
97 /* dx8 and dx9 have different structures to be filled in, with incompatible
98 layouts so pass in pointers to the places to be filled via an internal
100 adapter_id
.Driver
= pIdentifier
->Driver
;
101 adapter_id
.Description
= pIdentifier
->Description
;
102 adapter_id
.DeviceName
= pIdentifier
->DeviceName
;
103 adapter_id
.DriverVersion
= &pIdentifier
->DriverVersion
;
104 adapter_id
.VendorId
= &pIdentifier
->VendorId
;
105 adapter_id
.DeviceId
= &pIdentifier
->DeviceId
;
106 adapter_id
.SubSysId
= &pIdentifier
->SubSysId
;
107 adapter_id
.Revision
= &pIdentifier
->Revision
;
108 adapter_id
.DeviceIdentifier
= &pIdentifier
->DeviceIdentifier
;
109 adapter_id
.WHQLLevel
= &pIdentifier
->WHQLLevel
;
111 EnterCriticalSection(&d3d9_cs
);
112 hr
= IWineD3D_GetAdapterIdentifier(This
->WineD3D
, Adapter
, Flags
, &adapter_id
);
113 LeaveCriticalSection(&d3d9_cs
);
117 static UINT WINAPI
IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9 iface
, UINT Adapter
, D3DFORMAT Format
) {
118 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
120 TRACE("(%p)->(%d, %d\n", This
, Adapter
, Format
);
122 /* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out */
123 if(Format
!= D3DFMT_X8R8G8B8
&& Format
!= D3DFMT_R5G6B5
) {
127 EnterCriticalSection(&d3d9_cs
);
128 hr
= IWineD3D_GetAdapterModeCount(This
->WineD3D
, Adapter
, Format
);
129 LeaveCriticalSection(&d3d9_cs
);
133 static HRESULT WINAPI
IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9 iface
, UINT Adapter
, D3DFORMAT Format
, UINT Mode
, D3DDISPLAYMODE
* pMode
) {
134 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
136 TRACE("(%p)->(%d, %d, %d, %p)\n", This
, Adapter
, Format
, Mode
, pMode
);
137 /* We can't pass this to WineD3D, otherwise it'll think it came from D3D8 or DDraw.
138 It's supposed to fail anyway, so no harm returning failure. */
139 if(Format
!= WINED3DFMT_X8R8G8B8
&& Format
!= WINED3DFMT_R5G6B5
)
140 return D3DERR_INVALIDCALL
;
142 EnterCriticalSection(&d3d9_cs
);
143 hr
= IWineD3D_EnumAdapterModes(This
->WineD3D
, Adapter
, Format
, Mode
, (WINED3DDISPLAYMODE
*) pMode
);
144 LeaveCriticalSection(&d3d9_cs
);
148 static HRESULT WINAPI
IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9 iface
, UINT Adapter
, D3DDISPLAYMODE
* pMode
) {
149 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
150 return IWineD3D_GetAdapterDisplayMode(This
->WineD3D
, Adapter
, (WINED3DDISPLAYMODE
*) pMode
);
153 static HRESULT WINAPI
IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9 iface
,
154 UINT Adapter
, D3DDEVTYPE CheckType
, D3DFORMAT DisplayFormat
,
155 D3DFORMAT BackBufferFormat
, BOOL Windowed
) {
156 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
158 TRACE("(%p)->(%d, %d, %d, %d, %s\n", This
, Adapter
, CheckType
, DisplayFormat
,
159 BackBufferFormat
, Windowed
? "true" : "false");
161 EnterCriticalSection(&d3d9_cs
);
162 hr
= IWineD3D_CheckDeviceType(This
->WineD3D
, Adapter
, CheckType
, DisplayFormat
,
163 BackBufferFormat
, Windowed
);
164 LeaveCriticalSection(&d3d9_cs
);
168 static HRESULT WINAPI
IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9 iface
,
169 UINT Adapter
, D3DDEVTYPE DeviceType
, D3DFORMAT AdapterFormat
,
170 DWORD Usage
, D3DRESOURCETYPE RType
, D3DFORMAT CheckFormat
) {
171 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
175 EnterCriticalSection(&d3d9_cs
);
176 hr
= IWineD3D_CheckDeviceFormat(This
->WineD3D
, Adapter
, DeviceType
, AdapterFormat
,
177 Usage
, RType
, CheckFormat
);
178 LeaveCriticalSection(&d3d9_cs
);
182 static HRESULT WINAPI
IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9 iface
,
183 UINT Adapter
, D3DDEVTYPE DeviceType
, D3DFORMAT SurfaceFormat
,
184 BOOL Windowed
, D3DMULTISAMPLE_TYPE MultiSampleType
, DWORD
* pQualityLevels
) {
185 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
189 EnterCriticalSection(&d3d9_cs
);
190 hr
= IWineD3D_CheckDeviceMultiSampleType(This
->WineD3D
, Adapter
, DeviceType
, SurfaceFormat
,
191 Windowed
, MultiSampleType
, pQualityLevels
);
192 LeaveCriticalSection(&d3d9_cs
);
196 static HRESULT WINAPI
IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9 iface
,
197 UINT Adapter
, D3DDEVTYPE DeviceType
, D3DFORMAT AdapterFormat
,
198 D3DFORMAT RenderTargetFormat
, D3DFORMAT DepthStencilFormat
) {
199 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
203 EnterCriticalSection(&d3d9_cs
);
204 hr
= IWineD3D_CheckDepthStencilMatch(This
->WineD3D
, Adapter
, DeviceType
, AdapterFormat
,
205 RenderTargetFormat
, DepthStencilFormat
);
206 LeaveCriticalSection(&d3d9_cs
);
210 static HRESULT WINAPI
IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9 iface
, UINT Adapter
, D3DDEVTYPE DeviceType
, D3DFORMAT SourceFormat
, D3DFORMAT TargetFormat
) {
211 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
215 EnterCriticalSection(&d3d9_cs
);
216 hr
= IWineD3D_CheckDeviceFormatConversion(This
->WineD3D
, Adapter
, DeviceType
, SourceFormat
,
218 LeaveCriticalSection(&d3d9_cs
);
222 static HRESULT WINAPI
IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface
, UINT Adapter
, D3DDEVTYPE DeviceType
, D3DCAPS9
* pCaps
) {
223 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
224 HRESULT hrc
= D3D_OK
;
225 WINED3DCAPS
*pWineCaps
;
227 TRACE("(%p) Relay %d %u %p\n", This
, Adapter
, DeviceType
, pCaps
);
230 return D3DERR_INVALIDCALL
;
232 pWineCaps
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WINED3DCAPS
));
233 if(pWineCaps
== NULL
){
234 return D3DERR_INVALIDCALL
; /*well this is what MSDN says to return*/
236 D3D9CAPSTOWINECAPS(pCaps
, pWineCaps
)
237 EnterCriticalSection(&d3d9_cs
);
238 hrc
= IWineD3D_GetDeviceCaps(This
->WineD3D
, Adapter
, DeviceType
, pWineCaps
);
239 LeaveCriticalSection(&d3d9_cs
);
240 HeapFree(GetProcessHeap(), 0, pWineCaps
);
242 /* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */
243 pCaps
->DevCaps2
|= D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES
;
244 TRACE("(%p) returning %p\n", This
, pCaps
);
248 static HMONITOR WINAPI
IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface
, UINT Adapter
) {
249 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
253 EnterCriticalSection(&d3d9_cs
);
254 ret
= IWineD3D_GetAdapterMonitor(This
->WineD3D
, Adapter
);
255 LeaveCriticalSection(&d3d9_cs
);
259 /* Internal function called back during the CreateDevice to create a render target */
260 HRESULT WINAPI
D3D9CB_CreateRenderTarget(IUnknown
*device
, IUnknown
*pSuperior
, UINT Width
, UINT Height
,
261 WINED3DFORMAT Format
, WINED3DMULTISAMPLE_TYPE MultiSample
,
262 DWORD MultisampleQuality
, BOOL Lockable
,
263 IWineD3DSurface
** ppSurface
, HANDLE
* pSharedHandle
) {
264 HRESULT res
= D3D_OK
;
265 IDirect3DSurface9Impl
*d3dSurface
= NULL
;
266 TRACE("(%p) call back\n", device
);
267 res
= IDirect3DDevice9_CreateRenderTarget((IDirect3DDevice9
*)device
, Width
, Height
,
268 (D3DFORMAT
)Format
, MultiSample
, MultisampleQuality
, Lockable
,
269 (IDirect3DSurface9
**)&d3dSurface
, pSharedHandle
);
271 if (SUCCEEDED(res
)) {
272 *ppSurface
= d3dSurface
->wineD3DSurface
;
273 d3dSurface
->container
= pSuperior
;
274 d3dSurface
->isImplicit
= TRUE
;
275 /* Implicit surfaces are created with an refcount of 0 */
276 IUnknown_Release((IUnknown
*)d3dSurface
);
283 ULONG WINAPI
D3D9CB_DestroyRenderTarget(IWineD3DSurface
*pSurface
) {
284 IDirect3DSurface9Impl
* surfaceParent
;
285 TRACE("(%p) call back\n", pSurface
);
287 IWineD3DSurface_GetParent(pSurface
, (IUnknown
**) &surfaceParent
);
288 surfaceParent
->isImplicit
= FALSE
;
289 /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */
290 return IDirect3DSurface9_Release((IDirect3DSurface9
*) surfaceParent
);
293 static HRESULT WINAPI
D3D9CB_CreateAdditionalSwapChain(IUnknown
*device
,
294 WINED3DPRESENT_PARAMETERS
* pPresentationParameters
,
295 IWineD3DSwapChain
** ppSwapChain
) {
296 HRESULT res
= D3D_OK
;
297 IDirect3DSwapChain9Impl
*d3dSwapChain
= NULL
;
298 D3DPRESENT_PARAMETERS localParameters
;
299 TRACE("(%p) call back\n", device
);
301 /* Copy the presentation parameters */
302 localParameters
.BackBufferWidth
= pPresentationParameters
->BackBufferWidth
;
303 localParameters
.BackBufferHeight
= pPresentationParameters
->BackBufferHeight
;
304 localParameters
.BackBufferFormat
= pPresentationParameters
->BackBufferFormat
;
305 localParameters
.BackBufferCount
= pPresentationParameters
->BackBufferCount
;
306 localParameters
.MultiSampleType
= pPresentationParameters
->MultiSampleType
;
307 localParameters
.MultiSampleQuality
= pPresentationParameters
->MultiSampleQuality
;
308 localParameters
.SwapEffect
= pPresentationParameters
->SwapEffect
;
309 localParameters
.hDeviceWindow
= pPresentationParameters
->hDeviceWindow
;
310 localParameters
.Windowed
= pPresentationParameters
->Windowed
;
311 localParameters
.EnableAutoDepthStencil
= pPresentationParameters
->EnableAutoDepthStencil
;
312 localParameters
.AutoDepthStencilFormat
= pPresentationParameters
->AutoDepthStencilFormat
;
313 localParameters
.Flags
= pPresentationParameters
->Flags
;
314 localParameters
.FullScreen_RefreshRateInHz
= pPresentationParameters
->FullScreen_RefreshRateInHz
;
315 localParameters
.PresentationInterval
= pPresentationParameters
->PresentationInterval
;
317 res
= IDirect3DDevice9_CreateAdditionalSwapChain((IDirect3DDevice9
*)device
, &localParameters
, (IDirect3DSwapChain9
**)&d3dSwapChain
);
319 if (SUCCEEDED(res
)) {
320 *ppSwapChain
= d3dSwapChain
->wineD3DSwapChain
;
321 d3dSwapChain
->isImplicit
= TRUE
;
322 /* Implicit swap chains are created with an refcount of 0 */
323 IUnknown_Release((IUnknown
*)d3dSwapChain
);
328 /* Copy back the presentation parameters */
329 pPresentationParameters
->BackBufferWidth
= localParameters
.BackBufferWidth
;
330 pPresentationParameters
->BackBufferHeight
= localParameters
.BackBufferHeight
;
331 pPresentationParameters
->BackBufferFormat
= localParameters
.BackBufferFormat
;
332 pPresentationParameters
->BackBufferCount
= localParameters
.BackBufferCount
;
333 pPresentationParameters
->MultiSampleType
= localParameters
.MultiSampleType
;
334 pPresentationParameters
->MultiSampleQuality
= localParameters
.MultiSampleQuality
;
335 pPresentationParameters
->SwapEffect
= localParameters
.SwapEffect
;
336 pPresentationParameters
->hDeviceWindow
= localParameters
.hDeviceWindow
;
337 pPresentationParameters
->Windowed
= localParameters
.Windowed
;
338 pPresentationParameters
->EnableAutoDepthStencil
= localParameters
.EnableAutoDepthStencil
;
339 pPresentationParameters
->AutoDepthStencilFormat
= localParameters
.AutoDepthStencilFormat
;
340 pPresentationParameters
->Flags
= localParameters
.Flags
;
341 pPresentationParameters
->FullScreen_RefreshRateInHz
= localParameters
.FullScreen_RefreshRateInHz
;
342 pPresentationParameters
->PresentationInterval
= localParameters
.PresentationInterval
;
347 ULONG WINAPI
D3D9CB_DestroySwapChain(IWineD3DSwapChain
*pSwapChain
) {
348 IDirect3DSwapChain9Impl
* swapChainParent
;
349 TRACE("(%p) call back\n", pSwapChain
);
351 IWineD3DSwapChain_GetParent(pSwapChain
,(IUnknown
**) &swapChainParent
);
352 swapChainParent
->isImplicit
= FALSE
;
353 /* Swap chain had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */
354 return IDirect3DSwapChain9_Release((IDirect3DSwapChain9
*) swapChainParent
);
357 /* Internal function called back during the CreateDevice to create a render target */
358 HRESULT WINAPI
D3D9CB_CreateDepthStencilSurface(IUnknown
*device
, IUnknown
*pSuperior
, UINT Width
, UINT Height
,
359 WINED3DFORMAT Format
, WINED3DMULTISAMPLE_TYPE MultiSample
,
360 DWORD MultisampleQuality
, BOOL Discard
,
361 IWineD3DSurface
** ppSurface
, HANDLE
* pSharedHandle
) {
362 HRESULT res
= D3D_OK
;
363 IDirect3DSurface9Impl
*d3dSurface
= NULL
;
364 TRACE("(%p) call back\n", device
);
366 res
= IDirect3DDevice9_CreateDepthStencilSurface((IDirect3DDevice9
*)device
, Width
, Height
,
367 (D3DFORMAT
)Format
, MultiSample
, MultisampleQuality
, Discard
,
368 (IDirect3DSurface9
**)&d3dSurface
, pSharedHandle
);
369 if (SUCCEEDED(res
)) {
370 *ppSurface
= d3dSurface
->wineD3DSurface
;
371 d3dSurface
->container
= device
;
372 d3dSurface
->isImplicit
= TRUE
;
373 /* Implicit surfaces are created with an refcount of 0 */
374 IUnknown_Release((IUnknown
*)d3dSurface
);
379 ULONG WINAPI
D3D9CB_DestroyDepthStencilSurface(IWineD3DSurface
*pSurface
) {
380 IDirect3DSurface9Impl
* surfaceParent
;
381 TRACE("(%p) call back\n", pSurface
);
383 IWineD3DSurface_GetParent(pSurface
, (IUnknown
**) &surfaceParent
);
384 surfaceParent
->isImplicit
= FALSE
;
385 /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */
386 return IDirect3DSurface9_Release((IDirect3DSurface9
*) surfaceParent
);
389 static HRESULT WINAPI
IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface
, UINT Adapter
, D3DDEVTYPE DeviceType
,
390 HWND hFocusWindow
, DWORD BehaviourFlags
,
391 D3DPRESENT_PARAMETERS
* pPresentationParameters
,
392 IDirect3DDevice9
** ppReturnedDeviceInterface
) {
394 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
395 IDirect3DDevice9Impl
*object
= NULL
;
396 WINED3DPRESENT_PARAMETERS localParameters
;
398 TRACE("(%p) Relay\n", This
);
400 /* Check the validity range of the adapter parameter */
401 if (Adapter
>= IDirect3D9Impl_GetAdapterCount(iface
)) {
402 *ppReturnedDeviceInterface
= NULL
;
403 return D3DERR_INVALIDCALL
;
406 /* Allocate the storage for the device object */
407 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirect3DDevice9Impl
));
408 if (NULL
== object
) {
409 FIXME("Allocation of memory failed\n");
410 *ppReturnedDeviceInterface
= NULL
;
411 return D3DERR_OUTOFVIDEOMEMORY
;
414 object
->lpVtbl
= &Direct3DDevice9_Vtbl
;
416 *ppReturnedDeviceInterface
= (IDirect3DDevice9
*)object
;
418 /* Allocate an associated WineD3DDevice object */
419 EnterCriticalSection(&d3d9_cs
);
420 hr
=IWineD3D_CreateDevice(This
->WineD3D
, Adapter
, DeviceType
, hFocusWindow
, BehaviourFlags
, &object
->WineD3DDevice
, (IUnknown
*)object
);
423 HeapFree(GetProcessHeap(), 0, object
);
424 *ppReturnedDeviceInterface
= NULL
;
425 LeaveCriticalSection(&d3d9_cs
);
429 TRACE("(%p) : Created Device %p\n", This
, object
);
431 localParameters
.BackBufferWidth
= pPresentationParameters
->BackBufferWidth
;
432 localParameters
.BackBufferHeight
= pPresentationParameters
->BackBufferHeight
;
433 localParameters
.BackBufferFormat
= pPresentationParameters
->BackBufferFormat
;
434 localParameters
.BackBufferCount
= pPresentationParameters
->BackBufferCount
;
435 localParameters
.MultiSampleType
= pPresentationParameters
->MultiSampleType
;
436 localParameters
.MultiSampleQuality
= pPresentationParameters
->MultiSampleQuality
;
437 localParameters
.SwapEffect
= pPresentationParameters
->SwapEffect
;
438 localParameters
.hDeviceWindow
= pPresentationParameters
->hDeviceWindow
;
439 localParameters
.Windowed
= pPresentationParameters
->Windowed
;
440 localParameters
.EnableAutoDepthStencil
= pPresentationParameters
->EnableAutoDepthStencil
;
441 localParameters
.AutoDepthStencilFormat
= pPresentationParameters
->AutoDepthStencilFormat
;
442 localParameters
.Flags
= pPresentationParameters
->Flags
;
443 localParameters
.FullScreen_RefreshRateInHz
= pPresentationParameters
->FullScreen_RefreshRateInHz
;
444 localParameters
.PresentationInterval
= pPresentationParameters
->PresentationInterval
;
446 if(BehaviourFlags
& D3DCREATE_MULTITHREADED
) {
447 IWineD3DDevice_SetMultithreaded(object
->WineD3DDevice
);
450 hr
= IWineD3DDevice_Init3D(object
->WineD3DDevice
, &localParameters
, D3D9CB_CreateAdditionalSwapChain
);
452 pPresentationParameters
->BackBufferWidth
= localParameters
.BackBufferWidth
;
453 pPresentationParameters
->BackBufferHeight
= localParameters
.BackBufferHeight
;
454 pPresentationParameters
->BackBufferFormat
= localParameters
.BackBufferFormat
;
455 pPresentationParameters
->BackBufferCount
= localParameters
.BackBufferCount
;
456 pPresentationParameters
->MultiSampleType
= localParameters
.MultiSampleType
;
457 pPresentationParameters
->MultiSampleQuality
= localParameters
.MultiSampleQuality
;
458 pPresentationParameters
->SwapEffect
= localParameters
.SwapEffect
;
459 pPresentationParameters
->hDeviceWindow
= localParameters
.hDeviceWindow
;
460 pPresentationParameters
->Windowed
= localParameters
.Windowed
;
461 pPresentationParameters
->EnableAutoDepthStencil
= localParameters
.EnableAutoDepthStencil
;
462 pPresentationParameters
->AutoDepthStencilFormat
= localParameters
.AutoDepthStencilFormat
;
463 pPresentationParameters
->Flags
= localParameters
.Flags
;
464 pPresentationParameters
->FullScreen_RefreshRateInHz
= localParameters
.FullScreen_RefreshRateInHz
;
465 pPresentationParameters
->PresentationInterval
= localParameters
.PresentationInterval
;
468 FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This
, object
->WineD3DDevice
);
469 HeapFree(GetProcessHeap(), 0, object
);
470 *ppReturnedDeviceInterface
= NULL
;
473 /* Initialize the converted declaration array. This creates a valid pointer and when adding decls HeapReAlloc
474 * can be used without further checking
476 object
->convertedDecls
= HeapAlloc(GetProcessHeap(), 0, 0);
477 LeaveCriticalSection(&d3d9_cs
);
484 const IDirect3D9Vtbl Direct3D9_Vtbl
=
487 IDirect3D9Impl_QueryInterface
,
488 IDirect3D9Impl_AddRef
,
489 IDirect3D9Impl_Release
,
491 IDirect3D9Impl_RegisterSoftwareDevice
,
492 IDirect3D9Impl_GetAdapterCount
,
493 IDirect3D9Impl_GetAdapterIdentifier
,
494 IDirect3D9Impl_GetAdapterModeCount
,
495 IDirect3D9Impl_EnumAdapterModes
,
496 IDirect3D9Impl_GetAdapterDisplayMode
,
497 IDirect3D9Impl_CheckDeviceType
,
498 IDirect3D9Impl_CheckDeviceFormat
,
499 IDirect3D9Impl_CheckDeviceMultiSampleType
,
500 IDirect3D9Impl_CheckDepthStencilMatch
,
501 IDirect3D9Impl_CheckDeviceFormatConversion
,
502 IDirect3D9Impl_GetDeviceCaps
,
503 IDirect3D9Impl_GetAdapterMonitor
,
504 IDirect3D9Impl_CreateDevice