Adds testing of devices besides HAL and TnLHal to render-target tests. Depending on the version of ddraw, this may include RGB, Ramp, or MMX.
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/tests/ddraw1.c | 31 ++++++++++++++++++------- dlls/ddraw/tests/ddraw2.c | 45 ++++++++++++++++++++++++++---------- dlls/ddraw/tests/ddraw4.c | 48 +++++++++++++++++++++++++++------------ dlls/ddraw/tests/ddraw7.c | 48 ++++++++++++++++++++++++++++----------- 4 files changed, 125 insertions(+), 47 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 8407290259..fbf6e4d9d9 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -3884,7 +3884,7 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps_riid(REFCLSID riid, const char *device_name) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name, BOOL is_hal) { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; @@ -3918,18 +3918,21 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, + TRUE }, { NULL, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, + FALSE, TRUE }, { NULL, DDSCAPS_OFFSCREENPLAIN, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, + FALSE, TRUE }, { NULL, @@ -3948,18 +3951,21 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY, DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, + TRUE }, { NULL, DDSCAPS_3DDEVICE, DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, + FALSE, TRUE }, { NULL, 0, DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, + FALSE, TRUE }, { NULL, @@ -3978,6 +3984,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) 0, DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, + TRUE }, { &p8_fmt, @@ -3991,6 +3998,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, + FALSE, TRUE }, { &p8_fmt, @@ -4064,6 +4072,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) IDirectDrawSurface *surface; DDSURFACEDESC surface_desc; IDirect3DDevice *device; + HRESULT expected_hr;
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -4096,19 +4105,24 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ expected_hr = test_data[i].create_device_hr; + if (expected_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal) + expected_hr = D3D_OK; hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device); - ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", - device_name, i, hr, test_data[i].create_device_hr); + todo_wine_if(test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); if (hr == DDERR_NOPALETTEATTACHED) { + expected_hr = (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? DDERR_INVALIDPIXELFORMAT : + is_hal ? D3DERR_SURFACENOTINVIDMEM : D3D_OK; hr = IDirectDrawSurface_SetPalette(surface, palette); ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); refcount = IDirectDrawPalette_AddRef(palette) - 1; hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device); - if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) - ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); - else - ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); + todo_wine_if(!is_hal) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); /* If QueryInterface is successful, it adds multiple references to palette, * none of which are released by IDirect3DDevice_Release. */ while (IDirectDrawPalette_Release(palette) > refcount) ; @@ -4133,7 +4147,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name)
static void test_rt_caps(void) { - test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE); + test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE); }
static void test_primary_caps(void) diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 0fc8e1859e..28f0c5f994 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -4303,7 +4303,7 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps_riid(REFCLSID riid, const char *device_name) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name, BOOL is_hal) { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; @@ -4340,6 +4340,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + TRUE }, { NULL, @@ -4347,6 +4348,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + FALSE, TRUE }, { NULL, @@ -4354,6 +4356,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { NULL, @@ -4375,6 +4378,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + TRUE }, { NULL, @@ -4382,6 +4386,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + FALSE, TRUE }, { NULL, @@ -4389,6 +4394,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { NULL, @@ -4410,13 +4416,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + TRUE }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY, DDERR_NOPALETTEATTACHED, - DDERR_INVALIDCAPS, + DDERR_NOPALETTEATTACHED, FALSE, TRUE /* AMD r200 */ }, { @@ -4425,13 +4432,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDERR_NOPALETTEATTACHED, - DDERR_INVALIDCAPS, + DDERR_NOPALETTEATTACHED, }, { &p8_fmt, @@ -4511,6 +4519,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) IDirectDrawSurface *surface, *rt, *expected_rt, *tmp; DDSURFACEDESC surface_desc; IDirect3DDevice2 *device; + HRESULT expected_hr;
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -4543,19 +4552,24 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ expected_hr = test_data[i].create_device_hr; + if (expected_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal) + expected_hr = D3D_OK; hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device); - ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", - device_name, i, hr, test_data[i].create_device_hr); + todo_wine_if(test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); if (hr == DDERR_NOPALETTEATTACHED) { + expected_hr = (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? DDERR_INVALIDPIXELFORMAT : + is_hal ? D3DERR_SURFACENOTINVIDMEM : D3D_OK; hr = IDirectDrawSurface_SetPalette(surface, palette); ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); refcount = IDirectDrawPalette_AddRef(palette); hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device); - if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) - ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); - else - ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); + todo_wine_if(!is_hal) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); /* If CreateDevice is successful, it adds multiple references to palette, * only one of which is released by IDirect3DDevice2_Release. */ if (FAILED(hr)) refcount--; @@ -4598,9 +4612,13 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", device_name, i, test_data[i].caps_in, hr);
+ expected_hr = test_data[i].set_rt_hr; + if (expected_hr == DDERR_NOPALETTEATTACHED && is_hal) + expected_hr = DDERR_INVALIDCAPS; hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0); - ok(hr == test_data[i].set_rt_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", - device_name, i, hr, test_data[i].set_rt_hr); + todo_wine_if(expected_hr == DDERR_NOPALETTEATTACHED) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT) expected_rt = rt; else @@ -4640,7 +4658,10 @@ done:
static void test_rt_caps(void) { - test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE); + test_rt_caps_riid(&IID_IDirect3DMMXDevice, "MMX", FALSE); + test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE); + test_rt_caps_riid(&IID_IDirect3DRampDevice, "Ramp", FALSE); }
static void test_primary_caps(void) diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 2df735abea..3c1e96dbb4 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -5921,7 +5921,7 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps_riid(REFCLSID riid, const char *device_name) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name, BOOL is_hal) { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; @@ -5958,6 +5958,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + TRUE }, { NULL, @@ -5965,6 +5966,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + FALSE, TRUE }, { NULL, @@ -5972,6 +5974,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { NULL, @@ -5993,6 +5996,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + TRUE }, { NULL, @@ -6000,6 +6004,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + FALSE, TRUE }, { NULL, @@ -6007,6 +6012,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { NULL, @@ -6028,13 +6034,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + TRUE }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY, DDERR_NOPALETTEATTACHED, - DDERR_INVALIDCAPS, + DDERR_NOPALETTEATTACHED, FALSE, TRUE /* AMD r200 */ }, { @@ -6043,13 +6050,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDERR_NOPALETTEATTACHED, - DDERR_INVALIDCAPS, + DDERR_NOPALETTEATTACHED, }, { &p8_fmt, @@ -6064,7 +6072,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, - FALSE, FALSE, TRUE + TRUE, FALSE, TRUE }, { &z_fmt, @@ -6072,7 +6080,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, - FALSE, FALSE, TRUE + FALSE, TRUE, TRUE }, { &z_fmt, @@ -6080,6 +6088,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { &z_fmt, @@ -6128,6 +6137,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) IDirectDrawSurface4 *surface, *rt, *expected_rt, *tmp; DDSURFACEDESC2 surface_desc; IDirect3DDevice3 *device; + HRESULT expected_hr;
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -6155,19 +6165,24 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ expected_hr = test_data[i].create_device_hr; + if (expected_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal) + expected_hr = D3D_OK; hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL); - ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", - device_name, i, hr, test_data[i].create_device_hr); + todo_wine_if(test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); if (hr == DDERR_NOPALETTEATTACHED) { + expected_hr = (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? DDERR_INVALIDPIXELFORMAT : + is_hal ? D3DERR_SURFACENOTINVIDMEM : D3D_OK; hr = IDirectDrawSurface4_SetPalette(surface, palette); ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); refcount = IDirectDrawPalette_AddRef(palette); hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL); - if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) - ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); - else - ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); + todo_wine_if(!is_hal) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); /* If CreateDevice is successful, it adds multiple references to palette, * only one of which is released by IDirect3DDevice3_Release. */ if (FAILED(hr)) refcount--; @@ -6205,11 +6220,15 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", device_name, i, test_data[i].caps_in, hr);
+ expected_hr = test_data[i].set_rt_hr; + if (expected_hr == DDERR_NOPALETTEATTACHED && is_hal) + expected_hr = DDERR_INVALIDCAPS; hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0); - ok(hr == test_data[i].set_rt_hr || broken( + todo_wine_if(expected_hr == DDERR_NOPALETTEATTACHED) + ok(hr == expected_hr || broken( test_data[i].broken_set_target_ok && hr == D3D_OK), "Test %s %u: Got unexpected hr %#x, expected %#x.\n", - device_name, i, hr, test_data[i].set_rt_hr); + device_name, i, hr, expected_hr); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT) expected_rt = rt; else @@ -6241,7 +6260,8 @@ done:
static void test_rt_caps(void) { - test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE); + test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE); }
static void test_primary_caps(void) diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 7a073296ca..6aed30bfe6 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -5657,7 +5657,7 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps_riid(REFCLSID riid, const char *device_name) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name, BOOL is_hal) { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; @@ -5696,6 +5696,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + TRUE }, { NULL, @@ -5703,6 +5704,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + FALSE, TRUE }, { NULL, @@ -5710,6 +5712,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { NULL, @@ -5732,6 +5735,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + TRUE }, { NULL, @@ -5739,6 +5743,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, + FALSE, TRUE }, { NULL, @@ -5746,6 +5751,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { NULL, @@ -5768,13 +5774,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + TRUE }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY, DDERR_NOPALETTEATTACHED, - DDERR_INVALIDCAPS, + DDERR_NOPALETTEATTACHED, FALSE, TRUE /* AMD r200 */ }, { @@ -5783,13 +5790,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDERR_NOPALETTEATTACHED, - DDERR_INVALIDCAPS, + DDERR_NOPALETTEATTACHED, }, { &p8_fmt, @@ -5804,6 +5812,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, + TRUE }, { &z_fmt, @@ -5811,6 +5820,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, + FALSE, TRUE }, { &z_fmt, @@ -5818,6 +5828,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, + FALSE, TRUE }, { &z_fmt, @@ -5875,6 +5886,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) IDirectDrawSurface7 *surface, *rt, *expected_rt, *tmp; DDSURFACEDESC2 surface_desc; IDirect3DDevice7 *device; + HRESULT expected_hr;
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -5902,18 +5914,23 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
+ expected_hr = test_data[i].create_device_hr; + if (expected_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal) + expected_hr = D3D_OK; hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device); - ok(hr == test_data[i].create_device_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", - device_name, i, hr, test_data[i].create_device_hr); + todo_wine_if(test_data[i].create_device_hr == D3DERR_SURFACENOTINVIDMEM && !is_hal) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); if (hr == DDERR_NOPALETTEATTACHED) { + expected_hr = (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) ? DDERR_INVALIDPIXELFORMAT : + is_hal ? D3DERR_SURFACENOTINVIDMEM : E_FAIL; hr = IDirectDrawSurface7_SetPalette(surface, palette); ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device); - if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) - ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); - else - ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); + todo_wine_if(!is_hal) + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + device_name, i, hr, expected_hr); } if (FAILED(hr)) { @@ -5947,12 +5964,16 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", device_name, i, test_data[i].caps_in, hr);
+ expected_hr = test_data[i].set_rt_hr; + if (expected_hr == DDERR_NOPALETTEATTACHED && is_hal) + expected_hr = DDERR_INVALIDCAPS; hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0); - ok(hr == test_data[i].set_rt_hr || broken( + todo_wine_if(expected_hr == DDERR_NOPALETTEATTACHED) + ok(hr == expected_hr || broken( (test_data[i].broken_set_target_ok && hr == D3D_OK) || (test_data[i].broken_set_target_ivpf && hr == DDERR_INVALIDPIXELFORMAT)), "Test %s %u: Got unexpected hr %#x, expected %#x.\n", - device_name, i, hr, test_data[i].set_rt_hr); + device_name, i, hr, expected_hr); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT) expected_rt = rt; else @@ -5984,8 +6005,9 @@ done:
static void test_rt_caps(void) { - test_rt_caps_riid(&IID_IDirect3DTnLHalDevice, "TnLHal"); - test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); + test_rt_caps_riid(&IID_IDirect3DTnLHalDevice, "TnLHal", TRUE); + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE); + test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE); }
static void test_primary_caps(void)