Stefan Dösinger : wined3d: Catch D3DUSAGE_AUTOGENMIPMAP and D3DUSAGE_RENDERTARGET combos.

Alexandre Julliard julliard at winehq.org
Tue Apr 1 16:44:13 CDT 2008


Module: wine
Branch: master
Commit: ab86a4e963ac30e56d9b6f21a3cd1b1be92fc7e1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ab86a4e963ac30e56d9b6f21a3cd1b1be92fc7e1

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Mar 28 23:46:38 2008 +0100

wined3d: Catch D3DUSAGE_AUTOGENMIPMAP and D3DUSAGE_RENDERTARGET combos.

---

 dlls/d3d9/tests/texture.c |    4 ++--
 dlls/wined3d/device.c     |   13 ++++++++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/d3d9/tests/texture.c b/dlls/d3d9/tests/texture.c
index 0b2e406..72a0561 100644
--- a/dlls/d3d9/tests/texture.c
+++ b/dlls/d3d9/tests/texture.c
@@ -137,7 +137,7 @@ static void test_cube_texture_mipmap_gen(IDirect3DDevice9 *device_ptr)
     hr = IDirect3DDevice9_CreateCubeTexture(device_ptr, 64, 0, (D3DUSAGE_RENDERTARGET |
                                             D3DUSAGE_AUTOGENMIPMAP), D3DFMT_X8R8G8B8,
                                             D3DPOOL_MANAGED, &texture_ptr, 0);
-    todo_wine ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_CreateTexture returned 0x%08x, expected 0x%08x\n",
+    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_CreateTexture returned 0x%08x, expected 0x%08x\n",
        hr, D3DERR_INVALIDCALL);
     if (texture_ptr) IDirect3DCubeTexture9_Release(texture_ptr);
     texture_ptr = NULL;
@@ -186,7 +186,7 @@ static void test_mipmap_gen(IDirect3DDevice9 *device)
     hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 0, (D3DUSAGE_RENDERTARGET |
                                         D3DUSAGE_AUTOGENMIPMAP), D3DFMT_X8R8G8B8,
                                         D3DPOOL_MANAGED, &texture, 0);
-    todo_wine ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_CreateTexture returned 0x%08x, expected 0x%08x\n",
+    ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_CreateTexture returned 0x%08x, expected 0x%08x\n",
        hr, D3DERR_INVALIDCALL);
     if (texture) IDirect3DTexture9_Release(texture);
     texture = NULL;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 57b6045..1c1da5a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -768,11 +768,16 @@ static HRESULT  WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
     const GlPixelFormatDesc *glDesc;
     getFormatDescEntry(Format, &GLINFO_LOCATION, &glDesc);
 
-
     TRACE("(%p) : Width %d, Height %d, Levels %d, Usage %#x\n", This, Width, Height, Levels, Usage);
     TRACE("Format %#x (%s), Pool %#x, ppTexture %p, pSharedHandle %p, parent %p\n",
             Format, debug_d3dformat(Format), Pool, ppTexture, pSharedHandle, parent);
 
+    if((Usage & (WINED3DUSAGE_AUTOGENMIPMAP | WINED3DUSAGE_RENDERTARGET)) ==
+                (WINED3DUSAGE_AUTOGENMIPMAP | WINED3DUSAGE_RENDERTARGET)) {
+        WARN("Application requests both D3DUSAGE_AUTOGENMIPMAP and D3DUSAGE_RENDERTARGET, which are mutually exclusive\n");
+        return WINED3DERR_INVALIDCALL;
+    }
+
     /* TODO: It should only be possible to create textures for formats 
              that are reported as supported */
     if (WINED3DFMT_UNKNOWN >= Format) {
@@ -1039,6 +1044,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
     const GlPixelFormatDesc *glDesc;
     getFormatDescEntry(Format, &GLINFO_LOCATION, &glDesc);
 
+    if((Usage & (WINED3DUSAGE_AUTOGENMIPMAP | WINED3DUSAGE_RENDERTARGET)) ==
+                (WINED3DUSAGE_AUTOGENMIPMAP | WINED3DUSAGE_RENDERTARGET)) {
+        WARN("Application requests both D3DUSAGE_AUTOGENMIPMAP and D3DUSAGE_RENDERTARGET, which are mutually exclusive\n");
+        return WINED3DERR_INVALIDCALL;
+    }
+
     /* TODO: It should only be possible to create textures for formats 
              that are reported as supported */
     if (WINED3DFMT_UNKNOWN >= Format) {




More information about the wine-cvs mailing list