Commit 3c899df3 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

ddraw/tests: Move the capability tests for enumerated devices.

Move the capability tests for enumerated devices from d3d.c to ddraw{1,2,4}.c.
parent 21beb2a8
......@@ -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();
......
......@@ -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();
}
......@@ -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();
}
......@@ -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();
}
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