]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
notice the input data has no useful data on the alpha channel, and fall back to RGB...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 31 Dec 2009 09:32:14 +0000 (09:32 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 31 Dec 2009 09:32:14 +0000 (09:32 +0000)
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

index a029377c930a36425048d575c16a3d6103e5d702..f4ccbcaec93fddfd709de399957d4abe91033cec 100644 (file)
@@ -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));