Stefan Dösinger : wined3d: Refuse to create volumes and volume textures if not supported.

Alexandre Julliard julliard at winehq.org
Wed Nov 7 06:45:53 CST 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Oct 26 13:44:16 2007 +0200

wined3d: Refuse to create volumes and volume textures if not supported.

---

 dlls/wined3d/device.c |   10 ++++++++++
 dlls/wined3d/volume.c |   31 ++++++++++++++-----------------
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6aa58cd..e9cd3de 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -952,6 +952,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
     UINT                       tmpH;
     UINT                       tmpD;
     const GlPixelFormatDesc *glDesc;
+
     getFormatDescEntry(Format, &GLINFO_LOCATION, &glDesc);
 
     /* TODO: It should only be possible to create textures for formats 
@@ -960,6 +961,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
         WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN\n", This);
         return WINED3DERR_INVALIDCALL;
     }
+    if(!GL_SUPPORT(EXT_TEXTURE3D)) {
+        WARN("(%p) : Texture cannot be created - no volume texture support\n", This);
+        return WINED3DERR_INVALIDCALL;
+    }
 
     D3DCREATERESOURCEOBJECTINSTANCE(object, VolumeTexture, WINED3DRTYPE_VOLUMETEXTURE, 0);
     D3DINITIALIZEBASETEXTURE(object->baseTexture);
@@ -1041,6 +1046,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
     IWineD3DVolumeImpl        *object; /** NOTE: impl ref allowed since this is a create function **/
     const StaticPixelFormatDesc *formatDesc  = getFormatDescEntry(Format, NULL, NULL);
 
+    if(!GL_SUPPORT(EXT_TEXTURE3D)) {
+        WARN("(%p) : Volume cannot be created - no volume texture support\n", This);
+        return WINED3DERR_INVALIDCALL;
+    }
+
     D3DCREATERESOURCEOBJECTINSTANCE(object, Volume, WINED3DRTYPE_VOLUME, ((Width * formatDesc->bpp) * Height * Depth))
 
     TRACE("(%p) : W(%d) H(%d) D(%d), Usage(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height,
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 425a45e..a70a351 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -270,9 +270,18 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int
 
     TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(format), format);
 
-    if(GL_SUPPORT(EXT_TEXTURE3D)) {
-        TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
-                GL_TEXTURE_3D,
+    TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
+            GL_TEXTURE_3D,
+            gl_level,
+            glDesc->glInternal,
+            This->currentDesc.Width,
+            This->currentDesc.Height,
+            This->currentDesc.Depth,
+            0,
+            glDesc->glFormat,
+            glDesc->glType,
+            This->resource.allocatedMemory);
+    GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D,
                 gl_level,
                 glDesc->glInternal,
                 This->currentDesc.Width,
@@ -281,20 +290,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int
                 0,
                 glDesc->glFormat,
                 glDesc->glType,
-                This->resource.allocatedMemory);
-        GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D,
-                    gl_level,
-                    glDesc->glInternal,
-                    This->currentDesc.Width,
-                    This->currentDesc.Height,
-                    This->currentDesc.Depth,
-                    0,
-                    glDesc->glFormat,
-                    glDesc->glType,
-                    This->resource.allocatedMemory));
-        checkGLcall("glTexImage3D");
-    } else
-        WARN("This OpenGL implementation doesn't support 3D textures\n");
+                This->resource.allocatedMemory));
+    checkGLcall("glTexImage3D");
 
     /* When adding code releasing This->resource.allocatedMemory to save data keep in mind that
      * GL_UNPACK_CLIENT_STORAGE_APPLE is enabled by default if supported(GL_APPLE_client_storage).




More information about the wine-cvs mailing list