ReactOS 0.4.15-dev-8241-g63935f8
directx.c File Reference
#include "config.h"
#include "d3d9_private.h"
Include dependency graph for directx.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d9)
 
static struct d3d9impl_from_IDirect3D9Ex (IDirect3D9Ex *iface)
 
static HRESULT WINAPI d3d9_QueryInterface (IDirect3D9Ex *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d9_AddRef (IDirect3D9Ex *iface)
 
static ULONG WINAPI d3d9_Release (IDirect3D9Ex *iface)
 
static HRESULT WINAPI d3d9_RegisterSoftwareDevice (IDirect3D9Ex *iface, void *init_function)
 
static UINT WINAPI d3d9_GetAdapterCount (IDirect3D9Ex *iface)
 
static HRESULT WINAPI d3d9_GetAdapterIdentifier (IDirect3D9Ex *iface, UINT adapter, DWORD flags, D3DADAPTER_IDENTIFIER9 *identifier)
 
static UINT WINAPI d3d9_GetAdapterModeCount (IDirect3D9Ex *iface, UINT adapter, D3DFORMAT format)
 
static HRESULT WINAPI d3d9_EnumAdapterModes (IDirect3D9Ex *iface, UINT adapter, D3DFORMAT format, UINT mode_idx, D3DDISPLAYMODE *mode)
 
static HRESULT WINAPI d3d9_GetAdapterDisplayMode (IDirect3D9Ex *iface, UINT adapter, D3DDISPLAYMODE *mode)
 
static HRESULT WINAPI d3d9_CheckDeviceType (IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT display_format, D3DFORMAT backbuffer_format, BOOL windowed)
 
static HRESULT WINAPI d3d9_CheckDeviceFormat (IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT adapter_format, DWORD usage, D3DRESOURCETYPE resource_type, D3DFORMAT format)
 
static HRESULT WINAPI d3d9_CheckDeviceMultiSampleType (IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT format, BOOL windowed, D3DMULTISAMPLE_TYPE multisample_type, DWORD *levels)
 
static HRESULT WINAPI d3d9_CheckDepthStencilMatch (IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT adapter_format, D3DFORMAT rt_format, D3DFORMAT ds_format)
 
static HRESULT WINAPI d3d9_CheckDeviceFormatConversion (IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT src_format, D3DFORMAT dst_format)
 
static HRESULT WINAPI d3d9_GetDeviceCaps (IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS9 *caps)
 
static HMONITOR WINAPI d3d9_GetAdapterMonitor (IDirect3D9Ex *iface, UINT adapter)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice (IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, IDirect3DDevice9 **device)
 
static UINT WINAPI d3d9_GetAdapterModeCountEx (IDirect3D9Ex *iface, UINT adapter, const D3DDISPLAYMODEFILTER *filter)
 
static HRESULT WINAPI d3d9_EnumAdapterModesEx (IDirect3D9Ex *iface, UINT adapter, const D3DDISPLAYMODEFILTER *filter, UINT mode_idx, D3DDISPLAYMODEEX *mode)
 
static HRESULT WINAPI d3d9_GetAdapterDisplayModeEx (IDirect3D9Ex *iface, UINT adapter, D3DDISPLAYMODEEX *mode, D3DDISPLAYROTATION *rotation)
 
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDeviceEx (IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode, IDirect3DDevice9Ex **device)
 
static HRESULT WINAPI d3d9_GetAdapterLUID (IDirect3D9Ex *iface, UINT adapter, LUID *luid)
 
BOOL d3d9_init (struct d3d9 *d3d9, BOOL extended)
 

Variables

static const struct IDirect3D9ExVtbl d3d9_vtbl
 

Function Documentation

◆ d3d9_AddRef()

static ULONG WINAPI d3d9_AddRef ( IDirect3D9Ex *  iface)
static

Definition at line 66 of file directx.c.

67{
68 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
70
71 TRACE("%p increasing refcount to %u.\n", iface, refcount);
72
73 return refcount;
74}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3d9 * impl_from_IDirect3D9Ex(IDirect3D9Ex *iface)
Definition: directx.c:27
#define TRACE(s)
Definition: solgame.cpp:4
LONG refcount
Definition: d3d9_private.h:64
uint32_t ULONG
Definition: typedefs.h:59

◆ d3d9_CheckDepthStencilMatch()

static HRESULT WINAPI d3d9_CheckDepthStencilMatch ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDEVTYPE  device_type,
D3DFORMAT  adapter_format,
D3DFORMAT  rt_format,
D3DFORMAT  ds_format 
)
static

Definition at line 314 of file directx.c.

316{
317 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
318 HRESULT hr;
319
320 TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n",
321 iface, adapter, device_type, adapter_format, rt_format, ds_format);
322
328
329 return hr;
330}
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: device.c:94
device_type
return adapter
HRESULT hr
Definition: shlfolder.c:183
struct wined3d * wined3d
Definition: d3d9_private.h:65
HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id)
Definition: directx.c:5091
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368

◆ d3d9_CheckDeviceFormat()

static HRESULT WINAPI d3d9_CheckDeviceFormat ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDEVTYPE  device_type,
D3DFORMAT  adapter_format,
DWORD  usage,
D3DRESOURCETYPE  resource_type,
D3DFORMAT  format 
)
static

Definition at line 247 of file directx.c.

249{
250 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
251 enum wined3d_resource_type wined3d_rtype;
252 HRESULT hr;
253
254 TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
255 iface, adapter, device_type, adapter_format, usage, resource_type, format);
256
258 switch (resource_type)
259 {
262 case D3DRTYPE_TEXTURE:
264 case D3DRTYPE_SURFACE:
265 wined3d_rtype = WINED3D_RTYPE_TEXTURE_2D;
266 break;
267
269 case D3DRTYPE_VOLUME:
271 wined3d_rtype = WINED3D_RTYPE_TEXTURE_3D;
272 break;
273
276 wined3d_rtype = WINED3D_RTYPE_BUFFER;
277 break;
278
279 default:
280 FIXME("Unhandled resource type %#x.\n", resource_type);
282 }
283
286 usage, wined3d_rtype, wined3dformat_from_d3dformat(format));
288
289 return hr;
290}
#define FIXME(fmt,...)
Definition: debug.h:114
@ D3DRTYPE_INDEXBUFFER
Definition: d3d8types.h:816
@ D3DRTYPE_TEXTURE
Definition: d3d8types.h:812
@ D3DRTYPE_VOLUMETEXTURE
Definition: d3d8types.h:813
@ D3DRTYPE_CUBETEXTURE
Definition: d3d8types.h:814
@ D3DRTYPE_VOLUME
Definition: d3d8types.h:811
@ D3DRTYPE_SURFACE
Definition: d3d8types.h:810
@ D3DRTYPE_VERTEXBUFFER
Definition: d3d8types.h:815
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
Definition: directx.c:5334
#define WINED3DUSAGE_QUERY_MASK
Definition: wined3d.h:931
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:917
wined3d_resource_type
Definition: wined3d.h:696
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:700
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:698
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:701
#define WINED3DUSAGE_MASK
Definition: wined3d.h:913
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
#define WINED3DUSAGE_TEXTURE
Definition: wined3d.h:918

◆ d3d9_CheckDeviceFormatConversion()

static HRESULT WINAPI d3d9_CheckDeviceFormatConversion ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDEVTYPE  device_type,
D3DFORMAT  src_format,
D3DFORMAT  dst_format 
)
static

Definition at line 332 of file directx.c.

334{
335 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
336 HRESULT hr;
337
338 TRACE("iface %p, adapter %u, device_type %#x, src_format %#x, dst_format %#x.\n",
339 iface, adapter, device_type, src_format, dst_format);
340
345
346 return hr;
347}
static const char * dst_format
Definition: dib.c:1133
HRESULT CDECL wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id src_format, enum wined3d_format_id dst_format)
Definition: directx.c:5536

◆ d3d9_CheckDeviceMultiSampleType()

static HRESULT WINAPI d3d9_CheckDeviceMultiSampleType ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDEVTYPE  device_type,
D3DFORMAT  format,
BOOL  windowed,
D3DMULTISAMPLE_TYPE  multisample_type,
DWORD levels 
)
static

Definition at line 292 of file directx.c.

294{
295 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
296 HRESULT hr;
297
298 TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x, levels %p.\n",
299 iface, adapter, device_type, format, windowed, multisample_type, levels);
300
301 if (multisample_type > D3DMULTISAMPLE_16_SAMPLES)
302 return D3DERR_INVALIDCALL;
303
306 wined3dformat_from_d3dformat(format), windowed, multisample_type, levels);
309 *levels = 1;
310
311 return hr;
312}
@ D3DMULTISAMPLE_16_SAMPLES
Definition: d3d8types.h:687
#define D3DERR_INVALIDCALL
GLsizei levels
Definition: glext.h:7884
HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed, enum wined3d_multisample_type multisample_type, DWORD *quality_levels)
Definition: directx.c:5145
#define WINED3DERR_NOTAVAILABLE
Definition: wined3d.h:46

◆ d3d9_CheckDeviceType()

static HRESULT WINAPI d3d9_CheckDeviceType ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDEVTYPE  device_type,
D3DFORMAT  display_format,
D3DFORMAT  backbuffer_format,
BOOL  windowed 
)
static

Definition at line 226 of file directx.c.

228{
229 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
230 HRESULT hr;
231
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);
234
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)
238
241 wined3dformat_from_d3dformat(backbuffer_format), windowed);
243
244 return hr;
245}
@ D3DFMT_R5G6B5
Definition: d3d8types.h:606
@ D3DFMT_X8R8G8B8
Definition: d3d8types.h:605
HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id display_format, enum wined3d_format_id backbuffer_format, BOOL windowed)
Definition: directx.c:5546

◆ d3d9_CreateDevice()

static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDEVTYPE  device_type,
HWND  focus_window,
DWORD  flags,
D3DPRESENT_PARAMETERS parameters,
IDirect3DDevice9 **  device 
)
static

Definition at line 392 of file directx.c.

395{
396 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
397 struct d3d9_device *object;
398 HRESULT hr;
399
400 TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, device %p.\n",
401 iface, adapter, device_type, focus_window, flags, parameters, device);
402
403 if (!(object = heap_alloc_zero(sizeof(*object))))
404 return E_OUTOFMEMORY;
405
406 hr = device_init(object, d3d9, d3d9->wined3d, adapter, device_type, focus_window, flags, parameters, NULL);
407 if (FAILED(hr))
408 {
409 WARN("Failed to initialize device, hr %#x.\n", hr);
410 heap_free(object);
411 return hr;
412 }
413
414 TRACE("Created device %p.\n", object);
415 *device = (IDirect3DDevice9 *)&object->IDirect3DDevice9Ex_iface;
416
417 return D3D_OK;
418}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define WARN(fmt,...)
Definition: debug.h:115
HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN
Definition: device.c:3279
#define D3D_OK
Definition: d3d.h:106
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
GLbitfield flags
Definition: glext.h:7161
#define FAILED(hr)
Definition: intsafe.h:51
Definition: devices.h:37

◆ d3d9_CreateDeviceEx()

static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDeviceEx ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDEVTYPE  device_type,
HWND  focus_window,
DWORD  flags,
D3DPRESENT_PARAMETERS parameters,
D3DDISPLAYMODEEX mode,
IDirect3DDevice9Ex **  device 
)
static

Definition at line 499 of file directx.c.

502{
503 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
504 struct d3d9_device *object;
505 HRESULT hr;
506
507 TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, mode %p, device %p.\n",
508 iface, adapter, device_type, focus_window, flags, parameters, mode, device);
509
510 if (!(object = heap_alloc_zero(sizeof(*object))))
511 return E_OUTOFMEMORY;
512
513 hr = device_init(object, d3d9, d3d9->wined3d, adapter, device_type, focus_window, flags, parameters, mode);
514 if (FAILED(hr))
515 {
516 WARN("Failed to initialize device, hr %#x.\n", hr);
517 heap_free(object);
518 return hr;
519 }
520
521 TRACE("Created device %p.\n", object);
522 *device = &object->IDirect3DDevice9Ex_iface;
523
524 return D3D_OK;
525}
GLenum mode
Definition: glext.h:6217

◆ d3d9_EnumAdapterModes()

static HRESULT WINAPI d3d9_EnumAdapterModes ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DFORMAT  format,
UINT  mode_idx,
D3DDISPLAYMODE mode 
)
static

Definition at line 174 of file directx.c.

176{
177 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
178 struct wined3d_display_mode wined3d_mode;
179 HRESULT hr;
180
181 TRACE("iface %p, adapter %u, format %#x, mode_idx %u, mode %p.\n",
182 iface, adapter, format, mode_idx, mode);
183
185 return D3DERR_INVALIDCALL;
186
189 WINED3D_SCANLINE_ORDERING_UNKNOWN, mode_idx, &wined3d_mode);
191
192 if (SUCCEEDED(hr))
193 {
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);
198 }
199
200 return hr;
201}
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN
Definition: device.c:44
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering, UINT mode_idx, struct wined3d_display_mode *mode)
Definition: directx.c:4589
@ WINED3D_SCANLINE_ORDERING_UNKNOWN
Definition: wined3d.h:832

◆ d3d9_EnumAdapterModesEx()

static HRESULT WINAPI d3d9_EnumAdapterModesEx ( IDirect3D9Ex *  iface,
UINT  adapter,
const D3DDISPLAYMODEFILTER filter,
UINT  mode_idx,
D3DDISPLAYMODEEX mode 
)
static

Definition at line 439 of file directx.c.

441{
442 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
443 struct wined3d_display_mode wined3d_mode;
444 HRESULT hr;
445
446 TRACE("iface %p, adapter %u, filter %p, mode_idx %u, mode %p.\n",
447 iface, adapter, filter, mode_idx, mode);
448
449 if (filter->Format != D3DFMT_X8R8G8B8 && filter->Format != D3DFMT_R5G6B5)
450 return D3DERR_INVALIDCALL;
451
454 filter->ScanLineOrdering, mode_idx, &wined3d_mode);
456
457 if (SUCCEEDED(hr))
458 {
459 mode->Width = wined3d_mode.width;
460 mode->Height = wined3d_mode.height;
461 mode->RefreshRate = wined3d_mode.refresh_rate;
462 mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
463 mode->ScanLineOrdering = wined3d_mode.scanline_ordering;
464 }
465
466 return hr;
467}
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

◆ d3d9_GetAdapterCount()

static UINT WINAPI d3d9_GetAdapterCount ( IDirect3D9Ex *  iface)
static

Definition at line 109 of file directx.c.

110{
111 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
112 UINT ret;
113
114 TRACE("iface %p.\n", iface);
115
119
120 return ret;
121}
unsigned int UINT
Definition: ndis.h:50
int ret
UINT CDECL wined3d_get_adapter_count(const struct wined3d *wined3d)
Definition: directx.c:4484

◆ d3d9_GetAdapterDisplayMode()

static HRESULT WINAPI d3d9_GetAdapterDisplayMode ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDISPLAYMODE mode 
)
static

Definition at line 203 of file directx.c.

204{
205 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
206 struct wined3d_display_mode wined3d_mode;
207 HRESULT hr;
208
209 TRACE("iface %p, adapter %u, mode %p.\n", iface, adapter, mode);
210
214
215 if (SUCCEEDED(hr))
216 {
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);
221 }
222
223 return hr;
224}
HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation)
Definition: directx.c:4767

◆ d3d9_GetAdapterDisplayModeEx()

static HRESULT WINAPI d3d9_GetAdapterDisplayModeEx ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDISPLAYMODEEX mode,
D3DDISPLAYROTATION rotation 
)
static

Definition at line 469 of file directx.c.

471{
472 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
473 struct wined3d_display_mode wined3d_mode;
474 HRESULT hr;
475
476 TRACE("iface %p, adapter %u, mode %p, rotation %p.\n",
477 iface, adapter, mode, rotation);
478
479 if (mode->Size != sizeof(*mode))
480 return D3DERR_INVALIDCALL;
481
484 (enum wined3d_display_rotation *)rotation);
486
487 if (SUCCEEDED(hr))
488 {
489 mode->Width = wined3d_mode.width;
490 mode->Height = wined3d_mode.height;
491 mode->RefreshRate = wined3d_mode.refresh_rate;
492 mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
493 mode->ScanLineOrdering = wined3d_mode.scanline_ordering;
494 }
495
496 return hr;
497}
wined3d_display_rotation
Definition: wined3d.h:838

◆ d3d9_GetAdapterIdentifier()

static HRESULT WINAPI d3d9_GetAdapterIdentifier ( IDirect3D9Ex *  iface,
UINT  adapter,
DWORD  flags,
D3DADAPTER_IDENTIFIER9 identifier 
)
static

Definition at line 123 of file directx.c.

125{
126 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
127 struct wined3d_adapter_identifier adapter_id;
128 HRESULT hr;
129
130 TRACE("iface %p, adapter %u, flags %#x, identifier %p.\n",
131 iface, adapter, flags, identifier);
132
133 adapter_id.driver = identifier->Driver;
134 adapter_id.driver_size = sizeof(identifier->Driver);
135 adapter_id.description = identifier->Description;
136 adapter_id.description_size = sizeof(identifier->Description);
137 adapter_id.device_name = identifier->DeviceName;
138 adapter_id.device_name_size = sizeof(identifier->DeviceName);
139
143
144 identifier->DriverVersion = adapter_id.driver_version;
145 identifier->VendorId = adapter_id.vendor_id;
146 identifier->DeviceId = adapter_id.device_id;
147 identifier->SubSysId = adapter_id.subsystem_id;
148 identifier->Revision = adapter_id.revision;
149 memcpy(&identifier->DeviceIdentifier, &adapter_id.device_identifier, sizeof(identifier->DeviceIdentifier));
150 identifier->WHQLLevel = adapter_id.whql_level;
151
152 return hr;
153}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
char Driver[MAX_DEVICE_IDENTIFIER_STRING]
Definition: d3d9types.h:1229
char Description[MAX_DEVICE_IDENTIFIER_STRING]
Definition: d3d9types.h:1230
LARGE_INTEGER DriverVersion
Definition: d3d9types.h:1232
HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx, DWORD flags, struct wined3d_adapter_identifier *identifier)
Definition: directx.c:4939

◆ d3d9_GetAdapterLUID()

static HRESULT WINAPI d3d9_GetAdapterLUID ( IDirect3D9Ex *  iface,
UINT  adapter,
LUID luid 
)
static

Definition at line 527 of file directx.c.

528{
529 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
530 struct wined3d_adapter_identifier adapter_id;
531 HRESULT hr;
532
533 TRACE("iface %p, adapter %u, luid %p.\n", iface, adapter, luid);
534
535 adapter_id.driver_size = 0;
536 adapter_id.description_size = 0;
537 adapter_id.device_name_size = 0;
538
542
543 memcpy(luid, &adapter_id.adapter_luid, sizeof(*luid));
544
545 return hr;
546}

◆ d3d9_GetAdapterModeCount()

static UINT WINAPI d3d9_GetAdapterModeCount ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DFORMAT  format 
)
static

Definition at line 155 of file directx.c.

156{
157 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
158 UINT ret;
159
160 TRACE("iface %p, adapter %u, format %#x.\n", iface, adapter, format);
161
162 /* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out. */
164 return 0;
165
170
171 return ret;
172}
UINT CDECL wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering)
Definition: directx.c:4536

◆ d3d9_GetAdapterModeCountEx()

static UINT WINAPI d3d9_GetAdapterModeCountEx ( IDirect3D9Ex *  iface,
UINT  adapter,
const D3DDISPLAYMODEFILTER filter 
)
static

Definition at line 420 of file directx.c.

422{
423 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
424 UINT ret;
425
426 TRACE("iface %p, adapter %u, filter %p.\n", iface, adapter, filter);
427
428 if (filter->Format != D3DFMT_X8R8G8B8 && filter->Format != D3DFMT_R5G6B5)
429 return 0;
430
433 wined3dformat_from_d3dformat(filter->Format), filter->ScanLineOrdering);
435
436 return ret;
437}

◆ d3d9_GetAdapterMonitor()

static HMONITOR WINAPI d3d9_GetAdapterMonitor ( IDirect3D9Ex *  iface,
UINT  adapter 
)
static

Definition at line 371 of file directx.c.

372{
373 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
375 HRESULT hr;
376
377 TRACE("iface %p, adapter %u.\n", iface, adapter);
378
382
383 if (FAILED(hr))
384 {
385 WARN("Failed to get output desc, hr %#x.\n", hr);
386 return NULL;
387 }
388
389 return desc.monitor;
390}
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT CDECL wined3d_get_output_desc(const struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_output_desc *desc)
Definition: directx.c:4499

◆ d3d9_GetDeviceCaps()

static HRESULT WINAPI d3d9_GetDeviceCaps ( IDirect3D9Ex *  iface,
UINT  adapter,
D3DDEVTYPE  device_type,
D3DCAPS9 caps 
)
static

Definition at line 349 of file directx.c.

350{
351 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
352 WINED3DCAPS wined3d_caps;
353 HRESULT hr;
354
355 TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps);
356
357 if (!caps)
358 return D3DERR_INVALIDCALL;
359
360 memset(caps, 0, sizeof(*caps));
361
365
366 d3dcaps_from_wined3dcaps(caps, &wined3d_caps);
367
368 return hr;
369}
void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN
Definition: device.c:290
#define memset(x, y, z)
Definition: compat.h:39
HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, WINED3DCAPS *caps)
Definition: directx.c:5659

◆ d3d9_init()

BOOL d3d9_init ( struct d3d9 d3d9,
BOOL  extended 
)

Definition at line 577 of file directx.c.

578{
583
584 if (!extended)
586 else
588
590 d3d9->refcount = 1;
591
595 if (!d3d9->wined3d)
596 return FALSE;
597 d3d9->extended = extended;
598
599 return TRUE;
600}
static const struct IDirect3D9ExVtbl d3d9_vtbl
Definition: directx.c:548
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL extended
Definition: d3d9_private.h:66
IDirect3D9Ex IDirect3D9Ex_iface
Definition: d3d9_private.h:63
#define WINED3D_RESTORE_MODE_ON_ACTIVATE
Definition: wined3d.h:1319
#define WINED3D_NORMALIZED_DEPTH_BIAS
Definition: wined3d.h:1328
#define WINED3D_LIMIT_VIEWPORT
Definition: wined3d.h:1330
#define WINED3D_VIDMEM_ACCOUNTING
Definition: wined3d.h:1317
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1325
#define WINED3D_HANDLE_RESTORE
Definition: wined3d.h:1321
#define WINED3D_NO_PRIMITIVE_RESTART
Definition: wined3d.h:1326
#define WINED3D_PRESENT_CONVERSION
Definition: wined3d.h:1318
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1322
#define WINED3D_SRGB_READ_WRITE_CONTROL
Definition: wined3d.h:1324
#define WINED3D_LEGACY_CUBEMAP_FILTERING
Definition: wined3d.h:1327
struct wined3d *CDECL wined3d_create(DWORD flags)
Definition: wined3d_main.c:97

Referenced by Direct3DCreate9(), and Direct3DCreate9Ex().

◆ d3d9_QueryInterface()

static HRESULT WINAPI d3d9_QueryInterface ( IDirect3D9Ex *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 32 of file directx.c.

33{
34 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
35
36 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
37
38 if (IsEqualGUID(riid, &IID_IDirect3D9)
40 {
43 return S_OK;
44 }
45
46 if (IsEqualGUID(riid, &IID_IDirect3D9Ex))
47 {
48 if (!d3d9->extended)
49 {
50 WARN("Application asks for IDirect3D9Ex, but this instance wasn't created with Direct3DCreate9Ex.\n");
51 *out = NULL;
52 return E_NOINTERFACE;
53 }
54
57 return S_OK;
58 }
59
60 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
61
62 *out = NULL;
63 return E_NOINTERFACE;
64}
const GUID IID_IUnknown
#define IDirect3D9Ex_AddRef(p)
Definition: d3d9.h:308
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static FILE * out
Definition: regtests2xml.c:44
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ d3d9_RegisterSoftwareDevice()

static HRESULT WINAPI d3d9_RegisterSoftwareDevice ( IDirect3D9Ex *  iface,
void init_function 
)
static

Definition at line 95 of file directx.c.

96{
97 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
98 HRESULT hr;
99
100 TRACE("iface %p, init_function %p.\n", iface, init_function);
101
105
106 return hr;
107}
HRESULT CDECL wined3d_register_software_device(struct wined3d *wined3d, void *init_function)
Definition: directx.c:4492

◆ d3d9_Release()

static ULONG WINAPI d3d9_Release ( IDirect3D9Ex *  iface)
static

Definition at line 76 of file directx.c.

77{
78 struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
80
81 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
82
83 if (!refcount)
84 {
88
90 }
91
92 return refcount;
93}
#define InterlockedDecrement
Definition: armddk.h:52
ULONG CDECL wined3d_decref(struct wined3d *wined3d)
Definition: directx.c:465

◆ impl_from_IDirect3D9Ex()

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d9  )

Variable Documentation

◆ d3d9_vtbl

const struct IDirect3D9ExVtbl d3d9_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, IDirect3DDevice9 **device)
Definition: directx.c:392
static HRESULT WINAPI d3d9_GetAdapterDisplayModeEx(IDirect3D9Ex *iface, UINT adapter, D3DDISPLAYMODEEX *mode, D3DDISPLAYROTATION *rotation)
Definition: directx.c:469
static UINT WINAPI d3d9_GetAdapterModeCount(IDirect3D9Ex *iface, UINT adapter, D3DFORMAT format)
Definition: directx.c:155
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDeviceEx(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode, IDirect3DDevice9Ex **device)
Definition: directx.c:499
static HRESULT WINAPI d3d9_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUID *luid)
Definition: directx.c:527
static HRESULT WINAPI d3d9_EnumAdapterModes(IDirect3D9Ex *iface, UINT adapter, D3DFORMAT format, UINT mode_idx, D3DDISPLAYMODE *mode)
Definition: directx.c:174
static UINT WINAPI d3d9_GetAdapterCount(IDirect3D9Ex *iface)
Definition: directx.c:109
static HRESULT WINAPI d3d9_CheckDeviceType(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT display_format, D3DFORMAT backbuffer_format, BOOL windowed)
Definition: directx.c:226
static HMONITOR WINAPI d3d9_GetAdapterMonitor(IDirect3D9Ex *iface, UINT adapter)
Definition: directx.c:371
static UINT WINAPI d3d9_GetAdapterModeCountEx(IDirect3D9Ex *iface, UINT adapter, const D3DDISPLAYMODEFILTER *filter)
Definition: directx.c:420
static HRESULT WINAPI d3d9_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT format, BOOL windowed, D3DMULTISAMPLE_TYPE multisample_type, DWORD *levels)
Definition: directx.c:292
static ULONG WINAPI d3d9_Release(IDirect3D9Ex *iface)
Definition: directx.c:76
static HRESULT WINAPI d3d9_QueryInterface(IDirect3D9Ex *iface, REFIID riid, void **out)
Definition: directx.c:32
static HRESULT WINAPI d3d9_EnumAdapterModesEx(IDirect3D9Ex *iface, UINT adapter, const D3DDISPLAYMODEFILTER *filter, UINT mode_idx, D3DDISPLAYMODEEX *mode)
Definition: directx.c:439
static ULONG WINAPI d3d9_AddRef(IDirect3D9Ex *iface)
Definition: directx.c:66
static HRESULT WINAPI d3d9_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT src_format, D3DFORMAT dst_format)
Definition: directx.c:332
static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT adapter_format, DWORD usage, D3DRESOURCETYPE resource_type, D3DFORMAT format)
Definition: directx.c:247
static HRESULT WINAPI d3d9_RegisterSoftwareDevice(IDirect3D9Ex *iface, void *init_function)
Definition: directx.c:95
static HRESULT WINAPI d3d9_GetAdapterIdentifier(IDirect3D9Ex *iface, UINT adapter, DWORD flags, D3DADAPTER_IDENTIFIER9 *identifier)
Definition: directx.c:123
static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS9 *caps)
Definition: directx.c:349
static HRESULT WINAPI d3d9_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DFORMAT adapter_format, D3DFORMAT rt_format, D3DFORMAT ds_format)
Definition: directx.c:314
static HRESULT WINAPI d3d9_GetAdapterDisplayMode(IDirect3D9Ex *iface, UINT adapter, D3DDISPLAYMODE *mode)
Definition: directx.c:203

Definition at line 548 of file directx.c.

Referenced by d3d9_init().