From 9a313d7ec31ba0d2b97f581929da30caee7da874 Mon Sep 17 00:00:00 2001 From: divverent Date: Thu, 31 Dec 2009 09:32:14 +0000 Subject: [PATCH] notice the input data has no useful data on the alpha channel, and fall back to RGB texture compression (DXT1). Saves GPU memory when compressing textures. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9758 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gl_textures.c b/gl_textures.c index a029377c..f4ccbcae 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -889,7 +889,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden int i, size; gltexture_t *glt; gltexturepool_t *pool = (gltexturepool_t *)rtexturepool; - textypeinfo_t *texinfo; + textypeinfo_t *texinfo, *texinfo2; if (cls.state == ca_dedicated) return NULL; @@ -972,6 +972,12 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden Host_Error("R_LoadTexture: unknown texture type"); } + texinfo2 = R_GetTexTypeInfo(textype, flags); + if(size == width * height * depth * sides * texinfo->inputbytesperpixel) + texinfo = texinfo2; + else + Con_Printf ("R_LoadTexture: input size changed after alpha fallback\n"); + glt = (gltexture_t *)Mem_Alloc(texturemempool, sizeof(gltexture_t)); if (identifier) strlcpy (glt->identifier, identifier, sizeof(glt->identifier)); -- 2.39.2