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(LPDIRECT3D9EX iface
, REFIID riid
, LPVOID
* ppobj
)
30 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
32 TRACE("iface %p, riid %s, object %p.\n", iface
, debugstr_guid(riid
), ppobj
);
34 if (IsEqualGUID(riid
, &IID_IUnknown
)
35 || IsEqualGUID(riid
, &IID_IDirect3D9
)) {
36 IDirect3D9Ex_AddRef(iface
);
38 TRACE("Returning IDirect3D9 interface at %p\n", *ppobj
);
40 } else if(IsEqualGUID(riid
, &IID_IDirect3D9Ex
)) {
43 TRACE("Returning IDirect3D9Ex interface at %p\n", *ppobj
);
44 IDirect3D9Ex_AddRef((IDirect3D9Ex
*)*ppobj
);
46 WARN("Application asks for IDirect3D9Ex, but this instance wasn't created with Direct3DCreate9Ex\n");
47 WARN("Returning E_NOINTERFACE\n");
53 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
58 static ULONG WINAPI
IDirect3D9Impl_AddRef(LPDIRECT3D9EX iface
) {
59 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
60 ULONG ref
= InterlockedIncrement(&This
->ref
);
62 TRACE("%p increasing refcount to %u.\n", iface
, ref
);
67 static ULONG WINAPI
IDirect3D9Impl_Release(LPDIRECT3D9EX iface
) {
68 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
69 ULONG ref
= InterlockedDecrement(&This
->ref
);
71 TRACE("%p decreasing refcount to %u.\n", iface
, ref
);
75 IWineD3D_Release(This
->WineD3D
);
76 wined3d_mutex_unlock();
78 HeapFree(GetProcessHeap(), 0, This
);
84 /* IDirect3D9 Interface follow: */
85 static HRESULT WINAPI
IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9EX iface
, void* pInitializeFunction
) {
86 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
89 TRACE("iface %p, init_function %p.\n", iface
, pInitializeFunction
);
92 hr
= IWineD3D_RegisterSoftwareDevice(This
->WineD3D
, pInitializeFunction
);
93 wined3d_mutex_unlock();
98 static UINT WINAPI
IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9EX iface
) {
99 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
102 TRACE("iface %p.\n", iface
);
104 wined3d_mutex_lock();
105 hr
= IWineD3D_GetAdapterCount(This
->WineD3D
);
106 wined3d_mutex_unlock();
111 static HRESULT WINAPI
IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9EX iface
, UINT Adapter
, DWORD Flags
, D3DADAPTER_IDENTIFIER9
* pIdentifier
) {
112 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
113 WINED3DADAPTER_IDENTIFIER adapter_id
;
116 TRACE("iface %p, adapter %u, flags %#x, identifier %p.\n",
117 iface
, Adapter
, Flags
, pIdentifier
);
119 adapter_id
.driver
= pIdentifier
->Driver
;
120 adapter_id
.driver_size
= sizeof(pIdentifier
->Driver
);
121 adapter_id
.description
= pIdentifier
->Description
;
122 adapter_id
.description_size
= sizeof(pIdentifier
->Description
);
123 adapter_id
.device_name
= pIdentifier
->DeviceName
;
124 adapter_id
.device_name_size
= sizeof(pIdentifier
->DeviceName
);
126 wined3d_mutex_lock();
127 hr
= IWineD3D_GetAdapterIdentifier(This
->WineD3D
, Adapter
, Flags
, &adapter_id
);
128 wined3d_mutex_unlock();
130 pIdentifier
->DriverVersion
= adapter_id
.driver_version
;
131 pIdentifier
->VendorId
= adapter_id
.vendor_id
;
132 pIdentifier
->DeviceId
= adapter_id
.device_id
;
133 pIdentifier
->SubSysId
= adapter_id
.subsystem_id
;
134 pIdentifier
->Revision
= adapter_id
.revision
;
135 memcpy(&pIdentifier
->DeviceIdentifier
, &adapter_id
.device_identifier
, sizeof(pIdentifier
->DeviceIdentifier
));
136 pIdentifier
->WHQLLevel
= adapter_id
.whql_level
;
141 static UINT WINAPI
IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9EX iface
, UINT Adapter
, D3DFORMAT Format
) {
142 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
145 TRACE("iface %p, adapter %u, format %#x.\n", iface
, Adapter
, Format
);
147 /* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out */
148 if(Format
!= D3DFMT_X8R8G8B8
&& Format
!= D3DFMT_R5G6B5
) {
152 wined3d_mutex_lock();
153 hr
= IWineD3D_GetAdapterModeCount(This
->WineD3D
, Adapter
, wined3dformat_from_d3dformat(Format
));
154 wined3d_mutex_unlock();
159 static HRESULT WINAPI
IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface
, UINT Adapter
, D3DFORMAT Format
, UINT Mode
, D3DDISPLAYMODE
* pMode
) {
160 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
163 TRACE("iface %p, adapter %u, format %#x, mode_idx %u, mode %p.\n",
164 iface
, Adapter
, Format
, Mode
, pMode
);
166 /* We can't pass this to WineD3D, otherwise it'll think it came from D3D8 or DDraw.
167 It's supposed to fail anyway, so no harm returning failure. */
168 if(Format
!= D3DFMT_X8R8G8B8
&& Format
!= D3DFMT_R5G6B5
)
169 return D3DERR_INVALIDCALL
;
171 wined3d_mutex_lock();
172 hr
= IWineD3D_EnumAdapterModes(This
->WineD3D
, Adapter
, wined3dformat_from_d3dformat(Format
),
173 Mode
, (WINED3DDISPLAYMODE
*) pMode
);
174 wined3d_mutex_unlock();
176 if (SUCCEEDED(hr
)) pMode
->Format
= d3dformat_from_wined3dformat(pMode
->Format
);
181 static HRESULT WINAPI
IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface
, UINT Adapter
, D3DDISPLAYMODE
* pMode
) {
182 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
185 TRACE("iface %p, adapter %u, mode %p.\n", iface
, Adapter
, pMode
);
187 wined3d_mutex_lock();
188 hr
= IWineD3D_GetAdapterDisplayMode(This
->WineD3D
, Adapter
, (WINED3DDISPLAYMODE
*) pMode
);
189 wined3d_mutex_unlock();
191 if (SUCCEEDED(hr
)) pMode
->Format
= d3dformat_from_wined3dformat(pMode
->Format
);
196 static HRESULT WINAPI
IDirect3D9Impl_CheckDeviceType(IDirect3D9Ex
*iface
, UINT Adapter
,
197 D3DDEVTYPE CheckType
, D3DFORMAT DisplayFormat
, D3DFORMAT BackBufferFormat
, BOOL Windowed
)
199 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
202 TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n",
203 iface
, Adapter
, CheckType
, DisplayFormat
, BackBufferFormat
, Windowed
);
205 wined3d_mutex_lock();
206 hr
= IWineD3D_CheckDeviceType(This
->WineD3D
, Adapter
, CheckType
, wined3dformat_from_d3dformat(DisplayFormat
),
207 wined3dformat_from_d3dformat(BackBufferFormat
), Windowed
);
208 wined3d_mutex_unlock();
213 static HRESULT WINAPI
IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex
*iface
, UINT Adapter
, D3DDEVTYPE DeviceType
,
214 D3DFORMAT AdapterFormat
, DWORD Usage
, D3DRESOURCETYPE RType
, D3DFORMAT CheckFormat
)
216 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
218 WINED3DRESOURCETYPE WineD3DRType
;
220 TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
221 iface
, Adapter
, DeviceType
, AdapterFormat
, Usage
, RType
, CheckFormat
);
223 /* This format is nothing special and it is supported perfectly.
224 * However, ati and nvidia driver on windows do not mark this format as
225 * supported (tested with the dxCapsViewer) and pretending to
226 * support this format uncovers a bug in Battlefield 1942 (fonts are missing)
227 * So do the same as Windows drivers and pretend not to support it on dx8 and 9
229 if(CheckFormat
== D3DFMT_R8G8B8
)
231 WARN("D3DFMT_R8G8B8 is not available on windows, returning D3DERR_NOTAVAILABLE\n");
232 return D3DERR_NOTAVAILABLE
;
236 case D3DRTYPE_VERTEXBUFFER
:
237 case D3DRTYPE_INDEXBUFFER
:
238 WineD3DRType
= WINED3DRTYPE_BUFFER
;
242 WineD3DRType
= RType
;
246 wined3d_mutex_lock();
247 hr
= IWineD3D_CheckDeviceFormat(This
->WineD3D
, Adapter
, DeviceType
, wined3dformat_from_d3dformat(AdapterFormat
),
248 Usage
, WineD3DRType
, wined3dformat_from_d3dformat(CheckFormat
), SURFACE_OPENGL
);
249 wined3d_mutex_unlock();
254 static HRESULT WINAPI
IDirect3D9Impl_CheckDeviceMultiSampleType(IDirect3D9Ex
*iface
, UINT Adapter
,
255 D3DDEVTYPE DeviceType
, D3DFORMAT SurfaceFormat
, BOOL Windowed
, D3DMULTISAMPLE_TYPE MultiSampleType
,
256 DWORD
*pQualityLevels
)
258 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
261 TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x, levels %p.\n",
262 iface
, Adapter
, DeviceType
, SurfaceFormat
, Windowed
, MultiSampleType
, pQualityLevels
);
264 wined3d_mutex_lock();
265 hr
= IWineD3D_CheckDeviceMultiSampleType(This
->WineD3D
, Adapter
, DeviceType
,
266 wined3dformat_from_d3dformat(SurfaceFormat
), Windowed
, MultiSampleType
, pQualityLevels
);
267 wined3d_mutex_unlock();
272 static HRESULT WINAPI
IDirect3D9Impl_CheckDepthStencilMatch(IDirect3D9Ex
*iface
, UINT Adapter
,
273 D3DDEVTYPE DeviceType
, D3DFORMAT AdapterFormat
, D3DFORMAT RenderTargetFormat
, D3DFORMAT DepthStencilFormat
)
275 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
278 TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n",
279 iface
, Adapter
, DeviceType
, AdapterFormat
, RenderTargetFormat
, DepthStencilFormat
);
281 wined3d_mutex_lock();
282 hr
= IWineD3D_CheckDepthStencilMatch(This
->WineD3D
, Adapter
, DeviceType
,
283 wined3dformat_from_d3dformat(AdapterFormat
), wined3dformat_from_d3dformat(RenderTargetFormat
),
284 wined3dformat_from_d3dformat(DepthStencilFormat
));
285 wined3d_mutex_unlock();
290 static HRESULT WINAPI
IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9EX iface
, UINT Adapter
, D3DDEVTYPE DeviceType
, D3DFORMAT SourceFormat
, D3DFORMAT TargetFormat
) {
291 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
294 TRACE("iface %p, adapter %u, device_type %#x, src_format %#x, dst_format %#x.\n",
295 iface
, Adapter
, DeviceType
, SourceFormat
, TargetFormat
);
297 wined3d_mutex_lock();
298 hr
= IWineD3D_CheckDeviceFormatConversion(This
->WineD3D
, Adapter
, DeviceType
,
299 wined3dformat_from_d3dformat(SourceFormat
), wined3dformat_from_d3dformat(TargetFormat
));
300 wined3d_mutex_unlock();
305 void filter_caps(D3DCAPS9
* pCaps
)
308 DWORD textureFilterCaps
=
309 D3DPTFILTERCAPS_MINFPOINT
| D3DPTFILTERCAPS_MINFLINEAR
| D3DPTFILTERCAPS_MINFANISOTROPIC
|
310 D3DPTFILTERCAPS_MINFPYRAMIDALQUAD
| D3DPTFILTERCAPS_MINFGAUSSIANQUAD
|
311 D3DPTFILTERCAPS_MIPFPOINT
| D3DPTFILTERCAPS_MIPFLINEAR
| D3DPTFILTERCAPS_MAGFPOINT
|
312 D3DPTFILTERCAPS_MAGFLINEAR
|D3DPTFILTERCAPS_MAGFANISOTROPIC
|D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD
|
313 D3DPTFILTERCAPS_MAGFGAUSSIANQUAD
;
314 pCaps
->TextureFilterCaps
&= textureFilterCaps
;
315 pCaps
->CubeTextureFilterCaps
&= textureFilterCaps
;
316 pCaps
->VolumeTextureFilterCaps
&= textureFilterCaps
;
319 D3DDEVCAPS_EXECUTESYSTEMMEMORY
| D3DDEVCAPS_EXECUTEVIDEOMEMORY
| D3DDEVCAPS_TLVERTEXSYSTEMMEMORY
|
320 D3DDEVCAPS_TLVERTEXVIDEOMEMORY
| D3DDEVCAPS_TEXTURESYSTEMMEMORY
| D3DDEVCAPS_TEXTUREVIDEOMEMORY
|
321 D3DDEVCAPS_DRAWPRIMTLVERTEX
| D3DDEVCAPS_CANRENDERAFTERFLIP
| D3DDEVCAPS_TEXTURENONLOCALVIDMEM
|
322 D3DDEVCAPS_DRAWPRIMITIVES2
| D3DDEVCAPS_SEPARATETEXTUREMEMORIES
|
323 D3DDEVCAPS_DRAWPRIMITIVES2EX
| D3DDEVCAPS_HWTRANSFORMANDLIGHT
| D3DDEVCAPS_CANBLTSYSTONONLOCAL
|
324 D3DDEVCAPS_HWRASTERIZATION
| D3DDEVCAPS_PUREDEVICE
| D3DDEVCAPS_QUINTICRTPATCHES
|
325 D3DDEVCAPS_RTPATCHES
| D3DDEVCAPS_RTPATCHHANDLEZERO
| D3DDEVCAPS_NPATCHES
;
328 D3DPSHADECAPS_COLORGOURAUDRGB
| D3DPSHADECAPS_SPECULARGOURAUDRGB
|
329 D3DPSHADECAPS_ALPHAGOURAUDBLEND
| D3DPSHADECAPS_FOGGOURAUD
;
332 D3DPRASTERCAPS_DITHER
| D3DPRASTERCAPS_ZTEST
| D3DPRASTERCAPS_FOGVERTEX
|
333 D3DPRASTERCAPS_FOGTABLE
| D3DPRASTERCAPS_MIPMAPLODBIAS
| D3DPRASTERCAPS_ZBUFFERLESSHSR
|
334 D3DPRASTERCAPS_FOGRANGE
| D3DPRASTERCAPS_ANISOTROPY
| D3DPRASTERCAPS_WBUFFER
|
335 D3DPRASTERCAPS_WFOG
| D3DPRASTERCAPS_ZFOG
| D3DPRASTERCAPS_COLORPERSPECTIVE
|
336 D3DPRASTERCAPS_SCISSORTEST
| D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS
|
337 D3DPRASTERCAPS_DEPTHBIAS
| D3DPRASTERCAPS_MULTISAMPLE_TOGGLE
;
340 D3DDEVCAPS2_STREAMOFFSET
| D3DDEVCAPS2_DMAPNPATCH
| D3DDEVCAPS2_ADAPTIVETESSRTPATCH
|
341 D3DDEVCAPS2_ADAPTIVETESSNPATCH
| D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES
|
342 D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH
| D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET
;
345 D3DCAPS2_FULLSCREENGAMMA
| D3DCAPS2_CANCALIBRATEGAMMA
| D3DCAPS2_RESERVED
|
346 D3DCAPS2_CANMANAGERESOURCE
| D3DCAPS2_DYNAMICTEXTURES
| D3DCAPS2_CANAUTOGENMIPMAP
;
348 pCaps
->VertexProcessingCaps
&=
349 D3DVTXPCAPS_TEXGEN
| D3DVTXPCAPS_MATERIALSOURCE7
| D3DVTXPCAPS_DIRECTIONALLIGHTS
|
350 D3DVTXPCAPS_POSITIONALLIGHTS
| D3DVTXPCAPS_LOCALVIEWER
| D3DVTXPCAPS_TWEENING
|
351 D3DVTXPCAPS_TEXGEN_SPHEREMAP
| D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER
;
353 pCaps
->TextureCaps
&=
354 D3DPTEXTURECAPS_PERSPECTIVE
| D3DPTEXTURECAPS_POW2
| D3DPTEXTURECAPS_ALPHA
|
355 D3DPTEXTURECAPS_SQUAREONLY
| D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE
|
356 D3DPTEXTURECAPS_ALPHAPALETTE
| D3DPTEXTURECAPS_NONPOW2CONDITIONAL
|
357 D3DPTEXTURECAPS_PROJECTED
| D3DPTEXTURECAPS_CUBEMAP
| D3DPTEXTURECAPS_VOLUMEMAP
|
358 D3DPTEXTURECAPS_MIPMAP
| D3DPTEXTURECAPS_MIPVOLUMEMAP
| D3DPTEXTURECAPS_MIPCUBEMAP
|
359 D3DPTEXTURECAPS_CUBEMAP_POW2
| D3DPTEXTURECAPS_VOLUMEMAP_POW2
| D3DPTEXTURECAPS_NOPROJECTEDBUMPENV
;
361 pCaps
->MaxVertexShaderConst
= min(D3D9_MAX_VERTEX_SHADER_CONSTANTF
, pCaps
->MaxVertexShaderConst
);
362 pCaps
->NumSimultaneousRTs
= min(D3D9_MAX_SIMULTANEOUS_RENDERTARGETS
, pCaps
->NumSimultaneousRTs
);
365 static HRESULT WINAPI
IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface
, UINT Adapter
, D3DDEVTYPE DeviceType
, D3DCAPS9
* pCaps
) {
366 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
367 HRESULT hrc
= D3D_OK
;
368 WINED3DCAPS
*pWineCaps
;
370 TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface
, Adapter
, DeviceType
, pCaps
);
373 return D3DERR_INVALIDCALL
;
375 pWineCaps
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WINED3DCAPS
));
376 if(pWineCaps
== NULL
){
377 return D3DERR_INVALIDCALL
; /*well this is what MSDN says to return*/
379 memset(pCaps
, 0, sizeof(*pCaps
));
381 wined3d_mutex_lock();
382 hrc
= IWineD3D_GetDeviceCaps(This
->WineD3D
, Adapter
, DeviceType
, pWineCaps
);
383 wined3d_mutex_unlock();
385 WINECAPSTOD3D9CAPS(pCaps
, pWineCaps
)
386 HeapFree(GetProcessHeap(), 0, pWineCaps
);
388 /* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */
389 pCaps
->DevCaps2
|= D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES
;
393 TRACE("(%p) returning %p\n", This
, pCaps
);
397 static HMONITOR WINAPI
IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9EX iface
, UINT Adapter
) {
398 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
401 TRACE("iface %p, adapter %u.\n", iface
, Adapter
);
403 wined3d_mutex_lock();
404 ret
= IWineD3D_GetAdapterMonitor(This
->WineD3D
, Adapter
);
405 wined3d_mutex_unlock();
410 static HRESULT WINAPI DECLSPEC_HOTPATCH
IDirect3D9Impl_CreateDevice(IDirect3D9Ex
*iface
, UINT adapter
,
411 D3DDEVTYPE device_type
, HWND focus_window
, DWORD flags
, D3DPRESENT_PARAMETERS
*parameters
,
412 IDirect3DDevice9
**device
)
414 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
415 IDirect3DDevice9Impl
*object
;
418 TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, device %p.\n",
419 iface
, adapter
, device_type
, focus_window
, flags
, parameters
, device
);
421 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
424 ERR("Failed to allocate device memory.\n");
425 return E_OUTOFMEMORY
;
428 hr
= device_init(object
, This
->WineD3D
, adapter
, device_type
, focus_window
, flags
, parameters
, NULL
);
431 WARN("Failed to initialize device, hr %#x.\n", hr
);
432 HeapFree(GetProcessHeap(), 0, object
);
436 TRACE("Created device %p.\n", object
);
437 *device
= (IDirect3DDevice9
*)object
;
442 static UINT WINAPI
IDirect3D9ExImpl_GetAdapterModeCountEx(IDirect3D9Ex
*iface
,
443 UINT adapter
, const D3DDISPLAYMODEFILTER
*filter
)
445 FIXME("iface %p, adapter %u, filter %p stub!\n", iface
, adapter
, filter
);
450 static HRESULT WINAPI
IDirect3D9ExImpl_EnumAdapterModesEx(IDirect3D9Ex
*iface
,
451 UINT adapter
, const D3DDISPLAYMODEFILTER
*filter
, UINT mode_idx
, D3DDISPLAYMODEEX
*mode
)
453 FIXME("iface %p, adapter %u, filter %p, mode_idx %u, mode %p stub!\n",
454 iface
, adapter
, filter
, mode_idx
, mode
);
459 static HRESULT WINAPI
IDirect3D9ExImpl_GetAdapterDisplayModeEx(IDirect3D9Ex
*iface
,
460 UINT adapter
, D3DDISPLAYMODEEX
*mode
, D3DDISPLAYROTATION
*rotation
)
462 FIXME("iface %p, adapter %u, mode %p, rotation %p stub!\n",
463 iface
, adapter
, mode
, rotation
);
468 static HRESULT WINAPI DECLSPEC_HOTPATCH
IDirect3D9ExImpl_CreateDeviceEx(IDirect3D9Ex
*iface
,
469 UINT adapter
, D3DDEVTYPE device_type
, HWND focus_window
, DWORD flags
,
470 D3DPRESENT_PARAMETERS
*parameters
, D3DDISPLAYMODEEX
*mode
, IDirect3DDevice9Ex
**device
)
472 IDirect3D9Impl
*d3d9
= (IDirect3D9Impl
*)iface
;
473 IDirect3DDevice9Impl
*object
;
476 TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, mode %p, device %p.\n",
477 iface
, adapter
, device_type
, focus_window
, flags
, parameters
, mode
, device
);
479 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
482 ERR("Failed to allocate device memory.\n");
483 return E_OUTOFMEMORY
;
486 hr
= device_init(object
, d3d9
->WineD3D
, adapter
, device_type
, focus_window
, flags
, parameters
, mode
);
489 WARN("Failed to initialize device, hr %#x.\n", hr
);
490 HeapFree(GetProcessHeap(), 0, object
);
494 TRACE("Created device %p.\n", object
);
495 *device
= (IDirect3DDevice9Ex
*)object
;
500 static HRESULT WINAPI
IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex
*iface
, UINT adapter
, LUID
*luid
)
502 IDirect3D9Impl
*This
= (IDirect3D9Impl
*)iface
;
503 WINED3DADAPTER_IDENTIFIER adapter_id
;
506 TRACE("iface %p, adapter %u, luid %p.\n", iface
, adapter
, luid
);
508 adapter_id
.driver_size
= 0;
509 adapter_id
.description_size
= 0;
510 adapter_id
.device_name_size
= 0;
512 wined3d_mutex_lock();
513 hr
= IWineD3D_GetAdapterIdentifier(This
->WineD3D
, adapter
, 0, &adapter_id
);
514 wined3d_mutex_unlock();
516 memcpy(luid
, &adapter_id
.adapter_luid
, sizeof(*luid
));
522 const IDirect3D9ExVtbl Direct3D9_Vtbl
=
525 IDirect3D9Impl_QueryInterface
,
526 IDirect3D9Impl_AddRef
,
527 IDirect3D9Impl_Release
,
529 IDirect3D9Impl_RegisterSoftwareDevice
,
530 IDirect3D9Impl_GetAdapterCount
,
531 IDirect3D9Impl_GetAdapterIdentifier
,
532 IDirect3D9Impl_GetAdapterModeCount
,
533 IDirect3D9Impl_EnumAdapterModes
,
534 IDirect3D9Impl_GetAdapterDisplayMode
,
535 IDirect3D9Impl_CheckDeviceType
,
536 IDirect3D9Impl_CheckDeviceFormat
,
537 IDirect3D9Impl_CheckDeviceMultiSampleType
,
538 IDirect3D9Impl_CheckDepthStencilMatch
,
539 IDirect3D9Impl_CheckDeviceFormatConversion
,
540 IDirect3D9Impl_GetDeviceCaps
,
541 IDirect3D9Impl_GetAdapterMonitor
,
542 IDirect3D9Impl_CreateDevice
,
544 IDirect3D9ExImpl_GetAdapterModeCountEx
,
545 IDirect3D9ExImpl_EnumAdapterModesEx
,
546 IDirect3D9ExImpl_GetAdapterDisplayModeEx
,
547 IDirect3D9ExImpl_CreateDeviceEx
,
548 IDirect3D9ExImpl_GetAdapterLUID