check the proper texture compression extension for deciding whether to S3TC compress
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 19 Aug 2010 12:28:30 +0000 (12:28 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 19 Aug 2010 12:28:30 +0000 (12:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10399 d7cf8633-e32d-0410-b094-e92efae38249

gl_textures.c

index 0b2734b..1884633 100644 (file)
@@ -218,11 +218,11 @@ static textypeinfo_t *R_GetTexTypeInfo(textype_t textype, int flags)
        case TEXTYPE_PALETTE:
                return (flags & TEXF_ALPHA) ? &textype_palette_alpha : &textype_palette;
        case TEXTYPE_RGBA:
-               if ((flags & TEXF_COMPRESS) && gl_texturecompression.integer >= 1 && vid.support.arb_texture_compression)
+               if ((flags & TEXF_COMPRESS) && gl_texturecompression.integer >= 1 && vid.support.ext_texture_compression_s3tc)
                        return (flags & TEXF_ALPHA) ? &textype_rgba_alpha_compress : &textype_rgba_compress;
                return (flags & TEXF_ALPHA) ? &textype_rgba_alpha : &textype_rgba;
        case TEXTYPE_BGRA:
-               if ((flags & TEXF_COMPRESS) && gl_texturecompression.integer >= 1 && vid.support.arb_texture_compression)
+               if ((flags & TEXF_COMPRESS) && gl_texturecompression.integer >= 1 && vid.support.ext_texture_compression_s3tc)
                        return (flags & TEXF_ALPHA) ? &textype_bgra_alpha_compress : &textype_bgra_compress;
                return (flags & TEXF_ALPHA) ? &textype_bgra_alpha : &textype_bgra;
        case TEXTYPE_ALPHA:
@@ -1791,6 +1791,11 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen
        }
        else if (!memcmp(dds+84, "DXT1", 4))
        {
+               if(!vid.support.ext_texture_compression_s3tc)
+               {
+                       Mem_Free(dds);
+                       return NULL;
+               }
                // we need to find out if this is DXT1 (opaque) or DXT1A (transparent)
                // LordHavoc: it is my belief that this does not infringe on the
                // patent because it is not decoding pixels...
@@ -1832,6 +1837,11 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen
        }
        else if (!memcmp(dds+84, "DXT3", 4))
        {
+               if(!vid.support.ext_texture_compression_s3tc)
+               {
+                       Mem_Free(dds);
+                       return NULL;
+               }
                textype = TEXTYPE_DXT3;
                bytesperblock = 16;
                bytesperpixel = 0;
@@ -1846,6 +1856,11 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen
        }
        else if (!memcmp(dds+84, "DXT5", 4))
        {
+               if(!vid.support.ext_texture_compression_s3tc)
+               {
+                       Mem_Free(dds);
+                       return NULL;
+               }
                textype = TEXTYPE_DXT5;
                bytesperblock = 16;
                bytesperpixel = 0;