From: Stefan Dösinger Subject: [PATCH 4/4] d3d9/tests: Check encryption support, not WARP in test_create_depth_stencil_surface_ex. Message-Id: <20170220223105.31287-4-stefandoesinger@gmx.at> Date: Mon, 20 Feb 2017 22:31:05 +0000 In-Reply-To: <20170220223105.31287-1-stefandoesinger@gmx.at> References: <20170220223105.31287-1-stefandoesinger@gmx.at> My Radeon X1600 doesn't support D3DUSAGE_RESTRICTED_CONTENT and behaves like the code expects for WARP. Signed-off-by: Stefan Dösinger --- This change intentionally accepts the success on Wine despite unsupported D3DUSAGE_RESTRICTED_CONTENT. Signed-off-by: Stefan Dösinger --- dlls/d3d9/tests/d3d9ex.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 1dbab26..d1c29cf 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -42,11 +42,6 @@ struct device_desc DWORD flags; }; -static BOOL adapter_is_warp(const D3DADAPTER_IDENTIFIER9 *identifier) -{ - return !strcmp(identifier->Driver, "d3d10warp.dll"); -} - static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { unsigned int i; @@ -661,16 +656,14 @@ static void test_create_depth_stencil_surface_ex(void) { DWORD usage; HRESULT hr; - BOOL broken_warp; } tests[] = { - {0, D3D_OK, FALSE}, - {D3DUSAGE_DEPTHSTENCIL, D3DERR_INVALIDCALL, FALSE}, - {D3DUSAGE_RESTRICTED_CONTENT, D3D_OK, TRUE}, + {0, D3D_OK}, + {D3DUSAGE_DEPTHSTENCIL, D3DERR_INVALIDCALL}, + {D3DUSAGE_RESTRICTED_CONTENT, D3D_OK}, }; - D3DADAPTER_IDENTIFIER9 identifier; D3DSURFACE_DESC surface_desc; IDirect3DDevice9Ex *device; IDirect3DSurface9 *surface; @@ -679,7 +672,7 @@ static void test_create_depth_stencil_surface_ex(void) HWND window; HRESULT hr; ULONG ref; - BOOL warp; + BOOL support_restricted_content; window = create_window(); @@ -692,9 +685,12 @@ static void test_create_depth_stencil_surface_ex(void) hr = IDirect3DDevice9Ex_GetDirect3D(device, &d3d); ok(SUCCEEDED(hr), "Failed to get Direct3D9, hr %#x.\n", hr); - hr = IDirect3D9_GetAdapterIdentifier(d3d, D3DADAPTER_DEFAULT, 0, &identifier); - ok(SUCCEEDED(hr), "Failed to get adapter identifier, hr %#x.\n", hr); - warp = adapter_is_warp(&identifier); + /* CheckDeviceFormat does not report D3DUSAGE_RESTRICTED_CONTENT support for surfaces, + * only textures. Nevertheless, the CreateDepthStencilSurfaceEx call below succeeds if + * textures support restricted content. */ + hr = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, + D3DUSAGE_RESTRICTED_CONTENT, D3DRTYPE_TEXTURE, D3DFMT_D24S8); + support_restricted_content = SUCCEEDED(hr); IDirect3D9_Release(d3d); for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) @@ -702,7 +698,8 @@ static void test_create_depth_stencil_surface_ex(void) surface = (IDirect3DSurface9 *)0xdeadbeef; hr = IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(device, 64, 64, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, TRUE, &surface, NULL, tests[i].usage); - ok(hr == tests[i].hr || broken(warp && tests[i].broken_warp), + ok(hr == tests[i].hr || (hr == D3DERR_INVALIDCALL && !support_restricted_content + && tests[i].usage & D3DUSAGE_RESTRICTED_CONTENT), "Test %u: Got unexpected hr %#x.\n", i, hr); if (SUCCEEDED(hr)) { @@ -720,7 +717,8 @@ static void test_create_depth_stencil_surface_ex(void) } else { - ok(surface == (IDirect3DSurface9 *)0xdeadbeef || broken(warp && tests[i].broken_warp), + ok(surface == (IDirect3DSurface9 *)0xdeadbeef + || broken(tests[i].usage & D3DUSAGE_RESTRICTED_CONTENT && !support_restricted_content), "Test %u: Got unexpected surface pointer %p.\n", i, surface); } } -- 2.10.2