cvar_t gl_texturecompression_lightcubemaps = {CVAR_SAVE, "gl_texturecompression_lightcubemaps", "1", "whether to compress light cubemaps (spotlights and other light projection images)"};
cvar_t gl_texturecompression_reflectmask = {CVAR_SAVE, "gl_texturecompression_reflectmask", "1", "whether to compress reflection cubemap masks (mask of which areas of the texture should reflect the generic shiny cubemap)"};
cvar_t gl_nopartialtextureupdates = {CVAR_SAVE, "gl_nopartialtextureupdates", "1", "use alternate path for dynamic lightmap updates that avoids a possibly slow code path in the driver"};
-cvar_t r_texture_dds_load_alphamode = {0, "r_texture_dds_load_alphamode", "0", "0: trust DDPF_ALPHAPIXELS flag, 1: texture format and brute force search if ambigous, 2: texture format only"};
+cvar_t r_texture_dds_load_alphamode = {0, "r_texture_dds_load_alphamode", "1", "0: trust DDPF_ALPHAPIXELS flag, 1: texture format and brute force search if ambigous, 2: texture format only"};
qboolean gl_filter_force = false;
int gl_filter_min = GL_LINEAR_MIPMAP_LINEAR;
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:
typedef struct glmode_s
{
- char *name;
+ const char *name;
int minification, magnification;
}
glmode_t;
#ifdef SUPPORTD3D
typedef struct d3dmode_s
{
- char *name;
+ const char *name;
int m1, m2;
}
d3dmode_t;
}
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...
// check alpha
for (i = 0;i < size;i += bytesperblock)
if (ddspixels[i+0] + ddspixels[i+1] * 256 <= ddspixels[i+2] + ddspixels[i+3] * 256)
- break;
+ {
+ // NOTE: this assumes sizeof(unsigned int) == 4
+ unsigned int data = * (unsigned int *) &(ddspixels[i+4]);
+ // check if data, in base 4, contains a digit 3 (DXT1: transparent pixel)
+ if(data & (data<<1) & 0xAAAAAAAA)//rgh
+ break;
+ }
if (i < size)
textype = TEXTYPE_DXT1A;
else
}
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;
}
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;
Host_Error("R_UpdateTexture: no texture supplied");
if (!glt->texnum && !glt->d3dtexture)
{
- Con_Printf("R_UpdateTexture: texture %p \"%s\" in pool %p has not been uploaded yet", glt, glt->identifier, glt->pool);
+ Con_Printf("R_UpdateTexture: texture %p \"%s\" in pool %p has not been uploaded yet", (void *)glt, glt->identifier, (void *)glt->pool);
return;
}
// update part of the texture