From 3474335ffdd2c762fd8067c687fae7928bc2a508 Mon Sep 17 00:00:00 2001 From: divverent Date: Thu, 19 Aug 2010 12:28:30 +0000 Subject: [PATCH] check the proper texture compression extension for deciding whether to S3TC compress git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10399 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gl_textures.c b/gl_textures.c index 0b2734be..1884633d 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -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; -- 2.39.2