[PATCH 3/4] d3d9: Partially implement IDirect3D9Ex::CreateDeviceEx().
Henri Verbeet
hverbeet at codeweavers.com
Wed Oct 27 04:36:16 CDT 2010
---
dlls/d3d9/d3d9_private.h | 2 +-
dlls/d3d9/device.c | 5 ++++-
dlls/d3d9/directx.c | 32 +++++++++++++++++++++++++-------
3 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index f1bc1a0..02f9c20 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -181,7 +181,7 @@ typedef struct IDirect3DDevice9Impl
} IDirect3DDevice9Impl;
HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type,
- HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN;
+ HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) DECLSPEC_HIDDEN;
/*****************************************************************************
* IDirect3DVolume9 implementation structure
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index c788b98..349bde4 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3242,12 +3242,15 @@ static void setup_fpu(void)
}
HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type,
- HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters)
+ HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode)
{
WINED3DPRESENT_PARAMETERS *wined3d_parameters;
UINT i, count = 1;
HRESULT hr;
+ if (mode)
+ FIXME("Ignoring display mode.\n");
+
device->lpVtbl = &Direct3DDevice9_Vtbl;
device->device_parent_vtbl = &d3d9_wined3d_device_parent_vtbl;
device->ref = 1;
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
index 1fcc8c4..5018daa 100644
--- a/dlls/d3d9/directx.c
+++ b/dlls/d3d9/directx.c
@@ -425,7 +425,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3D9Impl_CreateDevice(IDirect3D9Ex
return E_OUTOFMEMORY;
}
- hr = device_init(object, This->WineD3D, adapter, device_type, focus_window, flags, parameters);
+ hr = device_init(object, This->WineD3D, adapter, device_type, focus_window, flags, parameters, NULL);
if (FAILED(hr))
{
WARN("Failed to initialize device, hr %#x.\n", hr);
@@ -469,14 +469,32 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3D9ExImpl_CreateDeviceEx(IDirect3
UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags,
D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode, IDirect3DDevice9Ex **device)
{
- FIXME("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x,\n"
- "parameters %p, mode %p, device %p stub!\n",
- iface, adapter, device_type, focus_window, flags,
- parameters, mode, device);
+ IDirect3D9Impl *d3d9 = (IDirect3D9Impl *)iface;
+ IDirect3DDevice9Impl *object;
+ HRESULT hr;
- *device = NULL;
+ TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, mode %p, device %p.\n",
+ iface, adapter, device_type, focus_window, flags, parameters, mode, device);
- return D3DERR_DRIVERINTERNALERROR;
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
+ if (!object)
+ {
+ ERR("Failed to allocate device memory.\n");
+ return E_OUTOFMEMORY;
+ }
+
+ hr = device_init(object, d3d9->WineD3D, adapter, device_type, focus_window, flags, parameters, mode);
+ if (FAILED(hr))
+ {
+ WARN("Failed to initialize device, hr %#x.\n", hr);
+ HeapFree(GetProcessHeap(), 0, object);
+ return hr;
+ }
+
+ TRACE("Created device %p.\n", object);
+ *device = (IDirect3DDevice9Ex *)object;
+
+ return D3D_OK;
}
static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUID *luid)
--
1.7.2.2
More information about the wine-patches
mailing list