mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:54:13 +00:00
d3drm: Implement IDirect3DRM::CreateDeviceFromD3D.
This commit is contained in:
parent
e29a0cf417
commit
9603125efc
4 changed files with 36 additions and 12 deletions
|
@ -279,13 +279,25 @@ static HRESULT WINAPI d3drm1_CreateDeviceFromD3D(IDirect3DRM *iface,
|
|||
{
|
||||
struct d3drm_device *object;
|
||||
HRESULT hr;
|
||||
FIXME("iface %p, d3d %p, d3d_device %p, device %p partial stub.\n",
|
||||
TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
|
||||
iface, d3d, d3d_device, device);
|
||||
|
||||
if (!device)
|
||||
return D3DRMERR_BADVALUE;
|
||||
*device = NULL;
|
||||
if (!d3d || !d3d_device)
|
||||
return D3DRMERR_BADVALUE;
|
||||
|
||||
hr = d3drm_device_create(&object);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = d3drm_device_set_ddraw_device_d3d(object, iface, d3d, d3d_device);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
d3drm_device_destroy(object);
|
||||
return hr;
|
||||
}
|
||||
*device = IDirect3DRMDevice_from_impl(object);
|
||||
|
||||
return D3DRM_OK;
|
||||
|
|
|
@ -50,6 +50,8 @@ HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, I
|
|||
HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirect3DRM *d3drm, IDirectDraw *ddraw, IDirectDrawSurface *surface,
|
||||
BOOL create_z_surface) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT d3drm_device_set_ddraw_device_d3d(struct d3drm_device *device, IDirect3DRM *d3drm, IDirect3D *d3d, IDirect3DDevice *d3d_device) DECLSPEC_HIDDEN;
|
||||
|
||||
struct d3drm_file_header
|
||||
{
|
||||
WORD major;
|
||||
|
|
|
@ -241,6 +241,16 @@ HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirect3DRM
|
|||
return hr;
|
||||
}
|
||||
|
||||
HRESULT d3drm_device_set_ddraw_device_d3d(struct d3drm_device *device, IDirect3DRM *d3drm, IDirect3D *d3d, IDirect3DDevice *d3d_device)
|
||||
{
|
||||
device->d3drm = d3drm;
|
||||
IDirect3DRM_AddRef(d3drm);
|
||||
device->device = d3d_device;
|
||||
IDirect3DDevice_AddRef(d3d_device);
|
||||
|
||||
return IDirect3D_QueryInterface(d3d, &IID_IDirectDraw, (void **)&device->ddraw);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3drm_device1_QueryInterface(IDirect3DRMDevice *iface, REFIID riid, void **out)
|
||||
{
|
||||
struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface);
|
||||
|
|
|
@ -3117,7 +3117,7 @@ static void test_create_device_from_d3d1(void)
|
|||
IDirectDraw *ddraw1 = NULL;
|
||||
IDirect3D *d3d1 = NULL;
|
||||
IDirect3DRM *d3drm1 = NULL;
|
||||
IDirect3DRMDevice *device1 = NULL;
|
||||
IDirect3DRMDevice *device1 = (IDirect3DRMDevice *)0xdeadbeef;
|
||||
IDirect3DDevice *d3ddevice1 = NULL, *d3drm_d3ddevice1 = NULL;
|
||||
IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_ds = NULL;
|
||||
DWORD expected_flags;
|
||||
|
@ -3152,13 +3152,20 @@ static void test_create_device_from_d3d1(void)
|
|||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr);
|
||||
ref1 = get_refcount((IUnknown *)d3drm1);
|
||||
|
||||
hr = IDirect3DRM_CreateDeviceFromD3D(d3drm1, NULL, d3ddevice1, &device1);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr);
|
||||
ok(device1 == NULL, "Expected device returned == NULL, got %p.\n", device1);
|
||||
hr = IDirect3DRM_CreateDeviceFromD3D(d3drm1, d3d1, NULL, &device1);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr);
|
||||
hr = IDirect3DRM_CreateDeviceFromD3D(d3drm1, d3d1, d3ddevice1, NULL);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr);
|
||||
|
||||
hr = IDirect3DRM_CreateDeviceFromD3D(d3drm1, d3d1, d3ddevice1, &device1);
|
||||
ok(hr == DD_OK, "Failed to create IDirect3DRMDevice interface (hr = %x)\n", hr);
|
||||
ref2 = get_refcount((IUnknown *)d3drm1);
|
||||
todo_wine ok(ref2 > ref1, "expected ref2 > ref1, got ref1 = %u , ref2 = %u.\n", ref1, ref2);
|
||||
ok(ref2 > ref1, "expected ref2 > ref1, got ref1 = %u , ref2 = %u.\n", ref1, ref2);
|
||||
device_ref2 = get_refcount((IUnknown *)d3ddevice1);
|
||||
todo_wine ok(device_ref2 > device_ref1, "Expected device_ref2 > device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2);
|
||||
ok(device_ref2 > device_ref1, "Expected device_ref2 > device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2);
|
||||
|
||||
hr = IDirectDraw_EnumSurfaces(ddraw1, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST,
|
||||
NULL, &surface, surface_callback);
|
||||
|
@ -3166,9 +3173,7 @@ static void test_create_device_from_d3d1(void)
|
|||
ok(surface == NULL, "No primary surface should have enumerated (%p).\n", surface);
|
||||
|
||||
hr = IDirect3DRMDevice_GetDirect3DDevice(device1, &d3drm_d3ddevice1);
|
||||
todo_wine ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice interface (hr = %x).\n", hr);
|
||||
if (FAILED(hr))
|
||||
goto cleanup;
|
||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice interface (hr = %x).\n", hr);
|
||||
ok(d3ddevice1 == d3drm_d3ddevice1, "Expected Immediate Mode deivce created == %p, got %p.\n", d3ddevice1, d3drm_d3ddevice1);
|
||||
|
||||
/* Check properties of render target and depth surfaces */
|
||||
|
@ -3203,13 +3208,8 @@ static void test_create_device_from_d3d1(void)
|
|||
|
||||
IDirectDrawSurface_Release(d3drm_ds);
|
||||
IDirectDrawSurface_Release(ds);
|
||||
ds = NULL;
|
||||
IDirectDrawSurface_Release(surface);
|
||||
IDirect3DDevice_Release(d3drm_d3ddevice1);
|
||||
cleanup:
|
||||
if (ds)
|
||||
IDirectDrawSurface_Release(ds);
|
||||
|
||||
IDirect3DRMDevice_Release(device1);
|
||||
ref2 = get_refcount((IUnknown *)d3drm1);
|
||||
ok(ref1 == ref2, "expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
|
||||
|
|
Loading…
Reference in a new issue