From: Jeff Smith Subject: [PATCH 2/7] ddraw/tests: Pass in device to create with create_device. Message-Id: <20191213050008.1175341-2-whydoubt@gmail.com> Date: Thu, 12 Dec 2019 23:00:03 -0600 In-Reply-To: <20191213050008.1175341-1-whydoubt@gmail.com> References: <20191213050008.1175341-1-whydoubt@gmail.com> This allows the function to create devices other than HAL. Signed-off-by: Jeff Smith --- 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); -- 2.23.0