From: Józef Kucia Subject: [PATCH 3/6] d3d9: Reject blits on CPU accessible resources. Message-Id: <20180222154314.30293-3-jkucia@codeweavers.com> Date: Thu, 22 Feb 2018 16:43:11 +0100 In-Reply-To: <20180222154314.30293-1-jkucia@codeweavers.com> References: <20180222154314.30293-1-jkucia@codeweavers.com> Signed-off-by: Józef Kucia --- dlls/d3d9/device.c | 11 +++++++++++ dlls/d3d9/tests/device.c | 13 +++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 5e0f55838f68..3d3d27332cbc 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1612,6 +1612,17 @@ static HRESULT WINAPI d3d9_device_StretchRect(IDirect3DDevice9Ex *iface, IDirect src_rect = &s; } + if (dst_desc.access & WINED3D_RESOURCE_ACCESS_CPU) + { + WARN("Destination resource is not in DEFAULT pool.\n"); + goto done; + } + if (src_desc.access & WINED3D_RESOURCE_ACCESS_CPU) + { + WARN("Source resource is not in DEFAULT pool.\n"); + goto done; + } + if (src_desc.usage & WINED3DUSAGE_DEPTHSTENCIL) { if (device->in_scene) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 0bd5016b11f7..0f3abf38ec06 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -12342,7 +12342,7 @@ static void test_stretch_rect(void) IDirect3DTexture9_Release(dst_texture); hr = IDirect3DDevice9_StretchRect(device, src, NULL, dst, NULL, D3DTEXF_NONE); - todo_wine + todo_wine_if(src_pool == D3DPOOL_DEFAULT && dst_pool == D3DPOOL_DEFAULT) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n", hr, src_format, dst_format, src_pool, dst_pool); @@ -12352,11 +12352,10 @@ static void test_stretch_rect(void) else expected_hr = D3DERR_INVALIDCALL; hr = IDirect3DDevice9_StretchRect(device, src, NULL, dst_rt, NULL, D3DTEXF_NONE); - todo_wine_if(expected_hr != D3D_OK) ok(hr == expected_hr, "Got hr %#x, expected hr %#x (formats %#x/%#x, pool %#x).\n", hr, expected_hr, src_format, dst_format, src_pool); hr = IDirect3DDevice9_StretchRect(device, src_rt, NULL, dst, NULL, D3DTEXF_NONE); - todo_wine + todo_wine_if(dst_pool == D3DPOOL_DEFAULT) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pool %#x).\n", hr, src_format, dst_format, dst_pool); @@ -12380,28 +12379,26 @@ static void test_stretch_rect(void) ok(hr == D3D_OK, "Failed to create surface, hr %#x.\n", hr); hr = IDirect3DDevice9_StretchRect(device, src_surface, NULL, dst_surface, NULL, D3DTEXF_NONE); - todo_wine_if(expected_hr != D3D_OK) ok(hr == expected_hr, "Got hr %#x, expected %#x (formats %#x/%#x, pools %#x/%#x).\n", hr, expected_hr, src_format, dst_format, src_pool, dst_pool); /* offscreen plain <-> texture */ hr = IDirect3DDevice9_StretchRect(device, src, NULL, dst_surface, NULL, D3DTEXF_NONE); - todo_wine + todo_wine_if(src_pool == D3DPOOL_DEFAULT && dst_pool == D3DPOOL_DEFAULT) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n", hr, src_format, dst_format, src_pool, dst_pool); hr = IDirect3DDevice9_StretchRect(device, src_surface, NULL, dst, NULL, D3DTEXF_NONE); - todo_wine + todo_wine_if(src_pool == D3DPOOL_DEFAULT && dst_pool == D3DPOOL_DEFAULT) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n", hr, src_format, dst_format, src_pool, dst_pool); /* offscreen plain <-> render target */ expected_hr = src_pool == D3DPOOL_DEFAULT ? D3D_OK : D3DERR_INVALIDCALL; hr = IDirect3DDevice9_StretchRect(device, src_surface, NULL, dst_rt, NULL, D3DTEXF_NONE); - todo_wine_if(expected_hr != D3D_OK) ok(hr == expected_hr, "Got hr %#x, expected hr %#x (formats %#x/%#x, pool %#x).\n", hr, expected_hr, src_format, dst_format, src_pool); hr = IDirect3DDevice9_StretchRect(device, src_rt, NULL, dst_surface, NULL, D3DTEXF_NONE); - todo_wine + todo_wine_if(dst_pool == D3DPOOL_DEFAULT) ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pool %#x).\n", hr, src_format, dst_format, dst_pool); -- 2.13.6