Fix Battle Realms: Zen Edition failing to start. The game expects to find a device without D3DDEVCAPS_HWTRANSFORMANDLIGHT.
-- v2: ddraw: Don't report unsupported device capabilities in d3d3_EnumDevices(). ddraw: Don't report unsupported device capabilities in d3d7_EnumDevices(). ddraw/tests: Add more capability tests for enumerated devices. ddraw/tests: Move the capability tests for enumerated devices. ddraw/tests: Add a comment to note that tests in d3d.c are deprecated.
From: Zhiyi Zhang zzhang@codeweavers.com
And new tests should be added to tests/ddraw{1,2,4,7}.c. --- dlls/ddraw/tests/d3d.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 87d0648b699..7005908fc3a 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -2227,6 +2227,8 @@ START_TEST(d3d) }; unsigned int i;
+ /* These tests are deprecated. New tests should be added to tests/ddraw{1,2,4,7}.c */ + init_function_pointers(); if(!pDirectDrawCreateEx) { win_skip("function DirectDrawCreateEx not available\n");
From: Zhiyi Zhang zzhang@codeweavers.com
Move the capability tests for enumerated devices from d3d.c to ddraw{1,2,4}.c. --- dlls/ddraw/tests/d3d.c | 165 -------------------------------------- dlls/ddraw/tests/ddraw1.c | 164 +++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 164 +++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 164 +++++++++++++++++++++++++++++++++++++ 4 files changed, 492 insertions(+), 165 deletions(-)
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 7005908fc3a..09708f22d57 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -488,133 +488,6 @@ static void SceneTest(void) /* TODO: Verify that blitting works in the same way as in d3d9 */ }
-static HRESULT WINAPI enumDevicesCallback(GUID *Guid, char *DeviceDescription, - char *DeviceName, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx) -{ - UINT ver = *((UINT *) ctx); - if(IsEqualGUID(&IID_IDirect3DRGBDevice, Guid)) - { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "RGB Device %d hal line caps has D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "RGB Device %d hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "RGB Device %d hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "RGB Device %d hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver); - - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "RGB Device %d hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "RGB Device %d hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "RGB Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "RGB Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - - ok(hal->dcmColorModel == 0, "RGB Device %u hal caps has colormodel %lu\n", ver, hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_RGB, "RGB Device %u hel caps has colormodel %lu\n", ver, hel->dcmColorModel); - - ok(hal->dwFlags == 0, "RGB Device %u hal caps has hardware flags %#lx\n", ver, hal->dwFlags); - ok(hel->dwFlags != 0, "RGB Device %u hel caps has hardware flags %#lx\n", ver, hel->dwFlags); - } - else if(IsEqualGUID(&IID_IDirect3DHALDevice, Guid)) - { - trace("HAL Device %d\n", ver); - ok(hal->dcmColorModel == D3DCOLOR_RGB, "HAL Device %u hal caps has colormodel %lu\n", ver, hel->dcmColorModel); - ok(hel->dcmColorModel == 0, "HAL Device %u hel caps has colormodel %lu\n", ver, hel->dcmColorModel); - - ok(hal->dwFlags != 0, "HAL Device %u hal caps has hardware flags %#lx\n", ver, hal->dwFlags); - ok(hel->dwFlags != 0, "HAL Device %u hel caps has hardware flags %#lx\n", ver, hel->dwFlags); - } - else if(IsEqualGUID(&IID_IDirect3DRefDevice, Guid)) - { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "REF Device %d hal line caps has D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "REF Device %d hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "REF Device %d hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "REF Device %d hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver); - - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "REF Device %d hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "REF Device %d hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "REF Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "REF Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - } - else if(IsEqualGUID(&IID_IDirect3DRampDevice, Guid)) - { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "Ramp Device %d hal line caps has D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "Ramp Device %d hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "Ramp Device %d hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "Ramp Device %d hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver); - - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "Ramp Device %d hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "Ramp Device %d hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "Ramp Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "Ramp Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - - ok(hal->dcmColorModel == 0, "Ramp Device %u hal caps has colormodel %lu\n", ver, hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_MONO, "Ramp Device %u hel caps has colormodel %lu\n", - ver, hel->dcmColorModel); - - ok(hal->dwFlags == 0, "Ramp Device %u hal caps has hardware flags %#lx\n", ver, hal->dwFlags); - ok(hel->dwFlags != 0, "Ramp Device %u hel caps has hardware flags %#lx\n", ver, hel->dwFlags); - } - else if(IsEqualGUID(&IID_IDirect3DMMXDevice, Guid)) - { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "MMX Device %d hal line caps has D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "MMX Device %d hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "MMX Device %d hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "MMX Device %d hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver); - - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "MMX Device %d hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "MMX Device %d hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "MMX Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "MMX Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver); - - ok(hal->dcmColorModel == 0, "MMX Device %u hal caps has colormodel %lu\n", ver, hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_RGB, "MMX Device %u hel caps has colormodel %lu\n", ver, hel->dcmColorModel); - - ok(hal->dwFlags == 0, "MMX Device %u hal caps has hardware flags %#lx\n", ver, hal->dwFlags); - ok(hel->dwFlags != 0, "MMX Device %u hel caps has hardware flags %#lx\n", ver, hel->dwFlags); - } - else - { - ok(FALSE, "Unexpected device enumerated: "%s" "%s"\n", DeviceDescription, DeviceName); - if(hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) trace("hal line has pow2 set\n"); - else trace("hal line does NOT have pow2 set\n"); - if(hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) trace("hal tri has pow2 set\n"); - else trace("hal tri does NOT have pow2 set\n"); - if(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) trace("hel line has pow2 set\n"); - else trace("hel line does NOT have pow2 set\n"); - if(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) trace("hel tri has pow2 set\n"); - else trace("hel tri does NOT have pow2 set\n"); - } - return DDENUMRET_OK; -} - static HRESULT WINAPI enumDevicesCallbackTest7(char *DeviceDescription, char *DeviceName, D3DDEVICEDESC7 *lpdd7, void *Context) { @@ -774,43 +647,6 @@ static void D3D7EnumLifetimeTest(void) } }
-static void CapsTest(void) -{ - IDirect3D3 *d3d3; - IDirect3D3 *d3d2; - IDirectDraw *dd1; - HRESULT hr; - UINT ver; - - hr = DirectDrawCreate(NULL, &dd1, NULL); - ok(hr == DD_OK, "Got hr %#lx.\n", hr); - hr = IDirectDraw_QueryInterface(dd1, &IID_IDirect3D3, (void **) &d3d3); - ok(hr == D3D_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3D3_EnumDevices(d3d3, NULL, NULL); - ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr); - - ver = 3; - IDirect3D3_EnumDevices(d3d3, enumDevicesCallback, &ver); - - IDirect3D3_Release(d3d3); - IDirectDraw_Release(dd1); - - hr = DirectDrawCreate(NULL, &dd1, NULL); - ok(hr == DD_OK, "Got hr %#lx.\n", hr); - hr = IDirectDraw_QueryInterface(dd1, &IID_IDirect3D2, (void **) &d3d2); - ok(hr == D3D_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3D2_EnumDevices(d3d2, NULL, NULL); - ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr); - - ver = 2; - IDirect3D2_EnumDevices(d3d2, enumDevicesCallback, &ver); - - IDirect3D2_Release(d3d2); - IDirectDraw_Release(dd1); -} - struct v_in { float x, y, z; }; @@ -2243,7 +2079,6 @@ START_TEST(d3d) D3D7EnumTest(); D3D7EnumLifetimeTest(); SetMaterialTest(); - CapsTest(); VertexBufferDescTest(); SetRenderTargetTest(); VertexBufferLockRest(); diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 1629660aedc..c4d8a1398cd 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15145,6 +15145,169 @@ static void test_filling_convention(void) DestroyWindow(window); }
+static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_desc, + char *device_name, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx) +{ + if(IsEqualGUID(&IID_IDirect3DRGBDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "RGB Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "RGB Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "RGB Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "RGB Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "RGB Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "RGB Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "RGB Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) + { + ok(hal->dcmColorModel == D3DCOLOR_RGB, "HAL Device hal caps has colormodel %lu\n", hel->dcmColorModel); + ok(hel->dcmColorModel == 0, "HAL Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "REF Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "REF Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "REF Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "REF Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "REF Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + } + else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "Ramp Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "Ramp Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "Ramp Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "Ramp Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "Ramp Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "Ramp Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_MONO, "Ramp Device hel caps has colormodel %lu\n", + hel->dcmColorModel); + + ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "MMX Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "MMX Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "MMX Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "MMX Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "MMX Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "MMX Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "MMX Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else + { + ok(FALSE, "Unexpected device enumerated: "%s" "%s"\n", device_desc, device_name); + if (hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hal line has pow2 set\n"); + else + trace("hal line does NOT have pow2 set\n"); + if (hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hal tri has pow2 set\n"); + else + trace("hal tri does NOT have pow2 set\n"); + if (hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hel line has pow2 set\n"); + else + trace("hel line does NOT have pow2 set\n"); + if (hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hel tri has pow2 set\n"); + else + trace("hel tri does NOT have pow2 set\n"); + } + + return DDENUMRET_OK; +} + +static void test_enum_devices(void) +{ + IDirectDraw *ddraw; + IDirect3D *d3d; + ULONG refcount; + HRESULT hr; + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D, (void **)&d3d); + if (FAILED(hr)) + { + skip("D3D interface is not available, skipping test.\n"); + IDirectDraw_Release(ddraw); + return; + } + + hr = IDirect3D_EnumDevices(d3d, NULL, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr); + + hr = IDirect3D_EnumDevices(d3d, test_enum_devices_caps_callback, NULL); + ok(hr == D3D_OK, "Got hr %#lx.\n", hr); + + IDirect3D_Release(d3d); + refcount = IDirectDraw_Release(ddraw); + ok(!refcount, "Device has %lu references left.\n", refcount); +} + START_TEST(ddraw1) { DDDEVICEIDENTIFIER identifier; @@ -15263,4 +15426,5 @@ START_TEST(ddraw1) test_get_display_mode(); run_for_each_device_type(test_texture_wrong_caps); test_filling_convention(); + test_enum_devices(); } diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 0aea1587156..d46598ce05a 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -16091,6 +16091,169 @@ static void test_filling_convention(void) DestroyWindow(window); }
+static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_desc, + char *device_name, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx) +{ + if(IsEqualGUID(&IID_IDirect3DRGBDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "RGB Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "RGB Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "RGB Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "RGB Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "RGB Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "RGB Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "RGB Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) + { + ok(hal->dcmColorModel == D3DCOLOR_RGB, "HAL Device hal caps has colormodel %lu\n", hel->dcmColorModel); + ok(hel->dcmColorModel == 0, "HAL Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "REF Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "REF Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "REF Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "REF Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "REF Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + } + else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "Ramp Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "Ramp Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "Ramp Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "Ramp Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "Ramp Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "Ramp Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_MONO, "Ramp Device hel caps has colormodel %lu\n", + hel->dcmColorModel); + + ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "MMX Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "MMX Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "MMX Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "MMX Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "MMX Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "MMX Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "MMX Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else + { + ok(FALSE, "Unexpected device enumerated: "%s" "%s"\n", device_desc, device_name); + if (hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hal line has pow2 set\n"); + else + trace("hal line does NOT have pow2 set\n"); + if (hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hal tri has pow2 set\n"); + else + trace("hal tri does NOT have pow2 set\n"); + if (hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hel line has pow2 set\n"); + else + trace("hel line does NOT have pow2 set\n"); + if (hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hel tri has pow2 set\n"); + else + trace("hel tri does NOT have pow2 set\n"); + } + + return DDENUMRET_OK; +} + +static void test_enum_devices(void) +{ + IDirectDraw2 *ddraw; + IDirect3D2 *d3d; + ULONG refcount; + HRESULT hr; + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirect3D2, (void **)&d3d); + if (FAILED(hr)) + { + skip("D3D interface is not available, skipping test.\n"); + IDirectDraw2_Release(ddraw); + return; + } + + hr = IDirect3D2_EnumDevices(d3d, NULL, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr); + + hr = IDirect3D2_EnumDevices(d3d, test_enum_devices_caps_callback, NULL); + ok(hr == D3D_OK, "Got hr %#lx.\n", hr); + + IDirect3D2_Release(d3d); + refcount = IDirectDraw2_Release(ddraw); + ok(!refcount, "Device has %lu references left.\n", refcount); +} + static void run_for_each_device_type(void (*test_func)(const GUID *)) { test_func(&IID_IDirect3DHALDevice); @@ -16221,4 +16384,5 @@ START_TEST(ddraw2) test_get_display_mode(); run_for_each_device_type(test_texture_wrong_caps); test_filling_convention(); + test_enum_devices(); } diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index ab37adc000a..6df91c957af 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -19160,6 +19160,169 @@ static void test_filling_convention(void) DestroyWindow(window); }
+static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_desc, + char *device_name, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx) +{ + if(IsEqualGUID(&IID_IDirect3DRGBDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "RGB Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "RGB Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "RGB Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "RGB Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "RGB Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "RGB Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "RGB Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) + { + ok(hal->dcmColorModel == D3DCOLOR_RGB, "HAL Device hal caps has colormodel %lu\n", hel->dcmColorModel); + ok(hel->dcmColorModel == 0, "HAL Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "REF Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "REF Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "REF Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "REF Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "REF Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + } + else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "Ramp Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "Ramp Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "Ramp Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "Ramp Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "Ramp Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "Ramp Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_MONO, "Ramp Device hel caps has colormodel %lu\n", + hel->dcmColorModel); + + ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) + { + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "MMX Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, + "MMX Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "MMX Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); + + ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "MMX Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, + "MMX Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, + "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok(hal->dcmColorModel == 0, "MMX Device hal caps has colormodel %lu\n", hal->dcmColorModel); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "MMX Device hel caps has colormodel %lu\n", hel->dcmColorModel); + + ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); + ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags); + } + else + { + ok(FALSE, "Unexpected device enumerated: "%s" "%s"\n", device_desc, device_name); + if (hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hal line has pow2 set\n"); + else + trace("hal line does NOT have pow2 set\n"); + if (hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hal tri has pow2 set\n"); + else + trace("hal tri does NOT have pow2 set\n"); + if (hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hel line has pow2 set\n"); + else + trace("hel line does NOT have pow2 set\n"); + if (hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) + trace("hel tri has pow2 set\n"); + else + trace("hel tri does NOT have pow2 set\n"); + } + + return DDENUMRET_OK; +} + +static void test_enum_devices(void) +{ + IDirectDraw4 *ddraw; + IDirect3D3 *d3d; + ULONG refcount; + HRESULT hr; + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + hr = IDirectDraw4_QueryInterface(ddraw, &IID_IDirect3D3, (void **)&d3d); + if (FAILED(hr)) + { + skip("D3D interface is not available, skipping test.\n"); + IDirectDraw4_Release(ddraw); + return; + } + + hr = IDirect3D3_EnumDevices(d3d, NULL, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr); + + hr = IDirect3D3_EnumDevices(d3d, test_enum_devices_caps_callback, NULL); + ok(hr == D3D_OK, "Got hr %#lx.\n", hr); + + IDirect3D3_Release(d3d); + refcount = IDirectDraw4_Release(ddraw); + ok(!refcount, "Device has %lu references left.\n", refcount); +} + START_TEST(ddraw4) { DDDEVICEIDENTIFIER identifier; @@ -19300,4 +19463,5 @@ START_TEST(ddraw4) test_get_display_mode(); run_for_each_device_type(test_texture_wrong_caps); test_filling_convention(); + test_enum_devices(); }
From: Zhiyi Zhang zzhang@codeweavers.com
Add tests for D3DDEVCAPS_HWTRANSFORMANDLIGHT and D3DDEVCAPS_DRAWPRIMITIVES2EX.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/ddraw/tests/ddraw1.c | 51 ++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 51 ++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 51 ++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 65 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 218 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index c4d8a1398cd..c9702bbfaf8 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15173,6 +15173,19 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + todo_wine + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) { @@ -15181,6 +15194,17 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, + "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, + "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) { @@ -15201,6 +15225,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "REF Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "REF Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "REF Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "REF Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) { @@ -15228,6 +15261,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "Ramp Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "Ramp Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "Ramp Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "Ramp Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) { @@ -15254,6 +15296,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "MMX Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "MMX Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "MMX Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "MMX Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else { diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index d46598ce05a..eae41eb77ae 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -16119,6 +16119,19 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + todo_wine + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) { @@ -16127,6 +16140,17 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, + "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, + "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) { @@ -16147,6 +16171,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "REF Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "REF Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "REF Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "REF Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) { @@ -16174,6 +16207,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "Ramp Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "Ramp Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "Ramp Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "Ramp Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) { @@ -16200,6 +16242,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "MMX Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "MMX Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "MMX Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "MMX Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else { diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 6df91c957af..eb1852e0832 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -19188,6 +19188,19 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + todo_wine + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) { @@ -19196,6 +19209,17 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, + "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, + "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + todo_wine + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) { @@ -19216,6 +19240,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "REF Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "REF Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "REF Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "REF Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) { @@ -19243,6 +19276,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "Ramp Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "Ramp Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "Ramp Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "Ramp Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) { @@ -19269,6 +19311,15 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags); + + ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "MMX Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "MMX Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "MMX Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "MMX Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else { diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index c72ea64c17d..99c9c7df2bc 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -19390,6 +19390,70 @@ static void test_filling_convention(void) DestroyWindow(window); }
+static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *device_name, + D3DDEVICEDESC7 *device_desc7, void *ctx) +{ + if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DTnLHalDevice)) + { + ok(device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, + "TnLHal Device device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok(device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, + "TnLHal Device device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + } + else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DHALDevice)) + { + todo_wine + ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "HAL Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + ok(device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, + "HAL Device device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + } + else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DRGBDevice)) + { + todo_wine + ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, + "RGB Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); + todo_wine + ok((device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, + "RGB Device device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + } + else + { + ok(FALSE, "Unexpected device enumerated: "%s" "%s"\n", device_desc, device_name); + } + + return DDENUMRET_OK; +} + +static void test_enum_devices(void) +{ + IDirectDraw7 *ddraw; + IDirect3D7 *d3d; + ULONG refcount; + HRESULT hr; + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + hr = IDirectDraw7_QueryInterface(ddraw, &IID_IDirect3D7, (void **)&d3d); + if (FAILED(hr)) + { + skip("D3D interface is not available, skipping test.\n"); + IDirectDraw7_Release(ddraw); + return; + } + + hr = IDirect3D7_EnumDevices(d3d, NULL, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr); + + hr = IDirect3D7_EnumDevices(d3d, test_enum_devices_caps_callback, NULL); + ok(hr == D3D_OK, "Got hr %#lx.\n", hr); + + IDirect3D7_Release(d3d); + refcount = IDirectDraw7_Release(ddraw); + ok(!refcount, "Device has %lu references left.\n", refcount); +} + static void run_for_each_device_type(void (*test_func)(const GUID *)) { test_func(hw_device_guid); @@ -19568,4 +19632,5 @@ START_TEST(ddraw7) test_get_display_mode(); run_for_each_device_type(test_texture_wrong_caps); test_filling_convention(); + test_enum_devices(); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=121699
Your paranoid android.
=== w864 (32 bit report) ===
ddraw: ddraw7.c:18938: Test failed: Got unexpected color 0x00000040.
=== w1064v1507 (32 bit report) ===
ddraw: ddraw7.c:18938: Test failed: Got unexpected color 0x0000ff00.
=== w1064 (32 bit report) ===
ddraw: ddraw7.c:18938: Test failed: Got unexpected color 0x00000040.
=== debian11 (32 bit Chinese:China report) ===
Report validation errors: ddraw7: Timeout
=== debian11 (build log) ===
WineRunWineTest.pl:error: The task timed out
From: Zhiyi Zhang zzhang@codeweavers.com
Fix Battle Realms: Zen Edition failing to start. The game expects to find a device without D3DDEVCAPS_HWTRANSFORMANDLIGHT. --- dlls/ddraw/ddraw.c | 7 +++++++ dlls/ddraw/tests/ddraw7.c | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index bb244222018..64eb7235ebf 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -49,6 +49,7 @@ static struct enum_device_entry char interface_name[100]; char device_name[100]; const GUID *device_guid; + DWORD unsupported_caps; } device_list7[] = { /* T&L HAL device */ @@ -56,6 +57,7 @@ static struct enum_device_entry "WINE Direct3D7 Hardware Transform and Lighting acceleration using WineD3D", "Wine D3D7 T&L HAL", &IID_IDirect3DTnLHalDevice, + 0, },
/* HAL device */ @@ -63,6 +65,7 @@ static struct enum_device_entry "WINE Direct3D7 Hardware acceleration using WineD3D", "Direct3D HAL", &IID_IDirect3DHALDevice, + D3DDEVCAPS_HWTRANSFORMANDLIGHT, },
/* RGB device */ @@ -70,6 +73,7 @@ static struct enum_device_entry "WINE Direct3D7 RGB Software Emulation using WineD3D", "Wine D3D7 RGB", &IID_IDirect3DRGBDevice, + D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX, }, };
@@ -3757,6 +3761,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA { struct ddraw *ddraw = impl_from_IDirect3D7(iface); D3DDEVICEDESC7 device_desc7; + DWORD dev_caps; HRESULT hr; size_t i;
@@ -3772,12 +3777,14 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA wined3d_mutex_unlock(); return hr; } + dev_caps = device_desc7.dwDevCaps;
for (i = 0; i < ARRAY_SIZE(device_list7); i++) { HRESULT ret;
device_desc7.deviceGUID = *device_list7[i].device_guid; + device_desc7.dwDevCaps = dev_caps & ~device_list7[i].unsupported_caps; ret = callback(device_list7[i].interface_name, device_list7[i].device_name, &device_desc7, context); if (ret != DDENUMRET_OK) { diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 99c9c7df2bc..15ab548ebc6 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -19402,7 +19402,6 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d } else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DHALDevice)) { - todo_wine ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "HAL Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, @@ -19410,10 +19409,8 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d } else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DRGBDevice)) { - todo_wine ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=121700
Your paranoid android.
=== w1064v1809 (32 bit report) ===
ddraw: ddraw7.c:18938: Test failed: Got unexpected color 0x00000040.
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/ddraw/ddraw.c | 5 +++++ dlls/ddraw/tests/ddraw1.c | 6 ------ dlls/ddraw/tests/ddraw2.c | 6 ------ dlls/ddraw/tests/ddraw4.c | 6 ------ 4 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 64eb7235ebf..fd4c5bd4862 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -3882,6 +3882,9 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA hal_desc.dcmColorModel = 0; /* RGB, RAMP and MMX devices cannot report HAL hardware flags */ hal_desc.dwFlags = 0; + /* RGB, REF, RAMP and MMX devices don't report hardware transform and lighting capability */ + hal_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX); + hel_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX);
hr = callback((GUID *)&IID_IDirect3DRGBDevice, reference_description, device_name, &hal_desc, &hel_desc, context); @@ -3906,6 +3909,8 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PERSPECTIVE); /* HAL devices have a HEL dcmColorModel of 0 */ hel_desc.dcmColorModel = 0; + /* HAL devices report hardware transform and lighting capability, but not in hel */ + hel_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX);
hr = callback((GUID *)&IID_IDirect3DHALDevice, wined3d_description, device_name, &hal_desc, &hel_desc, context); diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index c9702bbfaf8..94d41dbc34d 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15174,16 +15174,12 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- todo_wine ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } @@ -15197,12 +15193,10 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index eae41eb77ae..d5b72793526 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -16120,16 +16120,12 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- todo_wine ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } @@ -16143,12 +16139,10 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index eb1852e0832..471f6fc3f09 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -19189,16 +19189,12 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- todo_wine ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } @@ -19212,12 +19208,10 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d
ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - todo_wine ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); }
This merge request was approved by Zebediah Figura.