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 "wine/port.h"
24 #include "d3d9_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d9
);
28 static inline struct d3d9
*impl_from_IDirect3D9Ex(IDirect3D9Ex
*iface
)
30 return CONTAINING_RECORD(iface
, struct d3d9
, IDirect3D9Ex_iface
);
33 static HRESULT WINAPI
d3d9_QueryInterface(IDirect3D9Ex
*iface
, REFIID riid
, void **out
)
35 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
37 TRACE("iface %p, riid %s, out %p.\n", iface
, debugstr_guid(riid
), out
);
39 if (IsEqualGUID(riid
, &IID_IDirect3D9
)
40 || IsEqualGUID(riid
, &IID_IUnknown
))
42 IDirect3D9Ex_AddRef(&d3d9
->IDirect3D9Ex_iface
);
43 *out
= &d3d9
->IDirect3D9Ex_iface
;
47 if (IsEqualGUID(riid
, &IID_IDirect3D9Ex
))
51 WARN("Application asks for IDirect3D9Ex, but this instance wasn't created with Direct3DCreate9Ex.\n");
56 IDirect3D9Ex_AddRef(&d3d9
->IDirect3D9Ex_iface
);
57 *out
= &d3d9
->IDirect3D9Ex_iface
;
61 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid
));
67 static ULONG WINAPI
d3d9_AddRef(IDirect3D9Ex
*iface
)
69 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
70 ULONG refcount
= InterlockedIncrement(&d3d9
->refcount
);
72 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
77 static ULONG WINAPI
d3d9_Release(IDirect3D9Ex
*iface
)
79 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
80 ULONG refcount
= InterlockedDecrement(&d3d9
->refcount
);
82 TRACE("%p decreasing refcount to %u.\n", iface
, refcount
);
87 wined3d_decref(d3d9
->wined3d
);
88 wined3d_mutex_unlock();
96 static HRESULT WINAPI
d3d9_RegisterSoftwareDevice(IDirect3D9Ex
*iface
, void *init_function
)
98 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
101 TRACE("iface %p, init_function %p.\n", iface
, init_function
);
103 wined3d_mutex_lock();
104 hr
= wined3d_register_software_device(d3d9
->wined3d
, init_function
);
105 wined3d_mutex_unlock();
110 static UINT WINAPI
d3d9_GetAdapterCount(IDirect3D9Ex
*iface
)
112 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
115 TRACE("iface %p.\n", iface
);
117 wined3d_mutex_lock();
118 ret
= wined3d_get_adapter_count(d3d9
->wined3d
);
119 wined3d_mutex_unlock();
124 static HRESULT WINAPI
d3d9_GetAdapterIdentifier(IDirect3D9Ex
*iface
, UINT adapter
,
125 DWORD flags
, D3DADAPTER_IDENTIFIER9
*identifier
)
127 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
128 struct wined3d_adapter_identifier adapter_id
;
131 TRACE("iface %p, adapter %u, flags %#x, identifier %p.\n",
132 iface
, adapter
, flags
, identifier
);
134 adapter_id
.driver
= identifier
->Driver
;
135 adapter_id
.driver_size
= sizeof(identifier
->Driver
);
136 adapter_id
.description
= identifier
->Description
;
137 adapter_id
.description_size
= sizeof(identifier
->Description
);
138 adapter_id
.device_name
= identifier
->DeviceName
;
139 adapter_id
.device_name_size
= sizeof(identifier
->DeviceName
);
141 if (SUCCEEDED(hr
= wined3d_get_adapter_identifier(d3d9
->wined3d
, adapter
, flags
, &adapter_id
)))
143 identifier
->DriverVersion
= adapter_id
.driver_version
;
144 identifier
->VendorId
= adapter_id
.vendor_id
;
145 identifier
->DeviceId
= adapter_id
.device_id
;
146 identifier
->SubSysId
= adapter_id
.subsystem_id
;
147 identifier
->Revision
= adapter_id
.revision
;
148 memcpy(&identifier
->DeviceIdentifier
, &adapter_id
.device_identifier
, sizeof(identifier
->DeviceIdentifier
));
149 identifier
->WHQLLevel
= adapter_id
.whql_level
;
155 static UINT WINAPI
d3d9_GetAdapterModeCount(IDirect3D9Ex
*iface
, UINT adapter
, D3DFORMAT format
)
157 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
160 TRACE("iface %p, adapter %u, format %#x.\n", iface
, adapter
, format
);
162 /* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out. */
163 if (format
!= D3DFMT_X8R8G8B8
&& format
!= D3DFMT_R5G6B5
)
166 wined3d_mutex_lock();
167 ret
= wined3d_get_adapter_mode_count(d3d9
->wined3d
, adapter
,
168 wined3dformat_from_d3dformat(format
), WINED3D_SCANLINE_ORDERING_UNKNOWN
);
169 wined3d_mutex_unlock();
174 static HRESULT WINAPI
d3d9_EnumAdapterModes(IDirect3D9Ex
*iface
, UINT adapter
,
175 D3DFORMAT format
, UINT mode_idx
, D3DDISPLAYMODE
*mode
)
177 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
178 struct wined3d_display_mode wined3d_mode
;
181 TRACE("iface %p, adapter %u, format %#x, mode_idx %u, mode %p.\n",
182 iface
, adapter
, format
, mode_idx
, mode
);
184 if (format
!= D3DFMT_X8R8G8B8
&& format
!= D3DFMT_R5G6B5
)
185 return D3DERR_INVALIDCALL
;
187 wined3d_mutex_lock();
188 hr
= wined3d_enum_adapter_modes(d3d9
->wined3d
, adapter
, wined3dformat_from_d3dformat(format
),
189 WINED3D_SCANLINE_ORDERING_UNKNOWN
, mode_idx
, &wined3d_mode
);
190 wined3d_mutex_unlock();
194 mode
->Width
= wined3d_mode
.width
;
195 mode
->Height
= wined3d_mode
.height
;
196 mode
->RefreshRate
= wined3d_mode
.refresh_rate
;
197 mode
->Format
= d3dformat_from_wined3dformat(wined3d_mode
.format_id
);
203 static HRESULT WINAPI
d3d9_GetAdapterDisplayMode(IDirect3D9Ex
*iface
, UINT adapter
, D3DDISPLAYMODE
*mode
)
205 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
206 struct wined3d_display_mode wined3d_mode
;
209 TRACE("iface %p, adapter %u, mode %p.\n", iface
, adapter
, mode
);
211 wined3d_mutex_lock();
212 hr
= wined3d_get_adapter_display_mode(d3d9
->wined3d
, adapter
, &wined3d_mode
, NULL
);
213 wined3d_mutex_unlock();
217 mode
->Width
= wined3d_mode
.width
;
218 mode
->Height
= wined3d_mode
.height
;
219 mode
->RefreshRate
= wined3d_mode
.refresh_rate
;
220 mode
->Format
= d3dformat_from_wined3dformat(wined3d_mode
.format_id
);
226 static HRESULT WINAPI
d3d9_CheckDeviceType(IDirect3D9Ex
*iface
, UINT adapter
, D3DDEVTYPE device_type
,
227 D3DFORMAT display_format
, D3DFORMAT backbuffer_format
, BOOL windowed
)
229 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
232 TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n",
233 iface
, adapter
, device_type
, display_format
, backbuffer_format
, windowed
);
235 /* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out. */
236 if (!windowed
&& display_format
!= D3DFMT_X8R8G8B8
&& display_format
!= D3DFMT_R5G6B5
)
237 return WINED3DERR_NOTAVAILABLE
;
239 wined3d_mutex_lock();
240 hr
= wined3d_check_device_type(d3d9
->wined3d
, adapter
, device_type
, wined3dformat_from_d3dformat(display_format
),
241 wined3dformat_from_d3dformat(backbuffer_format
), windowed
);
242 wined3d_mutex_unlock();
247 static HRESULT WINAPI
d3d9_CheckDeviceFormat(IDirect3D9Ex
*iface
, UINT adapter
, D3DDEVTYPE device_type
,
248 D3DFORMAT adapter_format
, DWORD usage
, D3DRESOURCETYPE resource_type
, D3DFORMAT format
)
250 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
251 enum wined3d_resource_type wined3d_rtype
;
252 unsigned int bind_flags
;
255 TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
256 iface
, adapter
, device_type
, adapter_format
, usage
, resource_type
, format
);
258 if (adapter_format
!= D3DFMT_X8R8G8B8
&& adapter_format
!= D3DFMT_R5G6B5
259 && adapter_format
!= D3DFMT_X1R5G5B5
)
261 WARN("Invalid adapter format.\n");
262 return adapter_format
? D3DERR_NOTAVAILABLE
: D3DERR_INVALIDCALL
;
265 bind_flags
= wined3d_bind_flags_from_d3d9_usage(usage
);
266 usage
= usage
& (WINED3DUSAGE_MASK
| WINED3DUSAGE_QUERY_MASK
);
267 switch (resource_type
)
269 case D3DRTYPE_CUBETEXTURE
:
270 usage
|= WINED3DUSAGE_LEGACY_CUBEMAP
;
271 case D3DRTYPE_TEXTURE
:
272 bind_flags
|= WINED3D_BIND_SHADER_RESOURCE
;
273 case D3DRTYPE_SURFACE
:
274 wined3d_rtype
= WINED3D_RTYPE_TEXTURE_2D
;
277 case D3DRTYPE_VOLUMETEXTURE
:
278 case D3DRTYPE_VOLUME
:
279 bind_flags
|= WINED3D_BIND_SHADER_RESOURCE
;
280 wined3d_rtype
= WINED3D_RTYPE_TEXTURE_3D
;
283 case D3DRTYPE_VERTEXBUFFER
:
284 case D3DRTYPE_INDEXBUFFER
:
285 wined3d_rtype
= WINED3D_RTYPE_BUFFER
;
289 FIXME("Unhandled resource type %#x.\n", resource_type
);
290 return WINED3DERR_INVALIDCALL
;
293 wined3d_mutex_lock();
294 hr
= wined3d_check_device_format(d3d9
->wined3d
, adapter
, device_type
, wined3dformat_from_d3dformat(adapter_format
),
295 usage
, bind_flags
, wined3d_rtype
, wined3dformat_from_d3dformat(format
));
296 wined3d_mutex_unlock();
301 static HRESULT WINAPI
d3d9_CheckDeviceMultiSampleType(IDirect3D9Ex
*iface
, UINT adapter
, D3DDEVTYPE device_type
,
302 D3DFORMAT format
, BOOL windowed
, D3DMULTISAMPLE_TYPE multisample_type
, DWORD
*levels
)
304 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
307 TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x, levels %p.\n",
308 iface
, adapter
, device_type
, format
, windowed
, multisample_type
, levels
);
310 if (multisample_type
> D3DMULTISAMPLE_16_SAMPLES
)
311 return D3DERR_INVALIDCALL
;
313 wined3d_mutex_lock();
314 hr
= wined3d_check_device_multisample_type(d3d9
->wined3d
, adapter
, device_type
,
315 wined3dformat_from_d3dformat(format
), windowed
, multisample_type
, levels
);
316 wined3d_mutex_unlock();
317 if (hr
== WINED3DERR_NOTAVAILABLE
&& levels
)
323 static HRESULT WINAPI
d3d9_CheckDepthStencilMatch(IDirect3D9Ex
*iface
, UINT adapter
, D3DDEVTYPE device_type
,
324 D3DFORMAT adapter_format
, D3DFORMAT rt_format
, D3DFORMAT ds_format
)
326 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
329 TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n",
330 iface
, adapter
, device_type
, adapter_format
, rt_format
, ds_format
);
332 wined3d_mutex_lock();
333 hr
= wined3d_check_depth_stencil_match(d3d9
->wined3d
, adapter
, device_type
,
334 wined3dformat_from_d3dformat(adapter_format
), wined3dformat_from_d3dformat(rt_format
),
335 wined3dformat_from_d3dformat(ds_format
));
336 wined3d_mutex_unlock();
341 static HRESULT WINAPI
d3d9_CheckDeviceFormatConversion(IDirect3D9Ex
*iface
, UINT adapter
,
342 D3DDEVTYPE device_type
, D3DFORMAT src_format
, D3DFORMAT dst_format
)
344 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
347 TRACE("iface %p, adapter %u, device_type %#x, src_format %#x, dst_format %#x.\n",
348 iface
, adapter
, device_type
, src_format
, dst_format
);
350 wined3d_mutex_lock();
351 hr
= wined3d_check_device_format_conversion(d3d9
->wined3d
, adapter
, device_type
,
352 wined3dformat_from_d3dformat(src_format
), wined3dformat_from_d3dformat(dst_format
));
353 wined3d_mutex_unlock();
358 static HRESULT WINAPI
d3d9_GetDeviceCaps(IDirect3D9Ex
*iface
, UINT adapter
, D3DDEVTYPE device_type
, D3DCAPS9
*caps
)
360 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
361 struct wined3d_caps wined3d_caps
;
364 TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface
, adapter
, device_type
, caps
);
367 return D3DERR_INVALIDCALL
;
369 memset(caps
, 0, sizeof(*caps
));
371 wined3d_mutex_lock();
372 hr
= wined3d_get_device_caps(d3d9
->wined3d
, adapter
, device_type
, &wined3d_caps
);
373 wined3d_mutex_unlock();
375 d3dcaps_from_wined3dcaps(caps
, &wined3d_caps
);
380 static HMONITOR WINAPI
d3d9_GetAdapterMonitor(IDirect3D9Ex
*iface
, UINT adapter
)
382 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
383 struct wined3d_output_desc desc
;
386 TRACE("iface %p, adapter %u.\n", iface
, adapter
);
388 wined3d_mutex_lock();
389 hr
= wined3d_get_output_desc(d3d9
->wined3d
, adapter
, &desc
);
390 wined3d_mutex_unlock();
394 WARN("Failed to get output desc, hr %#x.\n", hr
);
401 static HRESULT WINAPI DECLSPEC_HOTPATCH
d3d9_CreateDevice(IDirect3D9Ex
*iface
, UINT adapter
,
402 D3DDEVTYPE device_type
, HWND focus_window
, DWORD flags
, D3DPRESENT_PARAMETERS
*parameters
,
403 IDirect3DDevice9
**device
)
405 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
406 struct d3d9_device
*object
;
409 TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, device %p.\n",
410 iface
, adapter
, device_type
, focus_window
, flags
, parameters
, device
);
412 if (!(object
= heap_alloc_zero(sizeof(*object
))))
413 return E_OUTOFMEMORY
;
415 hr
= device_init(object
, d3d9
, d3d9
->wined3d
, adapter
, device_type
, focus_window
, flags
, parameters
, NULL
);
418 WARN("Failed to initialize device, hr %#x.\n", hr
);
423 TRACE("Created device %p.\n", object
);
424 *device
= (IDirect3DDevice9
*)&object
->IDirect3DDevice9Ex_iface
;
429 static UINT WINAPI
d3d9_GetAdapterModeCountEx(IDirect3D9Ex
*iface
,
430 UINT adapter
, const D3DDISPLAYMODEFILTER
*filter
)
432 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
435 TRACE("iface %p, adapter %u, filter %p.\n", iface
, adapter
, filter
);
437 if (filter
->Format
!= D3DFMT_X8R8G8B8
&& filter
->Format
!= D3DFMT_R5G6B5
)
440 wined3d_mutex_lock();
441 ret
= wined3d_get_adapter_mode_count(d3d9
->wined3d
, adapter
,
442 wined3dformat_from_d3dformat(filter
->Format
), filter
->ScanLineOrdering
);
443 wined3d_mutex_unlock();
448 static HRESULT WINAPI
d3d9_EnumAdapterModesEx(IDirect3D9Ex
*iface
,
449 UINT adapter
, const D3DDISPLAYMODEFILTER
*filter
, UINT mode_idx
, D3DDISPLAYMODEEX
*mode
)
451 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
452 struct wined3d_display_mode wined3d_mode
;
455 TRACE("iface %p, adapter %u, filter %p, mode_idx %u, mode %p.\n",
456 iface
, adapter
, filter
, mode_idx
, mode
);
458 if (filter
->Format
!= D3DFMT_X8R8G8B8
&& filter
->Format
!= D3DFMT_R5G6B5
)
459 return D3DERR_INVALIDCALL
;
461 wined3d_mutex_lock();
462 hr
= wined3d_enum_adapter_modes(d3d9
->wined3d
, adapter
, wined3dformat_from_d3dformat(filter
->Format
),
463 filter
->ScanLineOrdering
, mode_idx
, &wined3d_mode
);
464 wined3d_mutex_unlock();
468 mode
->Width
= wined3d_mode
.width
;
469 mode
->Height
= wined3d_mode
.height
;
470 mode
->RefreshRate
= wined3d_mode
.refresh_rate
;
471 mode
->Format
= d3dformat_from_wined3dformat(wined3d_mode
.format_id
);
472 mode
->ScanLineOrdering
= wined3d_mode
.scanline_ordering
;
478 static HRESULT WINAPI
d3d9_GetAdapterDisplayModeEx(IDirect3D9Ex
*iface
,
479 UINT adapter
, D3DDISPLAYMODEEX
*mode
, D3DDISPLAYROTATION
*rotation
)
481 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
482 struct wined3d_display_mode wined3d_mode
;
485 TRACE("iface %p, adapter %u, mode %p, rotation %p.\n",
486 iface
, adapter
, mode
, rotation
);
488 if (mode
->Size
!= sizeof(*mode
))
489 return D3DERR_INVALIDCALL
;
491 wined3d_mutex_lock();
492 hr
= wined3d_get_adapter_display_mode(d3d9
->wined3d
, adapter
, &wined3d_mode
,
493 (enum wined3d_display_rotation
*)rotation
);
494 wined3d_mutex_unlock();
498 mode
->Width
= wined3d_mode
.width
;
499 mode
->Height
= wined3d_mode
.height
;
500 mode
->RefreshRate
= wined3d_mode
.refresh_rate
;
501 mode
->Format
= d3dformat_from_wined3dformat(wined3d_mode
.format_id
);
502 mode
->ScanLineOrdering
= wined3d_mode
.scanline_ordering
;
508 static HRESULT WINAPI DECLSPEC_HOTPATCH
d3d9_CreateDeviceEx(IDirect3D9Ex
*iface
,
509 UINT adapter
, D3DDEVTYPE device_type
, HWND focus_window
, DWORD flags
,
510 D3DPRESENT_PARAMETERS
*parameters
, D3DDISPLAYMODEEX
*mode
, IDirect3DDevice9Ex
**device
)
512 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
513 struct d3d9_device
*object
;
516 TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, mode %p, device %p.\n",
517 iface
, adapter
, device_type
, focus_window
, flags
, parameters
, mode
, device
);
519 if (!(object
= heap_alloc_zero(sizeof(*object
))))
520 return E_OUTOFMEMORY
;
522 hr
= device_init(object
, d3d9
, d3d9
->wined3d
, adapter
, device_type
, focus_window
, flags
, parameters
, mode
);
525 WARN("Failed to initialize device, hr %#x.\n", hr
);
530 TRACE("Created device %p.\n", object
);
531 *device
= &object
->IDirect3DDevice9Ex_iface
;
536 static HRESULT WINAPI
d3d9_GetAdapterLUID(IDirect3D9Ex
*iface
, UINT adapter
, LUID
*luid
)
538 struct d3d9
*d3d9
= impl_from_IDirect3D9Ex(iface
);
539 struct wined3d_adapter_identifier adapter_id
;
542 TRACE("iface %p, adapter %u, luid %p.\n", iface
, adapter
, luid
);
544 adapter_id
.driver_size
= 0;
545 adapter_id
.description_size
= 0;
546 adapter_id
.device_name_size
= 0;
548 if (SUCCEEDED(hr
= wined3d_get_adapter_identifier(d3d9
->wined3d
, adapter
, 0, &adapter_id
)))
549 *luid
= adapter_id
.adapter_luid
;
554 static const struct IDirect3D9ExVtbl d3d9_vtbl
=
561 d3d9_RegisterSoftwareDevice
,
562 d3d9_GetAdapterCount
,
563 d3d9_GetAdapterIdentifier
,
564 d3d9_GetAdapterModeCount
,
565 d3d9_EnumAdapterModes
,
566 d3d9_GetAdapterDisplayMode
,
567 d3d9_CheckDeviceType
,
568 d3d9_CheckDeviceFormat
,
569 d3d9_CheckDeviceMultiSampleType
,
570 d3d9_CheckDepthStencilMatch
,
571 d3d9_CheckDeviceFormatConversion
,
573 d3d9_GetAdapterMonitor
,
576 d3d9_GetAdapterModeCountEx
,
577 d3d9_EnumAdapterModesEx
,
578 d3d9_GetAdapterDisplayModeEx
,
583 BOOL
d3d9_init(struct d3d9
*d3d9
, BOOL extended
)
585 DWORD flags
= WINED3D_PRESENT_CONVERSION
| WINED3D_HANDLE_RESTORE
| WINED3D_PIXEL_CENTER_INTEGER
586 | WINED3D_SRGB_READ_WRITE_CONTROL
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
587 | WINED3D_NO_PRIMITIVE_RESTART
| WINED3D_LEGACY_CUBEMAP_FILTERING
588 | WINED3D_NORMALIZED_DEPTH_BIAS
;
591 flags
|= WINED3D_VIDMEM_ACCOUNTING
;
593 flags
|= WINED3D_RESTORE_MODE_ON_ACTIVATE
;
595 d3d9
->IDirect3D9Ex_iface
.lpVtbl
= &d3d9_vtbl
;
598 wined3d_mutex_lock();
599 d3d9
->wined3d
= wined3d_create(flags
);
600 wined3d_mutex_unlock();
603 d3d9
->extended
= extended
;