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

Stefan Dösinger stefan at codeweavers.com
Tue Dec 10 07:36:56 CST 2013


Try 4: Change the WARN message again.
Try 3: Change the WARN message and check caps in the tests.
Try 2: Handle pools other than D3DPOOL_SYSMEM.
---
 dlls/d3d9/device.c       | 14 ++++++++++++++
 dlls/d3d9/tests/d3d9ex.c | 21 ++++++++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 6721101..65fd377 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -800,7 +800,14 @@ static HRESULT WINAPI d3d9_device_CreateVolumeTexture(IDirect3DDevice9Ex *iface,
 
     *texture = NULL;
     if (shared_handle)
+    {
+        if (pool != D3DPOOL_DEFAULT)
+        {
+            WARN("Trying to create a shared volume texture in pool %#x.\n", pool);
+            return D3DERR_INVALIDCALL;
+        }
         FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
+    }
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
     if (!object)
@@ -833,7 +840,14 @@ static HRESULT WINAPI d3d9_device_CreateCubeTexture(IDirect3DDevice9Ex *iface,
 
     *texture = NULL;
     if (shared_handle)
+    {
+        if (pool != D3DPOOL_DEFAULT)
+        {
+            WARN("Trying to create a shared cube texture in pool %#x.\n", pool);
+            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 810d2a0..1df6eb8 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -539,11 +539,14 @@ static void test_user_memory(void)
 {
     IDirect3DDevice9Ex *device;
     IDirect3DTexture9 *texture;
+    IDirect3DCubeTexture9 *cube_texture;
+    IDirect3DVolumeTexture9 *volume_texture;
     D3DLOCKED_RECT locked_rect;
     UINT refcount;
     HWND window;
     HRESULT hr;
     void *mem;
+    D3DCAPS9 caps;
 
     window = create_window();
     if (!(device = create_device(window, window, TRUE)))
@@ -552,6 +555,9 @@ static void test_user_memory(void)
         goto done;
     }
 
+    hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
+    ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
+
     mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 128 * 128 * 4);
     hr = IDirect3DDevice9Ex_CreateTexture(device, 128, 128, 0, 0, D3DFMT_A8R8G8B8,
             D3DPOOL_SYSTEMMEM, &texture, &mem);
@@ -576,8 +582,21 @@ static void test_user_memory(void)
     hr = IDirect3DTexture9_UnlockRect(texture, 0);
     ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x.\n", hr);
     IDirect3DTexture9_Release(texture);
-    HeapFree(GetProcessHeap(), 0, mem);
 
+    if (caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP)
+    {
+        hr = IDirect3DDevice9Ex_CreateCubeTexture(device, 2, 1, 0, D3DFMT_A8R8G8B8,
+                D3DPOOL_SYSTEMMEM, &cube_texture, &mem);
+        ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    }
+    if (caps.TextureCaps & D3DPTEXTURECAPS_VOLUMEMAP)
+    {
+        hr = IDirect3DDevice9Ex_CreateVolumeTexture(device, 2, 2, 2, 1, 0, D3DFMT_A8R8G8B8,
+                D3DPOOL_SYSTEMMEM, &volume_texture, &mem);
+        ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    }
+
+    HeapFree(GetProcessHeap(), 0, mem);
     refcount = IDirect3DDevice9Ex_Release(device);
     ok(!refcount, "Device has %u references left.\n", refcount);
 
-- 
1.8.3.2




More information about the wine-patches mailing list