From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Fix tests failing on Windows + AMD.
dlls/d3d9/tests/d3d9ex.c | 16 ++++++++++------ dlls/d3d9/tests/device.c | 15 ++++++++++----- 2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 5260fcdeb40..6a9080d9a98 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -4452,18 +4452,20 @@ static void test_resource_access(void) HRESULT expected_hr; D3DLOCKED_BOX lb;
- if (tests[j].format == FORMAT_DEPTH) + if (tests[i].format == FORMAT_DEPTH) continue;
- if (tests[j].format == FORMAT_ATI2) + if (tests[i].format == FORMAT_ATI2) format = MAKEFOURCC('A','T','I','2'); else format = colour_format;
hr = IDirect3DDevice9Ex_CreateVolumeTexture(device, 16, 16, 1, 1, tests[i].usage, format, tests[i].pool, &texture, NULL); - ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) && tests[i].pool != D3DPOOL_MANAGED - ? D3D_OK : D3DERR_INVALIDCALL), + ok((hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) + && (tests[i].format != FORMAT_ATI2 || tests[i].pool == D3DPOOL_SCRATCH) + && tests[i].pool != D3DPOOL_MANAGED ? D3D_OK : D3DERR_INVALIDCALL)) + || (tests[i].format == FORMAT_ATI2 && hr == D3D_OK), "Test %u: Got unexpected hr %#x.\n", i, hr); if (FAILED(hr)) continue; @@ -4481,9 +4483,11 @@ static void test_resource_access(void) expected_hr = D3D_OK; else expected_hr = D3DERR_INVALIDCALL; - ok(hr == expected_hr, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == expected_hr || (volume_desc.Pool == D3DPOOL_DEFAULT && hr == D3D_OK), + "Test %u: Got unexpected hr %#x.\n", i, hr); hr = IDirect3DVolume9_UnlockBox(volume); - ok(hr == expected_hr, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == expected_hr || (volume_desc.Pool == D3DPOOL_DEFAULT && hr == D3D_OK), + "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDirect3DDevice9Ex_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture); ok(hr == D3D_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 9064a6701af..72559b65d4a 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -12948,17 +12948,20 @@ static void test_resource_access(void) HRESULT expected_hr; D3DLOCKED_BOX lb;
- if (tests[j].format == FORMAT_DEPTH) + if (tests[i].format == FORMAT_DEPTH) continue;
- if (tests[j].format == FORMAT_ATI2) + if (tests[i].format == FORMAT_ATI2) format = MAKEFOURCC('A','T','I','2'); else format = colour_format;
hr = IDirect3DDevice9_CreateVolumeTexture(device, 16, 16, 1, 1, tests[i].usage, format, tests[i].pool, &texture, NULL); - ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) ? D3D_OK : D3DERR_INVALIDCALL), + ok((hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) + && (tests[i].format != FORMAT_ATI2 || tests[i].pool == D3DPOOL_SCRATCH) + ? D3D_OK : D3DERR_INVALIDCALL)) + || (tests[i].format == FORMAT_ATI2 && hr == D3D_OK), "Test %u: Got unexpected hr %#x.\n", i, hr); if (FAILED(hr)) continue; @@ -12976,9 +12979,11 @@ static void test_resource_access(void) expected_hr = D3D_OK; else expected_hr = D3DERR_INVALIDCALL; - ok(hr == expected_hr, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == expected_hr || (volume_desc.Pool == D3DPOOL_DEFAULT && hr == D3D_OK), + "Test %u: Got unexpected hr %#x.\n", i, hr); hr = IDirect3DVolume9_UnlockBox(volume); - ok(hr == expected_hr, "Test %u: Got unexpected hr %#x.\n", i, hr); + ok(hr == expected_hr || (volume_desc.Pool == D3DPOOL_DEFAULT && hr == D3D_OK), + "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture); ok(hr == D3D_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);