wined3d: Remove some redundant s3tc extension checks.

Henri Verbeet hverbeet at codeweavers.com
Thu Jun 11 03:24:30 CDT 2009


If the extension isn't available to surface shouldn't have been created. We
don't do extension checks for all the other formats either.
---
 dlls/wined3d/device.c  |   32 ++++++++-------
 dlls/wined3d/surface.c |   99 +++++++++++++++++++++++++----------------------
 2 files changed, 70 insertions(+), 61 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index fe084ca..e6b4681 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5987,22 +5987,24 @@ static HRESULT  WINAPI  IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
             WINED3DFMT_DXT3 == destFormat ||
             WINED3DFMT_DXT4 == destFormat ||
             WINED3DFMT_DXT5 == destFormat) {
-            if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
-                if (destSurfaceHeight != srcHeight || destSurfaceWidth != srcWidth) {
-                    /* FIXME: The easy way to do this is to lock the destination, and copy the bits across */
-                    FIXME("Updating part of a compressed texture is not supported at the moment\n");
-                } if (destFormat != srcFormat) {
-                    FIXME("Updating mixed format compressed texture is not curretly support\n");
-                } else {
-                    GL_EXTCALL(glCompressedTexImage2DARB(glDescription->target, glDescription->level,
-                            dst_format_desc->glInternal, srcWidth, srcHeight, 0, destSize, data));
-                }
-            } else {
-                FIXME("Attempting to update a DXT compressed texture without hardware support\n");
-            }
-
 
-        } else {
+            if (destSurfaceHeight != srcHeight || destSurfaceWidth != srcWidth)
+            {
+                /* FIXME: The easy way to do this is to lock the destination, and copy the bits across. */
+                FIXME("Updating part of a compressed texture is not supported.\n");
+            }
+            if (destFormat != srcFormat)
+            {
+                FIXME("Updating mixed format compressed textures is not supported.\n");
+            }
+            else
+            {
+                GL_EXTCALL(glCompressedTexImage2DARB(glDescription->target, glDescription->level,
+                        dst_format_desc->glInternal, srcWidth, srcHeight, 0, destSize, data));
+            }
+        }
+        else
+        {
             glTexSubImage2D(glDescription->target, glDescription->level, destLeft, destTop,
                     srcWidth, srcHeight, dst_format_desc->glFormat, dst_format_desc->glType, data);
         }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index a20ecd2..c81dab3 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -150,25 +150,26 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
             || format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4
             || format_desc->format == WINED3DFMT_DXT5 || format_desc->format == WINED3DFMT_ATI2N)
     {
-        if (!GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) { /* We can assume this as the texture would not have been created otherwise */
-            FIXME("(%p) : Attempting to lock a compressed texture when texture compression isn't supported by opengl\n", This);
-        } else {
-            TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p\n",
-                    This, This->glDescription.level, format_desc->glFormat, format_desc->glType,
-                    This->resource.allocatedMemory);
-
-            if(This->Flags & SFLAG_PBO) {
-                GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
-                checkGLcall("glBindBufferARB");
-                GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, NULL));
-                checkGLcall("glGetCompressedTexImageARB()");
-                GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
-                checkGLcall("glBindBufferARB");
-            } else {
-                GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, This->resource.allocatedMemory));
-                checkGLcall("glGetCompressedTexImageARB()");
-            }
+        TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p.\n",
+                This, This->glDescription.level, format_desc->glFormat, format_desc->glType,
+                This->resource.allocatedMemory);
+
+        if (This->Flags & SFLAG_PBO)
+        {
+            GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo));
+            checkGLcall("glBindBufferARB");
+            GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, NULL));
+            checkGLcall("glGetCompressedTexImageARB()");
+            GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0));
+            checkGLcall("glBindBufferARB");
         }
+        else
+        {
+            GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target,
+                    This->glDescription.level, This->resource.allocatedMemory));
+            checkGLcall("glGetCompressedTexImageARB()");
+        }
+
         LEAVE_GL();
     } else {
         void *mem;
@@ -297,35 +298,41 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsi
             || format_desc->format == WINED3DFMT_DXT3 || format_desc->format == WINED3DFMT_DXT4
             || format_desc->format == WINED3DFMT_DXT5 || format_desc->format == WINED3DFMT_ATI2N)
     {
-        if (!GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
-            FIXME("Using DXT1/3/5 without advertized support\n");
-        } else {
-            /* glCompressedTexSubImage2D for uploading and glTexImage2D for allocating does not work well on some drivers(r200 dri, MacOS ATI driver)
-             * glCompressedTexImage2D does not accept NULL pointers. So for compressed textures surface_allocate_surface does nothing, and this
-             * function uses glCompressedTexImage2D instead of the SubImage call
-             */
-            TRACE("(%p) : Calling glCompressedTexSubImage2D w %d, h %d, data %p\n", This, width, height, data);
-            ENTER_GL();
+        /* glCompressedTexSubImage2D() for uploading and glTexImage2D() for
+         * allocating does not work well on some drivers (r200 dri, MacOS ATI
+         * driver). glCompressedTexImage2D() does not accept NULL pointers. So
+         * for compressed textures surface_allocate_surface() does nothing,
+         * and this function uses glCompressedTexImage2D() instead of
+         * glCompressedTexSubImage2D(). */
+        TRACE("(%p) : Calling glCompressedTexImage2DARB w %u, h %u, data %p.\n", This, width, height, data);
+
+        ENTER_GL();
 
-            if(This->Flags & SFLAG_PBO) {
-                GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo));
-                checkGLcall("glBindBufferARB");
-                TRACE("(%p) pbo: %#x, data: %p\n", This, This->pbo, data);
+        if (This->Flags & SFLAG_PBO)
+        {
+            GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo));
+            checkGLcall("glBindBufferARB");
 
-                GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level, internal,
-                        width, height, 0 /* border */, This->resource.size, NULL));
-                checkGLcall("glCompressedTexSubImage2D");
+            TRACE("(%p) pbo: %#x, data: %p.\n", This, This->pbo, data);
 
-                GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
-                checkGLcall("glBindBufferARB");
-            } else {
-                GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level, internal,
-                        width, height, 0 /* border */, This->resource.size, data));
-                checkGLcall("glCompressedTexSubImage2D");
-            }
-            LEAVE_GL();
+            GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level,
+                    internal, width, height, 0 /* border */, This->resource.size, NULL));
+            checkGLcall("glCompressedTexImage2DARB");
+
+            GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
+            checkGLcall("glBindBufferARB");
         }
-    } else {
+        else
+        {
+            GL_EXTCALL(glCompressedTexImage2DARB(This->glDescription.target, This->glDescription.level,
+                    internal, width, height, 0 /* border */, This->resource.size, data));
+            checkGLcall("glCompressedTexSubImage2D");
+        }
+
+        LEAVE_GL();
+    }
+    else
+    {
         TRACE("(%p) : Calling glTexSubImage2D w %d,  h %d, data, %p\n", This, width, height, data);
         ENTER_GL();
 
-- 
1.6.0.6



--------------020504070301090103010904--



More information about the wine-patches mailing list