=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d9: Reject blits on CPU accessible resources.

Alexandre Julliard julliard at winehq.org
Fri Feb 23 15:10:24 CST 2018


Module: wine
Branch: master
Commit: 514ffe8ac94c44e8808a5aaad9e2a8cb0472d468
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=514ffe8ac94c44e8808a5aaad9e2a8cb0472d468

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Feb 22 16:43:11 2018 +0100

d3d9: Reject blits on CPU accessible resources.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 5e0f558..3d3d273 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 0bd5016..0f3abf3 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);
 




More information about the wine-cvs mailing list