]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
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)
committerRudolf Polzer <divVerent@alientrap.org>
Fri, 20 Aug 2010 12:06:03 +0000 (14:06 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10399 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=3474335ffdd2c762fd8067c687fae7928bc2a508

gl_textures.c

index bbf195c1ff51de12c43a2c025e547fe558273762..2a2f31ad5b39d7a7d60c35e2eb42bd35d79b80f6 100644 (file)
@@ -186,11 +186,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:
@@ -1286,6 +1286,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...
@@ -1327,6 +1332,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;
@@ -1341,6 +1351,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;