Commit 514ffe8a authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d9: Reject blits on CPU accessible resources.

parent a49153cf
...@@ -1612,6 +1612,17 @@ static HRESULT WINAPI d3d9_device_StretchRect(IDirect3DDevice9Ex *iface, IDirect ...@@ -1612,6 +1612,17 @@ static HRESULT WINAPI d3d9_device_StretchRect(IDirect3DDevice9Ex *iface, IDirect
src_rect = &s; 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 (src_desc.usage & WINED3DUSAGE_DEPTHSTENCIL)
{ {
if (device->in_scene) if (device->in_scene)
......
...@@ -12342,7 +12342,7 @@ static void test_stretch_rect(void) ...@@ -12342,7 +12342,7 @@ static void test_stretch_rect(void)
IDirect3DTexture9_Release(dst_texture); IDirect3DTexture9_Release(dst_texture);
hr = IDirect3DDevice9_StretchRect(device, src, NULL, dst, NULL, D3DTEXF_NONE); 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", ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n",
hr, src_format, dst_format, src_pool, dst_pool); hr, src_format, dst_format, src_pool, dst_pool);
...@@ -12352,11 +12352,10 @@ static void test_stretch_rect(void) ...@@ -12352,11 +12352,10 @@ static void test_stretch_rect(void)
else else
expected_hr = D3DERR_INVALIDCALL; expected_hr = D3DERR_INVALIDCALL;
hr = IDirect3DDevice9_StretchRect(device, src, NULL, dst_rt, NULL, D3DTEXF_NONE); 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", 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, expected_hr, src_format, dst_format, src_pool);
hr = IDirect3DDevice9_StretchRect(device, src_rt, NULL, dst, NULL, D3DTEXF_NONE); 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", ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pool %#x).\n",
hr, src_format, dst_format, dst_pool); hr, src_format, dst_format, dst_pool);
...@@ -12380,28 +12379,26 @@ static void test_stretch_rect(void) ...@@ -12380,28 +12379,26 @@ static void test_stretch_rect(void)
ok(hr == D3D_OK, "Failed to create surface, hr %#x.\n", hr); ok(hr == D3D_OK, "Failed to create surface, hr %#x.\n", hr);
hr = IDirect3DDevice9_StretchRect(device, src_surface, NULL, dst_surface, NULL, D3DTEXF_NONE); 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", 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); hr, expected_hr, src_format, dst_format, src_pool, dst_pool);
/* offscreen plain <-> texture */ /* offscreen plain <-> texture */
hr = IDirect3DDevice9_StretchRect(device, src, NULL, dst_surface, NULL, D3DTEXF_NONE); 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", ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n",
hr, src_format, dst_format, src_pool, dst_pool); hr, src_format, dst_format, src_pool, dst_pool);
hr = IDirect3DDevice9_StretchRect(device, src_surface, NULL, dst, NULL, D3DTEXF_NONE); 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", ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pools %#x/%#x).\n",
hr, src_format, dst_format, src_pool, dst_pool); hr, src_format, dst_format, src_pool, dst_pool);
/* offscreen plain <-> render target */ /* offscreen plain <-> render target */
expected_hr = src_pool == D3DPOOL_DEFAULT ? D3D_OK : D3DERR_INVALIDCALL; expected_hr = src_pool == D3DPOOL_DEFAULT ? D3D_OK : D3DERR_INVALIDCALL;
hr = IDirect3DDevice9_StretchRect(device, src_surface, NULL, dst_rt, NULL, D3DTEXF_NONE); 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", 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, expected_hr, src_format, dst_format, src_pool);
hr = IDirect3DDevice9_StretchRect(device, src_rt, NULL, dst_surface, NULL, D3DTEXF_NONE); 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", ok(hr == D3DERR_INVALIDCALL, "Got hr %#x (formats %#x/%#x, pool %#x).\n",
hr, src_format, dst_format, dst_pool); hr, src_format, dst_format, dst_pool);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment