[PATCH 2/4] d3d9: Volume and cube textures do not support user memory (try 2).

Stefan Dösinger stefan at codeweavers.com
Mon Dec 9 06:28:14 CST 2013


Try 2: Handle pools other than D3DPOOL_SYSMEM.
---
 dlls/d3d9/device.c       | 14 ++++++++++++++
 dlls/d3d9/tests/d3d9ex.c |  9 +++++++++
 2 files changed, 23 insertions(+)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index adda6f9..e92c84e 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -807,7 +807,14 @@ static HRESULT WINAPI d3d9_device_CreateVolumeTexture(IDirect3DDevice9Ex *iface,
 
     *texture = NULL;
     if (shared_handle)
+    {
+        if (pool != D3DPOOL_DEFAULT)
+        {
+            WARN("User memory is not allowed on volume textures.\n");
+            return D3DERR_INVALIDCALL;
+        }
         FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+    }
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
@@ -840,7 +847,14 @@ static HRESULT WINAPI d3d9_device_CreateCubeTexture(IDirect3DDevice9Ex *iface,
 
     *texture = NULL;
     if (shared_handle)
+    {
+        if (pool != D3DPOOL_DEFAULT)
+        {
+            WARN("User memory is not allowed on cube textures.\n");
+            return D3DERR_INVALIDCALL;
+        }
         FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+    }
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 8ec129d..65ffce0 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -539,6 +539,8 @@ static void test_user_memory(void)
 {
     IDirect3DDevice9Ex *device;
     IDirect3DTexture9 *texture;
+    IDirect3DCubeTexture9 *cube_texture;
+    IDirect3DVolumeTexture9 *volume_texture;
     D3DLOCKED_RECT locked_rect;
     UINT refcount;
     HWND window;
@@ -597,6 +599,13 @@ static void test_user_memory(void)
             ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x.\n", hr);
             IDirect3DTexture9_Release(texture);
         }
+
+        hr = IDirect3DDevice9Ex_CreateCubeTexture(device, 2, 1, 0, D3DFMT_A8R8G8B8,
+                test_data[i].pool, &cube_texture, &mem);
+        ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, pool %s.\n", hr, test_data[i].name);
+        hr = IDirect3DDevice9Ex_CreateVolumeTexture(device, 2, 2, 2, 1, 0, D3DFMT_A8R8G8B8,
+                test_data[i].pool, &volume_texture, &mem);
+        ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, pool %s.\n", hr, test_data[i].name);
     }
 
     HeapFree(GetProcessHeap(), 0, mem);
-- 
1.8.3.2




More information about the wine-patches mailing list