Fix GetTextureUsed
This commit is contained in:
parent
6d754821fb
commit
d93adbacbb
|
@ -2280,9 +2280,25 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
|||
|
||||
while (tmp)
|
||||
{
|
||||
res += tmp->height*tmp->width*(screen_depth/8);
|
||||
// Figure out the correct bytes-per-pixel for this texture
|
||||
// I don't know which one the game actually _uses_ but this
|
||||
// follows format2bpp in hw_cache.c
|
||||
int bpp = 1;
|
||||
int format = tmp->grInfo.format;
|
||||
if (format == GR_RGBA)
|
||||
bpp = 4;
|
||||
else if (format == GR_TEXFMT_RGB_565
|
||||
|| format == GR_TEXFMT_ARGB_1555
|
||||
|| format == GR_TEXFMT_ARGB_4444
|
||||
|| format == GR_TEXFMT_ALPHA_INTENSITY_88
|
||||
|| format == GR_TEXFMT_AP_88)
|
||||
bpp = 2;
|
||||
|
||||
// Add it up!
|
||||
res += tmp->height*tmp->width*bpp;
|
||||
tmp = tmp->nextmipmap;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue