Commit 5582c4d6 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

d3drm: Support IDirect3D3 when creating device.

parent f8733138
......@@ -124,7 +124,9 @@ HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw
IDirectDrawSurface *ds = NULL;
IDirect3DDevice *device1 = NULL;
IDirect3DDevice2 *device2 = NULL;
IDirect3DDevice3 *device3 = NULL;
IDirect3D2 *d3d2 = NULL;
IDirect3D3 *d3d3 = NULL;
DDSURFACEDESC desc, surface_desc;
HRESULT hr;
......@@ -171,19 +173,29 @@ HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw
if (version == 1)
hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DRGBDevice, (void **)&device1);
else
else if (version == 2)
{
IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D2, (void**)&d3d2);
hr = IDirect3D2_CreateDevice(d3d2, &IID_IDirect3DRGBDevice, surface, &device2);
IDirect3D2_Release(d3d2);
}
else
{
IDirectDrawSurface4 *surface4 = NULL;
IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface4, (void**)&surface4);
IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D3, (void**)&d3d3);
hr = IDirect3D3_CreateDevice(d3d3, &IID_IDirect3DRGBDevice, surface4, &device3, NULL);
IDirectDrawSurface4_Release(surface4);
IDirect3D3_Release(d3d3);
}
if (FAILED(hr))
{
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
return hr;
}
if (version != 1)
if (version == 2)
{
hr = IDirect3DDevice2_QueryInterface(device2, &IID_IDirect3DDevice, (void**)&device1);
IDirect3DDevice2_Release(device2);
......@@ -193,6 +205,16 @@ HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw
return hr;
}
}
else if (version == 3)
{
hr = IDirect3DDevice3_QueryInterface(device3, &IID_IDirect3DDevice, (void**)&device1);
IDirect3DDevice3_Release(device3);
if (FAILED(hr))
{
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
return hr;
}
}
device->device = device1;
device->width = desc.dwWidth;
device->height = desc.dwHeight;
......
......@@ -4265,6 +4265,7 @@ static void test_create_device_from_clipper3(void)
IUnknown *unknown = NULL;
IDirect3DRMDevice3 *device3 = (IDirect3DRMDevice3 *)0xdeadbeef;
IDirect3DDevice2 *d3ddevice2 = NULL;
IDirect3DDevice3 *d3ddevice3 = NULL;
IDirectDrawClipper *clipper = NULL, *d3drm_clipper = NULL;
IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_primary = NULL;
IDirectDrawSurface7 *surface7 = NULL;
......@@ -4320,6 +4321,10 @@ static void test_create_device_from_clipper3(void)
hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2);
ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr);
hr = IDirect3DDevice2_QueryInterface(d3ddevice2, &IID_IDirect3DDevice3, (void**)&d3ddevice3);
ok(hr == S_OK, "got %x.\n", hr);
IDirect3DDevice3_Release(d3ddevice3);
hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &surface);
ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment