This makes it possible to scan for devices other than HAL.
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/tests/ddraw7.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 470464951c..d921746152 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -339,10 +339,10 @@ static IDirectDraw7 *create_ddraw(void)
static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7 *desc, void *ctx) { - BOOL *hal_ok = ctx; - if (IsEqualGUID(&desc->deviceGUID, &IID_IDirect3DTnLHalDevice)) + struct { REFCLSID riid; BOOL present; } *device_data = ctx; + if (IsEqualGUID(&desc->deviceGUID, device_data->riid)) { - *hal_ok = TRUE; + device_data->present = TRUE; return DDENUMRET_CANCEL; } return DDENUMRET_OK; @@ -357,7 +357,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) IDirectDraw7 *ddraw; IDirect3D7 *d3d7; HRESULT hr; - BOOL hal_ok = FALSE; + struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE }; const GUID *devtype = &IID_IDirect3DHALDevice;
if (!(ddraw = create_ddraw())) @@ -397,9 +397,9 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return NULL; }
- hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &hal_ok); + hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &device_data); ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr); - if (hal_ok) devtype = &IID_IDirect3DTnLHalDevice; + if (device_data.present) devtype = device_data.riid;
memset(&z_fmt, 0, sizeof(z_fmt)); hr = IDirect3D7_EnumZBufferFormats(d3d7, devtype, enum_z_fmt, &z_fmt); @@ -5650,7 +5650,7 @@ static void test_rt_caps(void) PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; IDirectDraw7 *ddraw; - BOOL hal_ok = FALSE; + struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE }; DDPIXELFORMAT z_fmt; IDirect3D7 *d3d; unsigned int i; @@ -5848,10 +5848,10 @@ static void test_rt_caps(void) goto done; }
- hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok); + hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data); ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr); - if (hal_ok) - devtype = &IID_IDirect3DTnLHalDevice; + if (device_data.present) + devtype = device_data.riid;
memset(&z_fmt, 0, sizeof(z_fmt)); hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt); @@ -6133,7 +6133,7 @@ static void test_surface_lock(void) DDSURFACEDESC2 ddsd; ULONG refcount; DDPIXELFORMAT z_fmt; - BOOL hal_ok = FALSE; + struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE }; const GUID *devtype = &IID_IDirect3DHALDevice; D3DDEVICEDESC7 device_desc; BOOL cubemap_supported; @@ -6254,10 +6254,10 @@ static void test_surface_lock(void) goto done; }
- hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok); + hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data); ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr); - if (hal_ok) - devtype = &IID_IDirect3DTnLHalDevice; + if (device_data.present) + devtype = device_data.riid;
memset(&z_fmt, 0, sizeof(z_fmt)); hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
This allows the function to create devices other than HAL.
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/tests/ddraw1.c | 75 +++++++++++---------- dlls/ddraw/tests/ddraw2.c | 81 ++++++++++++----------- dlls/ddraw/tests/ddraw4.c | 101 ++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 135 +++++++++++++++++++++----------------- 4 files changed, 210 insertions(+), 182 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 3a27e91aa1..862c98353e 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -513,7 +513,7 @@ static IDirectDraw *create_ddraw(void) return ddraw; }
-static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level) +static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level, REFCLSID riid) { /* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask * for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports @@ -573,7 +573,7 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo if (FAILED(hr)) continue;
- if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device))) + if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device))) break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); @@ -583,6 +583,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo return device; }
+static IDirect3DDevice *create_device_hal(IDirectDraw *ddraw, HWND window, DWORD coop_level) +{ + return create_device(ddraw, window, coop_level, &IID_IDirect3DHALDevice); +} + static IDirect3DViewport *create_viewport(IDirect3DDevice *device, UINT x, UINT y, UINT w, UINT h) { IDirect3DViewport *viewport; @@ -1093,7 +1098,7 @@ static void test_coop_level_d3d_state(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -1165,7 +1170,7 @@ static void test_surface_interface_mismatch(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -1288,7 +1293,7 @@ static void test_viewport_object(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -1514,7 +1519,7 @@ static void test_zenable(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -1651,7 +1656,7 @@ static void test_ck_rgba(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -1809,7 +1814,7 @@ static void test_ck_default(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -1965,7 +1970,7 @@ static void test_ck_complex(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) + if (!(device = create_device_hal(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2193,7 +2198,7 @@ static void test_surface_qi(void) /* Try to create a D3D device to see if the ddraw implementation supports * D3D. 64-bit ddraw in particular doesn't seem to support D3D, and * doesn't support e.g. the IDirect3DTexture interfaces. */ - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -2276,7 +2281,7 @@ static void test_device_qi(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -3584,7 +3589,7 @@ static void test_clear_rect_count(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -3816,7 +3821,7 @@ static void test_unsupported_formats(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -4052,7 +4057,7 @@ static void test_rt_caps(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -4335,7 +4340,7 @@ static void test_surface_lock(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -4415,7 +4420,7 @@ static void test_surface_discard(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -5945,7 +5950,7 @@ static void test_material(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -6179,7 +6184,7 @@ static void test_lighting(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -6603,7 +6608,7 @@ static void test_specular_lighting(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -7502,7 +7507,7 @@ static void test_texturemapblend(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -7892,7 +7897,7 @@ static void test_viewport_clear_rect(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -8108,7 +8113,7 @@ static void test_color_fill(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); is_warp = ddraw_is_warp(ddraw); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -8530,7 +8535,7 @@ static void test_colorkey_precision(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -8953,7 +8958,7 @@ static void test_shademode(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -9520,7 +9525,7 @@ static void test_blt(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -9685,7 +9690,7 @@ static void test_cross_device_blt(void)
window = create_window(); ddraw = create_ddraw(); - if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) + if (!(device = create_device_hal(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device.\n"); IDirectDraw_Release(ddraw); @@ -9695,7 +9700,7 @@ static void test_cross_device_blt(void)
window2 = create_window(); ddraw2 = create_ddraw(); - if (!(device2 = create_device(ddraw2, window2, DDSCL_NORMAL))) + if (!(device2 = create_device_hal(ddraw2, window2, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); IDirectDraw_Release(ddraw2); @@ -10245,7 +10250,7 @@ static void test_transform_vertices(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -11002,7 +11007,7 @@ static void test_texture_load(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -11642,7 +11647,7 @@ static void test_depth_readback(void) return; }
- if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a D3D device, skipping tests.\n"); IDirectDraw_Release(ddraw); @@ -11747,7 +11752,7 @@ static void test_clear(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -12050,7 +12055,7 @@ static void test_execute_data(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -12216,7 +12221,7 @@ static void test_viewport(void) 0, 0, 640, 480, 0, 0, 0, 0); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -12474,7 +12479,7 @@ static void test_find_device(void) hr = IDirect3D_FindDevice(d3d, &search, &result);
window = create_window(); - device = create_device(ddraw, window, DDSCL_NORMAL); + device = create_device_hal(ddraw, window, DDSCL_NORMAL); if (hr == D3D_OK) ok(!!device, "Failed to create a 3D device.\n"); else @@ -12687,7 +12692,7 @@ static void test_alphatest(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); IDirectDraw_Release(ddraw); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 97f21798d3..fbce6cb9c2 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -342,7 +342,7 @@ static IDirectDraw2 *create_ddraw(void) return ddraw2; }
-static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level) +static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level, REFCLSID riid) { /* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask * for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports @@ -410,7 +410,7 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c if (FAILED(hr)) continue;
- if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device))) + if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, riid, surface, &device))) break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); @@ -421,6 +421,11 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c return device; }
+static IDirect3DDevice2 *create_device_hal(IDirectDraw2 *ddraw, HWND window, DWORD coop_level) +{ + return create_device(ddraw, window, coop_level, &IID_IDirect3DHALDevice); +} + static IDirect3DViewport2 *create_viewport(IDirect3DDevice2 *device, UINT x, UINT y, UINT w, UINT h) { IDirect3DViewport2 *viewport; @@ -940,7 +945,7 @@ static void test_coop_level_d3d_state(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -1043,7 +1048,7 @@ static void test_surface_interface_mismatch(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -1177,7 +1182,7 @@ static void test_depth_blit(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -1443,7 +1448,7 @@ static void test_viewport_object(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw_Release(ddraw); @@ -1679,7 +1684,7 @@ static void test_zenable(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -1781,7 +1786,7 @@ static void test_ck_rgba(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -1912,7 +1917,7 @@ static void test_ck_default(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -2016,7 +2021,7 @@ static void test_ck_complex(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) + if (!(device = create_device_hal(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2244,7 +2249,7 @@ static void test_surface_qi(void) /* Try to create a D3D device to see if the ddraw implementation supports * D3D. 64-bit ddraw in particular doesn't seem to support D3D, and * doesn't support e.g. the IDirect3DTexture interfaces. */ - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -2326,7 +2331,7 @@ static void test_device_qi(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -3721,7 +3726,7 @@ static void test_clear_rect_count(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -3983,7 +3988,7 @@ static void test_lighting_interface_versions(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -4235,7 +4240,7 @@ static void test_unsupported_formats(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -4514,7 +4519,7 @@ static void test_rt_caps(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -4862,7 +4867,7 @@ static void test_surface_lock(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -4942,7 +4947,7 @@ static void test_surface_discard(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -6893,7 +6898,7 @@ static void test_material(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -7110,7 +7115,7 @@ static void test_lighting(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -7469,7 +7474,7 @@ static void test_specular_lighting(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -8335,7 +8340,7 @@ static void test_texturemapblend(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -8637,7 +8642,7 @@ static void test_viewport_clear_rect(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -8853,7 +8858,7 @@ static void test_color_fill(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); is_warp = ddraw_is_warp(ddraw); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -9271,7 +9276,7 @@ static void test_colorkey_precision(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -9671,7 +9676,7 @@ static void test_shademode(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -10219,7 +10224,7 @@ static void test_blt(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -10384,7 +10389,7 @@ static void test_cross_device_blt(void)
window = create_window(); ddraw = create_ddraw(); - if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) + if (!(device = create_device_hal(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device.\n"); IDirectDraw2_Release(ddraw); @@ -10394,7 +10399,7 @@ static void test_cross_device_blt(void)
window2 = create_window(); ddraw2 = create_ddraw(); - if (!(device2 = create_device(ddraw2, window2, DDSCL_NORMAL))) + if (!(device2 = create_device_hal(ddraw2, window2, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); IDirectDraw2_Release(ddraw2); @@ -10859,7 +10864,7 @@ static void test_draw_primitive(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -10939,7 +10944,7 @@ static void test_edge_antialiasing_blending(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); DestroyWindow(window); @@ -11217,7 +11222,7 @@ static void test_transform_vertices(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -12546,7 +12551,7 @@ static void test_set_render_state(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -12617,7 +12622,7 @@ static void test_depth_readback(void) ok(!!window, "Failed to create a window.\n"); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a D3D device, skipping tests.\n"); IDirectDraw2_Release(ddraw); @@ -12734,7 +12739,7 @@ static void test_clear(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -13066,7 +13071,7 @@ static void test_viewport(void) 0, 0, 640, 480, NULL, NULL, NULL, NULL); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); IDirectDraw2_Release(ddraw); @@ -13342,7 +13347,7 @@ static void test_find_device(void) hr = IDirect3D2_FindDevice(d3d, &search, &result);
window = create_window(); - device = create_device(ddraw, window, DDSCL_NORMAL); + device = create_device_hal(ddraw, window, DDSCL_NORMAL); if (hr == D3D_OK) ok(!!device, "Failed to create a 3D device.\n"); else @@ -13552,7 +13557,7 @@ static void test_alphatest(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); IDirectDraw2_Release(ddraw); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 2c0a9e7f05..4e4f21686c 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -330,7 +330,7 @@ static IDirectDraw4 *create_ddraw(void) return ddraw4; }
-static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) +static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level, REFCLSID riid) { IDirectDrawSurface4 *surface, *ds; IDirect3DDevice3 *device = NULL; @@ -412,7 +412,7 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) return NULL; }
- hr = IDirect3D3_CreateDevice(d3d3, &IID_IDirect3DHALDevice, surface, &device, NULL); + hr = IDirect3D3_CreateDevice(d3d3, riid, surface, &device, NULL); IDirect3D3_Release(d3d3); IDirectDrawSurface4_Release(surface); if (FAILED(hr)) @@ -421,6 +421,11 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) return device; }
+static IDirect3DDevice3 *create_device_hal(HWND window, DWORD coop_level) +{ + return create_device(window, coop_level, &IID_IDirect3DHALDevice); +} + static IDirect3DViewport3 *create_viewport(IDirect3DDevice3 *device, UINT x, UINT y, UINT w, UINT h) { IDirect3DViewport3 *viewport; @@ -633,7 +638,7 @@ static void test_process_vertices(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1131,7 +1136,7 @@ static void test_coop_level_d3d_state(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1353,7 +1358,7 @@ static void test_depth_blit(void) D3DRECT d3drect;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1612,7 +1617,7 @@ static void test_viewport_object(void) } desc;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1926,7 +1931,7 @@ static void test_zenable(void) UINT i, j;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2025,7 +2030,7 @@ static void test_ck_rgba(void) UINT i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2157,7 +2162,7 @@ static void test_ck_default(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2258,7 +2263,7 @@ static void test_ck_complex(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) + if (!(device = create_device_hal(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2488,7 +2493,7 @@ static void test_surface_qi(void) /* Try to create a D3D device to see if the ddraw implementation supports * D3D. 64-bit ddraw in particular doesn't seem to support D3D, and * doesn't support e.g. the IDirect3DTexture interfaces. */ - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2570,7 +2575,7 @@ static void test_device_qi(void) HWND window;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -3934,7 +3939,7 @@ static void test_vb_discard(void) unsigned int i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -4041,7 +4046,7 @@ static void test_draw_strided(void) static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -4214,7 +4219,7 @@ static void test_lighting(void) *dst_data;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -4696,7 +4701,7 @@ static void test_specular_lighting(void) WORD *indices;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -4883,7 +4888,7 @@ static void test_clear_rect_count(void) static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -5189,7 +5194,7 @@ static void test_lighting_interface_versions(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -5624,7 +5629,7 @@ static void test_block_formats_creation(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -5848,7 +5853,7 @@ static void test_unsupported_formats(void) static const DWORD caps[] = {0, DDSCAPS_SYSTEMMEMORY, DDSCAPS_VIDEOMEMORY};
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -6563,7 +6568,7 @@ static void test_surface_discard(void) unsigned int i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -8733,7 +8738,7 @@ static void test_material(void) static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -9319,7 +9324,7 @@ static void test_vb_writeonly(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -9671,7 +9676,7 @@ static void test_texturemapblend(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -10183,7 +10188,7 @@ static void test_signed_formats(void) D3DDEVICEDESC device_desc, hel_desc;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -10494,7 +10499,7 @@ static void test_color_fill(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -10882,7 +10887,7 @@ static void test_texcoordindex(void) DWORD *ptr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -11107,7 +11112,7 @@ static void test_colorkey_precision(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -11517,7 +11522,7 @@ static void test_shademode(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -12097,7 +12102,7 @@ static void test_blt(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -12266,7 +12271,7 @@ static void test_cross_device_blt(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) + if (!(device = create_device_hal(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device.\n"); DestroyWindow(window); @@ -12274,7 +12279,7 @@ static void test_cross_device_blt(void) }
window2 = create_window(); - if (!(device2 = create_device(window2, DDSCL_NORMAL))) + if (!(device2 = create_device_hal(window2, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); IDirect3DDevice3_Release(device); @@ -12413,7 +12418,7 @@ static void test_color_clamping(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -12844,7 +12849,7 @@ static void test_draw_primitive(void) void *data;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -12975,7 +12980,7 @@ static void test_edge_antialiasing_blending(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); DestroyWindow(window); @@ -13263,7 +13268,7 @@ static void test_transform_vertices(void) }
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); DestroyWindow(window); @@ -14665,7 +14670,7 @@ static void test_vb_refcount(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -14779,7 +14784,7 @@ static void test_compute_sphere_visibility(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -14827,7 +14832,7 @@ static void test_texture_stages_limits(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -14877,7 +14882,7 @@ static void test_set_render_state(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -14970,7 +14975,7 @@ static void test_map_synchronisation(void) window = create_window(); ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a D3D device, skipping tests.\n"); DestroyWindow(window); @@ -15146,7 +15151,7 @@ static void test_depth_readback(void) window = create_window(); ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a D3D device, skipping tests.\n"); DestroyWindow(window); @@ -15271,7 +15276,7 @@ static void test_clear(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -15588,7 +15593,7 @@ static void test_viewport(void)
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -15862,7 +15867,7 @@ static void test_find_device(void) hr = IDirect3D3_FindDevice(d3d, &search, &result);
window = create_window(); - device = create_device(window, DDSCL_NORMAL); + device = create_device_hal(window, DDSCL_NORMAL); if (hr == D3D_OK) ok(!!device, "Failed to create a 3D device.\n"); else @@ -15975,7 +15980,7 @@ static void test_sysmem_draw(void) window = create_window(); ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -16214,7 +16219,7 @@ static void test_alphatest(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); DestroyWindow(window); @@ -16807,7 +16812,7 @@ static void test_surface_format_conversion_alpha(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d921746152..03c109125f 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -348,7 +348,7 @@ static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7 return DDENUMRET_OK; }
-static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) +static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level, REFCLSID riid) { IDirectDrawSurface7 *surface, *ds; IDirect3DDevice7 *device = NULL; @@ -357,8 +357,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) IDirectDraw7 *ddraw; IDirect3D7 *d3d7; HRESULT hr; - struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE }; - const GUID *devtype = &IID_IDirect3DHALDevice; + struct { REFCLSID riid; BOOL present; } device_data = { riid, FALSE };
if (!(ddraw = create_ddraw())) return NULL; @@ -399,10 +398,15 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &device_data); ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr); - if (device_data.present) devtype = device_data.riid; + if (!device_data.present) + { + IDirect3D7_Release(d3d7); + IDirectDrawSurface7_Release(surface); + return NULL; + }
memset(&z_fmt, 0, sizeof(z_fmt)); - hr = IDirect3D7_EnumZBufferFormats(d3d7, devtype, enum_z_fmt, &z_fmt); + hr = IDirect3D7_EnumZBufferFormats(d3d7, riid, enum_z_fmt, &z_fmt); if (FAILED(hr) || !z_fmt.dwSize) { IDirect3D7_Release(d3d7); @@ -436,7 +440,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return NULL; }
- hr = IDirect3D7_CreateDevice(d3d7, devtype, surface, &device); + hr = IDirect3D7_CreateDevice(d3d7, riid, surface, &device); IDirect3D7_Release(d3d7); IDirectDrawSurface7_Release(surface); if (FAILED(hr)) @@ -445,6 +449,15 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return device; }
+static IDirect3DDevice7 *create_device_hal(HWND window, DWORD coop_level) +{ + IDirect3DDevice7 *device; + device = create_device(window, coop_level, &IID_IDirect3DTnLHalDevice); + if (!device) + device = create_device(window, coop_level, &IID_IDirect3DHALDevice); + return device; +} + struct message { UINT message; @@ -536,7 +549,7 @@ static void test_process_vertices(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1072,7 +1085,7 @@ static void test_coop_level_d3d_state(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1302,7 +1315,7 @@ static void test_depth_blit(void) HWND window;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1448,7 +1461,7 @@ static void test_texture_load_ckey(void) IDirect3D7 *d3d;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1545,7 +1558,7 @@ static void test_zenable(void) UINT i, j;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1636,7 +1649,7 @@ static void test_ck_rgba(void) UINT i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1756,7 +1769,7 @@ static void test_ck_default(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -1850,7 +1863,7 @@ static void test_ck_complex(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) + if (!(device = create_device_hal(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2134,7 +2147,7 @@ static void test_surface_qi(void) /* Try to create a D3D device to see if the ddraw implementation supports * D3D. 64-bit ddraw in particular doesn't seem to support D3D, and * doesn't support e.g. the IDirect3DTexture interfaces. */ - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -2216,7 +2229,7 @@ static void test_device_qi(void) HWND window;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -3579,7 +3592,7 @@ static void test_vb_discard(void) unsigned int i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -3684,7 +3697,7 @@ static void test_draw_strided(void) D3DDRAWPRIMITIVESTRIDEDDATA strided;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -3853,7 +3866,7 @@ static void test_lighting(void) *dst_data;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -4355,7 +4368,7 @@ static void test_specular_lighting(void) } *dst_data;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -4516,7 +4529,7 @@ static void test_clear_rect_count(void) D3DRECT rect = {{0}, {0}, {640}, {480}};
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -4720,7 +4733,7 @@ static void test_fog_special(void) IDirectDrawSurface7 *rt;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -4913,7 +4926,7 @@ static void test_lighting_interface_versions(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -5352,7 +5365,7 @@ static void test_block_formats_creation(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -5576,7 +5589,7 @@ static void test_unsupported_formats(void) static const DWORD caps[] = {0, DDSCAPS_SYSTEMMEMORY, DDSCAPS_VIDEOMEMORY};
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -6374,7 +6387,7 @@ static void test_surface_discard(void) unsigned int i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -6701,7 +6714,7 @@ static void test_flip(void) IDirectDrawSurface7_Release(frontbuffer); }
- if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); goto done; @@ -8549,7 +8562,7 @@ static void test_material(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -9072,7 +9085,7 @@ static void test_vb_writeonly(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -9569,7 +9582,7 @@ static void test_fog_interpolation(void) D3DDEVICEDESC7 caps;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -9724,7 +9737,7 @@ static void test_fog_process_vertices(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -9909,7 +9922,7 @@ static void test_negative_fixedfunction_fog(void) D3DDEVICEDESC7 caps;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -10021,7 +10034,7 @@ static void test_table_fog_zw(void) unsigned int i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -10180,7 +10193,7 @@ static void test_signed_formats(void) D3DDEVICEDESC7 device_desc;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -10470,7 +10483,7 @@ static void test_color_fill(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -10862,7 +10875,7 @@ static void test_texcoordindex(void) DWORD *ptr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -11100,7 +11113,7 @@ static void test_colorkey_precision(void) DDBLTFX fx;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -11500,7 +11513,7 @@ static void test_shademode(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -12090,7 +12103,7 @@ static void test_blt(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -12259,7 +12272,7 @@ static void test_cross_device_blt(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) + if (!(device = create_device_hal(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device.\n"); DestroyWindow(window); @@ -12267,7 +12280,7 @@ static void test_cross_device_blt(void) }
window2 = create_window(); - if (!(device2 = create_device(window2, DDSCL_NORMAL))) + if (!(device2 = create_device_hal(window2, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); IDirect3DDevice7_Release(device); @@ -12404,7 +12417,7 @@ static void test_color_clamping(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -12835,7 +12848,7 @@ static void test_draw_primitive(void) void *data;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -12962,7 +12975,7 @@ static void test_edge_antialiasing_blending(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); DestroyWindow(window); @@ -14005,7 +14018,7 @@ static void test_vb_refcount(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -14127,7 +14140,7 @@ static void test_compute_sphere_visibility(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -14174,7 +14187,7 @@ static void test_clip_planes_limits(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -14245,7 +14258,7 @@ static void test_texture_stages_limits(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -14292,7 +14305,7 @@ static void test_set_render_state(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -14383,7 +14396,7 @@ static void test_map_synchronisation(void) window = create_window(); ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a D3D device, skipping tests.\n"); DestroyWindow(window); @@ -14566,7 +14579,7 @@ static void test_depth_readback(void) window = create_window(); ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a D3D device, skipping tests.\n"); DestroyWindow(window); @@ -14703,7 +14716,7 @@ static void test_clear(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -14974,7 +14987,7 @@ static void test_viewport(void)
window = CreateWindowA("static", "d3d7_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -15193,7 +15206,7 @@ static void test_device_load(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -15652,7 +15665,7 @@ static void test_color_vertex(void)
window = CreateWindowA("static", "d3d7_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -15791,7 +15804,7 @@ static void test_sysmem_draw(void) window = create_window(); ok(!!window, "Failed to create a window.\n");
- if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -16019,7 +16032,7 @@ static void test_multiply_transform(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -16123,7 +16136,7 @@ static void test_alphatest(void) };
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device.\n"); DestroyWindow(window); @@ -16354,7 +16367,7 @@ static void test_begin_end_state_block(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create 3D device.\n"); DestroyWindow(window); @@ -16775,7 +16788,7 @@ static void test_surface_format_conversion_alpha(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window); @@ -16982,7 +16995,7 @@ static void test_compressed_surface_stretch(void) HRESULT hr;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) + if (!(device = create_device_hal(window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); DestroyWindow(window);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62117
Your paranoid android.
=== w2008s64 (32 bit report) ===
ddraw: ddraw1.c:2827: Test failed: Expected message 0x46, but didn't receive it. ddraw1.c:2830: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:2834: Test failed: Got unexpected screen size 1024x768.
=== w8 (32 bit report) ===
ddraw: ddraw2.c:3262: Test failed: Got unexpected hr 0x887601c2.
=== w864 (64 bit report) ===
ddraw: ddraw2.c:3244: Test failed: Failed to create surface, hr 0x887601c2. 0e8c:ddraw2: unhandled exception c0000005 at 000000000046E7CA
On Fri, Dec 13, 2019 at 6:01 AM Jeff Smith whydoubt@gmail.com wrote:
This allows the function to create devices other than HAL.
Signed-off-by: Jeff Smith whydoubt@gmail.com
dlls/ddraw/tests/ddraw1.c | 75 +++++++++++---------- dlls/ddraw/tests/ddraw2.c | 81 ++++++++++++----------- dlls/ddraw/tests/ddraw4.c | 101 ++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 135 +++++++++++++++++++++----------------- 4 files changed, 210 insertions(+), 182 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 3a27e91aa1..862c98353e 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -513,7 +513,7 @@ static IDirectDraw *create_ddraw(void) return ddraw; }
-static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level) +static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level, REFCLSID riid) { /* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask * for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports @@ -573,7 +573,7 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo if (FAILED(hr)) continue;
if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device)))
if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device))) break; IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
@@ -583,6 +583,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo return device; }
+static IDirect3DDevice *create_device_hal(IDirectDraw *ddraw, HWND window, DWORD coop_level) +{
- return create_device(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
+}
Just an idea: what about introducing a create_device_riid() and keep create_device() for the HAL case (i.e. rename your create_device() to create_device_riid() and create_device_hal() to create_device())? That way you don't have to change all the current callers of create_device().
On Wed, Jan 22, 2020 at 9:54 AM Matteo Bruni matteo.mystral@gmail.com wrote:
On Fri, Dec 13, 2019 at 6:01 AM Jeff Smith whydoubt@gmail.com wrote:
This allows the function to create devices other than HAL.
Signed-off-by: Jeff Smith whydoubt@gmail.com
dlls/ddraw/tests/ddraw1.c | 75 +++++++++++---------- dlls/ddraw/tests/ddraw2.c | 81 ++++++++++++----------- dlls/ddraw/tests/ddraw4.c | 101 ++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 135 +++++++++++++++++++++----------------- 4 files changed, 210 insertions(+), 182 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 3a27e91aa1..862c98353e 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -513,7 +513,7 @@ static IDirectDraw *create_ddraw(void) return ddraw; }
-static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level) +static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level, REFCLSID riid) { /* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask * for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports @@ -573,7 +573,7 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo if (FAILED(hr)) continue;
if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device)))
if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device))) break; IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
@@ -583,6 +583,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo return device; }
+static IDirect3DDevice *create_device_hal(IDirectDraw *ddraw, HWND window, DWORD coop_level) +{
- return create_device(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
+}
Just an idea: what about introducing a create_device_riid() and keep create_device() for the HAL case (i.e. rename your create_device() to create_device_riid() and create_device_hal() to create_device())? That way you don't have to change all the current callers of create_device().
Hi Matteo,
I had considered exactly that originally, then thought perhaps the more-accurate names would be worth the noise. I am fine with changing it back. Before I resubmit the patchset, did you have any other feedback on it?
Thanks, Jeff
On Wed, Jan 22, 2020 at 9:54 AM Matteo Bruni matteo.mystral@gmail.com wrote:
On Fri, Dec 13, 2019 at 6:01 AM Jeff Smith whydoubt@gmail.com wrote: Just an idea: what about introducing a create_device_riid() and keep create_device() for the HAL case (i.e. rename your create_device() to create_device_riid() and create_device_hal() to create_device())? That way you don't have to change all the current callers of create_device().
Hi Matteo,
I had considered exactly that originally, then thought perhaps the more-accurate names would be worth the noise. I am fine with changing it back. Before I resubmit the patchset, did you have any other feedback on it?
Thanks, Jeff
I don't know that it necessarily needs to be changed back, just something that I noticed in passing when looking at your patches a while back. Henri might have a stronger opinion though.
I don't think I had anything else to say, although it's been a while since I looked... Skimming through the patches very quickly now, the "while (IDirectDrawPalette_Release(palette) > refcount) ;" in patch 5/7 looks particularly obnoxious but I imagine also unavoidable (and relevant, in the sense "ah, that might be why some games did exactly that in ddraw back then...").
On Wed, Jan 22, 2020 at 11:32 AM Matteo Bruni matteo.mystral@gmail.com wrote:
On Wed, Jan 22, 2020 at 9:54 AM Matteo Bruni matteo.mystral@gmail.com wrote:
On Fri, Dec 13, 2019 at 6:01 AM Jeff Smith whydoubt@gmail.com wrote: Just an idea: what about introducing a create_device_riid() and keep create_device() for the HAL case (i.e. rename your create_device() to create_device_riid() and create_device_hal() to create_device())? That way you don't have to change all the current callers of create_device().
Hi Matteo,
I had considered exactly that originally, then thought perhaps the more-accurate names would be worth the noise. I am fine with changing it back. Before I resubmit the patchset, did you have any other feedback on it?
Thanks, Jeff
I don't know that it necessarily needs to be changed back, just something that I noticed in passing when looking at your patches a while back. Henri might have a stronger opinion though.
OK, I suppose I will hold off on that for now then.
I don't think I had anything else to say, although it's been a while since I looked... Skimming through the patches very quickly now, the "while (IDirectDrawPalette_Release(palette) > refcount) ;" in patch 5/7 looks particularly obnoxious but I imagine also unavoidable (and relevant, in the sense "ah, that might be why some games did exactly that in ddraw back then...").
Yeah, that one was a bit frustrating... all the appropriate Release calls had been made, and several objects still wouldn't get to refcount 0.
This allows the test to be performed on devices other than HAL.
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/tests/ddraw1.c | 40 +++++++++++++---------- dlls/ddraw/tests/ddraw2.c | 61 +++++++++++++++++++--------------- dlls/ddraw/tests/ddraw4.c | 57 ++++++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 69 +++++++++++++++++++++++---------------- 4 files changed, 129 insertions(+), 98 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 862c98353e..9b0ee8e553 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(void) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; @@ -4057,9 +4057,9 @@ static void test_rt_caps(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device(ddraw, window, DDSCL_NORMAL, riid))) { - skip("Failed to create a 3D device, skipping test.\n"); + skip("Failed to create a (%s) 3D device, skipping test.\n", device_name); IDirectDraw_Release(ddraw); DestroyWindow(window); return; @@ -4096,40 +4096,41 @@ static void test_rt_caps(void) surface_desc.dwHeight = 480; hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL); ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail), - "Test %u: Failed to create surface with caps %#x, hr %#x.\n", - i, test_data[i].caps_in, hr); + "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", + device_name, i, test_data[i].caps_in, hr); if (FAILED(hr)) continue;
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); - ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr); + ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr); ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out, - "Test %u: Got unexpected caps %#x, expected %#x.\n", - i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out); + "Test %s %u: Got unexpected caps %#x, expected %#x.\n", + device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device); - ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", - i, hr, test_data[i].create_device_hr); + 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); if (hr == DDERR_NOPALETTEATTACHED) { hr = IDirectDrawSurface_SetPalette(surface, palette); - ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr); - hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device); + ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); + hr = IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device); if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) - ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); else - ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); } if (SUCCEEDED(hr)) { refcount = IDirect3DDevice_Release(device); - ok(refcount == 1, "Test %u: Got unexpected refcount %u.\n", i, refcount); + ok(refcount == 1, "Test %s %u: Got unexpected refcount %u.\n", device_name, i, refcount); }
refcount = IDirectDrawSurface_Release(surface); - ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount); + ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n", + device_name, i, refcount); }
IDirectDrawPalette_Release(palette); @@ -4138,6 +4139,11 @@ static void test_rt_caps(void) DestroyWindow(window); }
+static void test_rt_caps(void) +{ + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); +} + static void test_primary_caps(void) { const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index fbce6cb9c2..3c5485af96 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(void) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; @@ -4519,9 +4519,9 @@ static void test_rt_caps(void) window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device_hal(ddraw, window, DDSCL_NORMAL))) + if (!(device = create_device(ddraw, window, DDSCL_NORMAL, riid))) { - skip("Failed to create a 3D device, skipping test.\n"); + skip("Failed to create a (%s) 3D device, skipping test.\n", device_name); IDirectDraw2_Release(ddraw); DestroyWindow(window); return; @@ -4564,33 +4564,33 @@ static void test_rt_caps(void) surface_desc.dwHeight = 480; hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL); ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail), - "Test %u: Failed to create surface with caps %#x, hr %#x.\n", - i, test_data[i].caps_in, hr); + "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", + device_name, i, test_data[i].caps_in, hr); if (FAILED(hr)) continue;
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); - ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr); + ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr); ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out, - "Test %u: Got unexpected caps %#x, expected %#x.\n", - i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out); + "Test %s %u: Got unexpected caps %#x, expected %#x.\n", + device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device); - ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", - i, hr, test_data[i].create_device_hr); + 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); if (FAILED(hr)) { if (hr == DDERR_NOPALETTEATTACHED) { hr = IDirectDrawSurface_SetPalette(surface, palette); - ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr); - hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device); + ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); + hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device); if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) - ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); else - ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); } IDirectDrawSurface_Release(surface);
@@ -4601,10 +4601,10 @@ static void test_rt_caps(void) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr); + ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device); - ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr); + hr = IDirect3D2_CreateDevice(d3d, riid, surface, &device); + ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr); }
memset(&surface_desc, 0, sizeof(surface_desc)); @@ -4624,13 +4624,13 @@ static void test_rt_caps(void) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &rt, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n", - i, test_data[i].caps_in, hr); + 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);
hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0); ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr), - "Test %u: Got unexpected hr %#x, expected %#x.\n", - i, 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); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT) expected_rt = rt; else @@ -4641,19 +4641,21 @@ static void test_rt_caps(void) if (hr == DDERR_INVALIDPIXELFORMAT) { refcount = IDirectDrawSurface_AddRef(rt); - ok(refcount == 2, "Test %u: Got unexpected refcount %u.\n", i, refcount); + ok(refcount == 2, "Test %s %u: Got unexpected refcount %u.\n", device_name, i, refcount); }
hr = IDirect3DDevice2_GetRenderTarget(device, &tmp); - ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr); - ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp); + ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr); + ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
IDirectDrawSurface_Release(tmp); IDirectDrawSurface_Release(rt); refcount = IDirect3DDevice2_Release(device); - ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount); + ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n", + device_name, i, refcount); refcount = IDirectDrawSurface_Release(surface); - ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount); + ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n", + device_name, i, refcount); }
IDirectDrawPalette_Release(palette); @@ -4665,6 +4667,11 @@ done: DestroyWindow(window); }
+static void test_rt_caps(void) +{ + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); +} + static void test_primary_caps(void) { const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 4e4f21686c..b4b2f15b34 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(void) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; @@ -6124,7 +6124,7 @@ static void test_rt_caps(void) }
memset(&z_fmt, 0, sizeof(z_fmt)); - hr = IDirect3D3_EnumZBufferFormats(d3d, &IID_IDirect3DHALDevice, enum_z_fmt, &z_fmt); + hr = IDirect3D3_EnumZBufferFormats(d3d, riid, enum_z_fmt, &z_fmt); if (FAILED(hr) || !z_fmt.dwSize) { skip("No depth buffer formats available, skipping test.\n"); @@ -6154,31 +6154,31 @@ static void test_rt_caps(void) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n", - i, test_data[i].caps_in, hr); + 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);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc); - ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr); + ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr); ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out, - "Test %u: Got unexpected caps %#x, expected %#x.\n", - i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out); + "Test %s %u: Got unexpected caps %#x, expected %#x.\n", + device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL); - ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", - i, hr, test_data[i].create_device_hr); + 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); if (FAILED(hr)) { if (hr == DDERR_NOPALETTEATTACHED) { hr = IDirectDrawSurface4_SetPalette(surface, palette); - ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr); - hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL); + ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); + hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL); if (surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) - ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); else - ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); } IDirectDrawSurface4_Release(surface);
@@ -6189,10 +6189,10 @@ static void test_rt_caps(void) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr); + ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D3_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr); + hr = IDirect3D3_CreateDevice(d3d, riid, surface, &device, NULL); + ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr); }
memset(&surface_desc, 0, sizeof(surface_desc)); @@ -6207,28 +6207,30 @@ static void test_rt_caps(void) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &rt, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n", - i, test_data[i].caps_in, hr); + 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);
hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0); ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr), - "Test %u: Got unexpected hr %#x, expected %#x.\n", - i, 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); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT) expected_rt = rt; else expected_rt = surface;
hr = IDirect3DDevice3_GetRenderTarget(device, &tmp); - ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr); - ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp); + ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr); + ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
IDirectDrawSurface4_Release(tmp); IDirectDrawSurface4_Release(rt); refcount = IDirect3DDevice3_Release(device); - ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount); + ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n", + device_name, i, refcount); refcount = IDirectDrawSurface4_Release(surface); - ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount); + ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n", + device_name, i, refcount); }
IDirectDrawPalette_Release(palette); @@ -6240,6 +6242,11 @@ done: DestroyWindow(window); }
+static void test_rt_caps(void) +{ + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); +} + static void test_primary_caps(void) { const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 03c109125f..94618c0178 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -5657,13 +5657,12 @@ static void test_unsupported_formats(void) DestroyWindow(window); }
-static void test_rt_caps(void) +static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { - const GUID *devtype = &IID_IDirect3DHALDevice; PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; IDirectDraw7 *ddraw; - struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE }; + struct { REFCLSID riid; BOOL present; } device_data = { riid, FALSE }; DDPIXELFORMAT z_fmt; IDirect3D7 *d3d; unsigned int i; @@ -5863,11 +5862,15 @@ static void test_rt_caps(void)
hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data); ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr); - if (device_data.present) - devtype = device_data.riid; + if (!device_data.present) + { + skip("Failed to enumerate %s device, skipping test.\n", device_name); + IDirect3D7_Release(d3d); + goto done; + }
memset(&z_fmt, 0, sizeof(z_fmt)); - hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt); + hr = IDirect3D7_EnumZBufferFormats(d3d, riid, enum_z_fmt, &z_fmt); if (FAILED(hr) || !z_fmt.dwSize) { skip("No depth buffer formats available, skipping test.\n"); @@ -5897,31 +5900,31 @@ static void test_rt_caps(void) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n", - i, test_data[i].caps_in, hr); + 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);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc); - ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr); + ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr); ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out, - "Test %u: Got unexpected caps %#x, expected %#x.\n", - i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out); + "Test %s %u: Got unexpected caps %#x, expected %#x.\n", + device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device); - ok(hr == test_data[i].create_device_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", - i, hr, test_data[i].create_device_hr); + 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); if (FAILED(hr)) { if (hr == DDERR_NOPALETTEATTACHED) { hr = IDirectDrawSurface7_SetPalette(surface, palette); - ok(SUCCEEDED(hr), "Test %u: Failed to set palette, hr %#x.\n", i, hr); - hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device); + 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 %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == DDERR_INVALIDPIXELFORMAT, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); else - ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == D3DERR_SURFACENOTINVIDMEM, "Test %s %u: Got unexpected hr %#x.\n", device_name, i, hr); } IDirectDrawSurface7_Release(surface);
@@ -5932,10 +5935,10 @@ static void test_rt_caps(void) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create surface, hr %#x.\n", i, hr); + ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface, hr %#x.\n", device_name, i, hr);
- hr = IDirect3D7_CreateDevice(d3d, devtype, surface, &device); - ok(SUCCEEDED(hr), "Test %u: Failed to create device, hr %#x.\n", i, hr); + hr = IDirect3D7_CreateDevice(d3d, riid, surface, &device); + ok(SUCCEEDED(hr), "Test %s %u: Failed to create device, hr %#x.\n", device_name, i, hr); }
memset(&surface_desc, 0, sizeof(surface_desc)); @@ -5950,28 +5953,30 @@ static void test_rt_caps(void) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &rt, NULL); - ok(SUCCEEDED(hr), "Test %u: Failed to create surface with caps %#x, hr %#x.\n", - i, test_data[i].caps_in, hr); + 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);
hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0); ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr), - "Test %u: Got unexpected hr %#x, expected %#x.\n", - i, 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); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT) expected_rt = rt; else expected_rt = surface;
hr = IDirect3DDevice7_GetRenderTarget(device, &tmp); - ok(SUCCEEDED(hr), "Test %u: Failed to get render target, hr %#x.\n", i, hr); - ok(tmp == expected_rt, "Test %u: Got unexpected rt %p.\n", i, tmp); + ok(SUCCEEDED(hr), "Test %s %u: Failed to get render target, hr %#x.\n", device_name, i, hr); + ok(tmp == expected_rt, "Test %s %u: Got unexpected rt %p.\n", device_name, i, tmp);
IDirectDrawSurface7_Release(tmp); IDirectDrawSurface7_Release(rt); refcount = IDirect3DDevice7_Release(device); - ok(refcount == 0, "Test %u: The device was not properly freed, refcount %u.\n", i, refcount); + ok(refcount == 0, "Test %s %u: The device was not properly freed, refcount %u.\n", + device_name, i, refcount); refcount = IDirectDrawSurface7_Release(surface); - ok(refcount == 0, "Test %u: The surface was not properly freed, refcount %u.\n", i, refcount); + ok(refcount == 0, "Test %s %u: The surface was not properly freed, refcount %u.\n", + device_name, i, refcount); }
IDirectDrawPalette_Release(palette); @@ -5983,6 +5988,12 @@ done: DestroyWindow(window); }
+static void test_rt_caps(void) +{ + test_rt_caps_riid(&IID_IDirect3DTnLHalDevice, "TnLHal"); + test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL"); +} + static void test_primary_caps(void) { const DWORD placement = DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62118
Your paranoid android.
=== w864 (64 bit report) ===
ddraw: ddraw1.c:3178: Test failed: Failed to create surface, hr 0x887601c2. 0c50:ddraw1: unhandled exception c0000005 at 000000000043A15A
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/tests/ddraw1.c | 35 +++++++--------------- dlls/ddraw/tests/ddraw2.c | 63 +++++++++------------------------------ dlls/ddraw/tests/ddraw4.c | 41 ++++++++++--------------- dlls/ddraw/tests/ddraw7.c | 43 +++++++++++--------------- 4 files changed, 59 insertions(+), 123 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 9b0ee8e553..66b84edf45 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -3908,7 +3908,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DWORD caps_in; DWORD caps_out; HRESULT create_device_hr; - BOOL create_may_fail; + BOOL broken_create_surface; + BOOL broken_surface_caps; } test_data[] = { @@ -3917,126 +3918,112 @@ 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, - FALSE, }, { NULL, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, - FALSE, }, { NULL, DDSCAPS_OFFSCREENPLAIN, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, - FALSE, }, { NULL, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, D3DERR_SURFACENOTINVIDMEM, - FALSE, }, { NULL, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, - FALSE, }, { NULL, DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY, DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, - FALSE, }, { NULL, DDSCAPS_3DDEVICE, DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, - FALSE, }, { NULL, 0, DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, - FALSE, }, { NULL, DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, D3DERR_SURFACENOTINVIDMEM, - FALSE, }, { NULL, DDSCAPS_SYSTEMMEMORY, DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, - FALSE, }, { &p8_fmt, 0, DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, - FALSE, }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, - ~0U /* AMD r200 */ , + DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY, DDERR_NOPALETTEATTACHED, - FALSE, + FALSE, TRUE /* AMD r200 */ }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, - FALSE, }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDERR_NOPALETTEATTACHED, - FALSE, }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, - FALSE, }, { NULL, DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER, DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, - TRUE /* AMD Evergreen */, + TRUE }, { NULL, DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER, - ~0U /* AMD Evergreen */, + DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, - FALSE, + FALSE, TRUE }, { NULL, DDSCAPS_ZBUFFER, - ~0U /* AMD Evergreen */, + DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, - FALSE, + FALSE, TRUE }, { NULL, @@ -4095,7 +4082,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail), + ok(SUCCEEDED(hr) || broken(test_data[i].broken_create_surface), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", device_name, i, test_data[i].caps_in, hr); if (FAILED(hr)) @@ -4105,7 +4092,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr); - ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out, + ok(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out || broken(test_data[i].broken_surface_caps), "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 3c5485af96..2bd56b7afd 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -4329,8 +4329,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DWORD caps_out; HRESULT create_device_hr; HRESULT set_rt_hr; - HRESULT alternative_set_rt_hr; - BOOL create_may_fail; + BOOL broken_create_surface; + BOOL broken_surface_caps; } test_data[] = { @@ -4340,8 +4340,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, - FALSE, }, { NULL, @@ -4349,8 +4347,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, - FALSE, }, { NULL, @@ -4358,8 +4354,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, }, { NULL, @@ -4367,8 +4361,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, D3DERR_SURFACENOTINVIDMEM, D3D_OK, - D3D_OK, - FALSE, }, { NULL, @@ -4376,8 +4368,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, }, { NULL, @@ -4385,8 +4375,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, - FALSE, }, { NULL, @@ -4394,8 +4382,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, - FALSE, }, { NULL, @@ -4403,8 +4389,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, }, { NULL, @@ -4412,8 +4396,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, D3DERR_SURFACENOTINVIDMEM, D3D_OK, - D3D_OK, - FALSE, }, { NULL, @@ -4421,8 +4403,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, }, { &p8_fmt, @@ -4430,17 +4410,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, - ~0U /* AMD r200 */, + DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY, DDERR_NOPALETTEATTACHED, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, + FALSE, TRUE /* AMD r200 */ }, { &p8_fmt, @@ -4448,8 +4425,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, }, { &p8_fmt, @@ -4457,8 +4432,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDERR_NOPALETTEATTACHED, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, }, { &p8_fmt, @@ -4466,8 +4439,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - FALSE, }, { NULL, @@ -4475,26 +4446,23 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, - DDERR_INVALIDCAPS, - TRUE /* AMD Evergreen */, + TRUE }, { NULL, DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER, - ~0U /* AMD Evergreen */, + DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, - DDERR_INVALIDCAPS, - FALSE, + FALSE, TRUE }, { NULL, DDSCAPS_ZBUFFER, - ~0U /* AMD Evergreen */, - DDERR_INVALIDCAPS, + DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - FALSE, + FALSE, TRUE }, { NULL, @@ -4502,8 +4470,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, - DDERR_INVALIDPIXELFORMAT, - TRUE /* Nvidia Kepler */, + TRUE /* Nvidia Kepler */ }, { NULL, @@ -4511,8 +4478,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, - TRUE /* Nvidia Kepler */, + TRUE /* Nvidia Kepler */ }, };
@@ -4563,7 +4529,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr) || broken(test_data[i].create_may_fail), + ok(SUCCEEDED(hr) || broken(test_data[i].broken_create_surface), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", device_name, i, test_data[i].caps_in, hr); if (FAILED(hr)) @@ -4573,7 +4539,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr); - ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out, + ok(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out || broken(test_data[i].broken_surface_caps), "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
@@ -4628,8 +4594,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0); - ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr), - "Test %s %u: Got unexpected hr %#x, expected %#x.\n", + 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); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT) expected_rt = rt; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index b4b2f15b34..0ab8c74dab 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -5945,7 +5945,10 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DWORD caps_in; DWORD caps_out; HRESULT create_device_hr; - HRESULT set_rt_hr, alternative_set_rt_hr; + HRESULT set_rt_hr; + BOOL broken_create_surface; + BOOL broken_surface_caps; + BOOL broken_set_target_ok; } test_data[] = { @@ -5955,7 +5958,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, }, { NULL, @@ -5963,7 +5965,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, }, { NULL, @@ -5971,7 +5972,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { NULL, @@ -5979,7 +5979,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, D3DERR_SURFACENOTINVIDMEM, D3D_OK, - D3D_OK, }, { NULL, @@ -5987,7 +5986,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { NULL, @@ -5995,7 +5993,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, }, { NULL, @@ -6003,7 +6000,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, }, { NULL, @@ -6011,7 +6007,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { NULL, @@ -6019,7 +6014,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, D3DERR_SURFACENOTINVIDMEM, D3D_OK, - D3D_OK, }, { NULL, @@ -6027,7 +6021,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &p8_fmt, @@ -6035,15 +6028,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, - ~0U /* AMD r200 */, + DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY, DDERR_NOPALETTEATTACHED, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, + FALSE, TRUE /* AMD r200 */ }, { &p8_fmt, @@ -6051,7 +6043,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &p8_fmt, @@ -6059,7 +6050,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDERR_NOPALETTEATTACHED, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &p8_fmt, @@ -6067,7 +6057,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &z_fmt, @@ -6075,7 +6064,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, - D3D_OK /* r200 */, + FALSE, FALSE, TRUE }, { &z_fmt, @@ -6083,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, - D3D_OK /* r200 */, + FALSE, FALSE, TRUE }, { &z_fmt, @@ -6091,7 +6080,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &z_fmt, @@ -6099,7 +6087,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, - D3D_OK /* r200 */, + FALSE, FALSE, TRUE }, { &z_fmt, @@ -6107,7 +6095,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, };
@@ -6154,14 +6141,17 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", + ok(SUCCEEDED(hr) || broken(test_data[i].broken_create_surface), + "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", device_name, i, test_data[i].caps_in, hr); + if (FAILED(hr)) + continue;
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc); ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr); - ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out, + ok(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out || broken(test_data[i].broken_surface_caps), "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
@@ -6211,7 +6201,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0); - ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr), + ok(hr == test_data[i].set_rt_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); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT) diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 94618c0178..f2552ad491 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -5682,7 +5682,11 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DWORD caps_in; DWORD caps_out; HRESULT create_device_hr; - HRESULT set_rt_hr, alternative_set_rt_hr; + HRESULT set_rt_hr; + BOOL broken_create_surface; + BOOL broken_surface_caps; + BOOL broken_set_target_ok; + BOOL broken_set_target_ivpf; } test_data[] = { @@ -5692,7 +5696,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, }, { NULL, @@ -5700,7 +5703,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, }, { NULL, @@ -5708,7 +5710,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { NULL, @@ -5716,7 +5717,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, D3DERR_SURFACENOTINVIDMEM, DDERR_INVALIDPARAMS, - D3D_OK, + FALSE, FALSE, TRUE }, { NULL, @@ -5724,7 +5725,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { NULL, @@ -5732,7 +5732,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, }, { NULL, @@ -5740,7 +5739,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, D3D_OK, D3D_OK, - D3D_OK, }, { NULL, @@ -5748,7 +5746,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { NULL, @@ -5756,7 +5753,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, D3DERR_SURFACENOTINVIDMEM, DDERR_INVALIDPARAMS, - D3D_OK, + FALSE, FALSE, TRUE }, { NULL, @@ -5764,7 +5761,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &p8_fmt, @@ -5772,15 +5768,14 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &p8_fmt, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, - ~0U /* AMD r200 */, + DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY, DDERR_NOPALETTEATTACHED, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, + FALSE, TRUE /* AMD r200 */ }, { &p8_fmt, @@ -5788,7 +5783,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &p8_fmt, @@ -5796,7 +5790,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE, DDERR_NOPALETTEATTACHED, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &p8_fmt, @@ -5804,7 +5797,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &z_fmt, @@ -5812,7 +5804,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, - DDERR_INVALIDPIXELFORMAT, }, { &z_fmt, @@ -5820,7 +5811,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDPIXELFORMAT, - DDERR_INVALIDPIXELFORMAT, }, { &z_fmt, @@ -5828,7 +5818,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_VIDEOMEMORY | DDSCAPS_ZBUFFER | DDSCAPS_LOCALVIDMEM, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, { &z_fmt, @@ -5836,7 +5825,7 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_3DDEVICE | DDSCAPS_ZBUFFER, DDERR_INVALIDCAPS, DDERR_INVALIDPARAMS, - DDERR_INVALIDPIXELFORMAT, + FALSE, FALSE, FALSE, TRUE }, { &z_fmt, @@ -5844,7 +5833,6 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER, DDERR_INVALIDCAPS, DDERR_INVALIDCAPS, - DDERR_INVALIDCAPS, }, };
@@ -5900,14 +5888,17 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) surface_desc.dwWidth = 640; surface_desc.dwHeight = 480; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); - ok(SUCCEEDED(hr), "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", + ok(SUCCEEDED(hr) || broken(test_data[i].broken_create_surface), + "Test %s %u: Failed to create surface with caps %#x, hr %#x.\n", device_name, i, test_data[i].caps_in, hr); + if (FAILED(hr)) + continue;
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc); ok(SUCCEEDED(hr), "Test %s %u: Failed to get surface desc, hr %#x.\n", device_name, i, hr); - ok(test_data[i].caps_out == ~0U || surface_desc.ddsCaps.dwCaps == test_data[i].caps_out, + ok(surface_desc.ddsCaps.dwCaps == test_data[i].caps_out || broken(test_data[i].broken_surface_caps), "Test %s %u: Got unexpected caps %#x, expected %#x.\n", device_name, i, surface_desc.ddsCaps.dwCaps, test_data[i].caps_out);
@@ -5957,7 +5948,9 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) device_name, i, test_data[i].caps_in, hr);
hr = IDirect3DDevice7_SetRenderTarget(device, rt, 0); - ok(hr == test_data[i].set_rt_hr || broken(hr == test_data[i].alternative_set_rt_hr), + ok(hr == test_data[i].set_rt_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); if (SUCCEEDED(hr) || hr == DDERR_INVALIDPIXELFORMAT)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62119
Your paranoid android.
=== w1064v1507 (32 bit report) ===
ddraw: 0c9c:ddraw2: unhandled exception c0000005 at 730B7F2E
=== w1064v1809 (32 bit report) ===
ddraw: ddraw4.c:15936: Test failed: WM_KILLFOCUS was not received. ddraw4.c:16113: Test failed: Got unexpected hr 0x887600e1. ddraw4.c:16116: Test failed: Got unexpected hr 0x887600ff. 1984:ddraw4: unhandled exception c0000005 at 00489FAF
=== w864 (64 bit report) ===
ddraw: ddraw7.c:3135: Test failed: Failed to create surface, hr 0x887601c2. 0c20:ddraw7: unhandled exception c0000005 at 00000000004EC418
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/tests/ddraw1.c | 7 ++++++- dlls/ddraw/tests/ddraw2.c | 28 +++++++++++++++++----------- dlls/ddraw/tests/ddraw4.c | 28 +++++++++++++++++----------- dlls/ddraw/tests/ddraw7.c | 23 ++++++++++++----------- 4 files changed, 52 insertions(+), 34 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 66b84edf45..8407290259 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -4103,11 +4103,15 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) { 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); + /* If QueryInterface is successful, it adds multiple references to palette, + * none of which are released by IDirect3DDevice_Release. */ + while (IDirectDrawPalette_Release(palette) > refcount) ; } if (SUCCEEDED(hr)) { @@ -4120,7 +4124,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) device_name, i, refcount); }
- IDirectDrawPalette_Release(palette); + refcount = IDirectDrawPalette_Release(palette); + ok(refcount == 0, "The palette object was not properly freed, refcount %u.\n", refcount); refcount = IDirectDraw_Release(ddraw); ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount); DestroyWindow(window); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 2bd56b7afd..0fc8e1859e 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -4546,18 +4546,23 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) 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); + if (hr == DDERR_NOPALETTEATTACHED) + { + 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); + /* If CreateDevice is successful, it adds multiple references to palette, + * only one of which is released by IDirect3DDevice2_Release. */ + if (FAILED(hr)) refcount--; + while (IDirectDrawPalette_Release(palette) > refcount) ; + } if (FAILED(hr)) { - if (hr == DDERR_NOPALETTEATTACHED) - { - hr = IDirectDrawSurface_SetPalette(surface, palette); - ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); - 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); - } IDirectDrawSurface_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc)); @@ -4623,7 +4628,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) device_name, i, refcount); }
- IDirectDrawPalette_Release(palette); + refcount = IDirectDrawPalette_Release(palette); + ok(refcount == 0, "The palette object was not properly freed, refcount %u.\n", refcount); IDirect3D2_Release(d3d);
done: diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 0ab8c74dab..2df735abea 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -6158,18 +6158,23 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) 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); + if (hr == DDERR_NOPALETTEATTACHED) + { + 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); + /* If CreateDevice is successful, it adds multiple references to palette, + * only one of which is released by IDirect3DDevice3_Release. */ + if (FAILED(hr)) refcount--; + while (IDirectDrawPalette_Release(palette) > refcount) ; + } if (FAILED(hr)) { - if (hr == DDERR_NOPALETTEATTACHED) - { - hr = IDirectDrawSurface4_SetPalette(surface, palette); - ok(SUCCEEDED(hr), "Test %s %u: Failed to set palette, hr %#x.\n", device_name, i, hr); - 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); - } IDirectDrawSurface4_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc)); @@ -6224,7 +6229,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) device_name, i, refcount); }
- IDirectDrawPalette_Release(palette); + refcount = IDirectDrawPalette_Release(palette); + ok(refcount == 0, "The palette object was not properly freed, refcount %u.\n", refcount); IDirect3D3_Release(d3d);
done: diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index f2552ad491..7a073296ca 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -5905,18 +5905,18 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) 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); + if (hr == DDERR_NOPALETTEATTACHED) + { + 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); + } if (FAILED(hr)) { - if (hr == DDERR_NOPALETTEATTACHED) - { - 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); - } IDirectDrawSurface7_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc)); @@ -5972,7 +5972,8 @@ static void test_rt_caps_riid(REFCLSID riid, const char *device_name) device_name, i, refcount); }
- IDirectDrawPalette_Release(palette); + refcount = IDirectDrawPalette_Release(palette); + ok(refcount == 0, "The palette object was not properly freed, refcount %u.\n", refcount); IDirect3D7_Release(d3d);
done:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62120
Your paranoid android.
=== w8 (32 bit report) ===
ddraw: 0cfc:ddraw2: unhandled exception c0000005 at 69DF3599
=== w8 (32 bit report) ===
ddraw: ddraw4.c:3500: Test failed: Got unexpected hr 0x887601c2.
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)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62121
Your paranoid android.
=== w1064v1507 (32 bit report) ===
ddraw: 0c68:ddraw2: unhandled exception c0000005 at 730B7F2E
=== w1064v1809 (64 bit report) ===
ddraw: ddraw4.c:15962: Test failed: WM_KILLFOCUS was not received. ddraw4.c:16139: Test failed: Got unexpected hr 0x887600e1. ddraw4.c:16142: Test failed: Got unexpected hr 0x887600ff. 1918:ddraw4: unhandled exception c0000005 at 0000000000477CD6
=== w8 (32 bit report) ===
ddraw: ddraw7.c:3992: Test failed: Lit quad without normals has color 0x0000ff00, expected 0x00000000. ddraw7.c:4005: Test failed: Lit quad with normals has color 0x0000ff00, expected 0x00000000. ddraw7.c:4050: Test failed: Lit quad with light has color 0x0000ffff. ddraw7.c:4050: Test failed: Lit quad with singular world matrix has color 0x0000ffff. ddraw7.c:4050: Test failed: Lit quad with transformation matrix has color 0x0000ffff. ddraw7.c:4050: Test failed: Lit quad with non-affine matrix has color 0x0000ff00.
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/surface.c | 3 ++- dlls/ddraw/tests/ddraw1.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index fda42f2982..0fe5a7c48c 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -216,7 +216,8 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface, { if (IsEqualGUID(riid, &IID_D3DDEVICE_WineD3D) || IsEqualGUID(riid, &IID_IDirect3DHALDevice) - || IsEqualGUID(riid, &IID_IDirect3DRGBDevice)) + || IsEqualGUID(riid, &IID_IDirect3DRGBDevice) + || (IsEqualGUID(riid, &IID_IDirect3DRampDevice) && This->version < 3)) { wined3d_mutex_lock(); if (!This->device1) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index fbf6e4d9d9..3b148a96e7 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -4149,6 +4149,7 @@ static void test_rt_caps(void) { test_rt_caps_riid(&IID_IDirect3DHALDevice, "HAL", TRUE); test_rt_caps_riid(&IID_IDirect3DRGBDevice, "RGB", FALSE); + test_rt_caps_riid(&IID_IDirect3DRampDevice, "Ramp", FALSE); }
static void test_primary_caps(void)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=62122
Your paranoid android.
=== w864 (64 bit report) ===
ddraw: ddraw1.c:3178: Test failed: Failed to create surface, hr 0x887601c2. 0c14:ddraw1: unhandled exception c0000005 at 000000000043A38A