GPUTexture: Fix wrong multisample texture size.

This commit is contained in:
Clément Foucault 2018-04-22 21:20:23 +02:00
parent fd23c42faa
commit 3f9f27e5a8
1 changed files with 6 additions and 5 deletions

View File

@ -93,19 +93,20 @@ static unsigned int memory_usage;
static unsigned int gpu_texture_memory_footprint_compute(GPUTexture *tex)
{
int samp = max_ii(tex->samples, 1);
switch (tex->target) {
case GL_TEXTURE_1D:
return tex->bytesize * tex->w;
return tex->bytesize * tex->w * samp;
case GL_TEXTURE_1D_ARRAY:
case GL_TEXTURE_2D:
return tex->bytesize * tex->w * tex->h;
return tex->bytesize * tex->w * tex->h * samp;
case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_3D:
return tex->bytesize * tex->w * tex->h * tex->d;
return tex->bytesize * tex->w * tex->h * tex->d * samp;
case GL_TEXTURE_CUBE_MAP:
return tex->bytesize * 6 * tex->w * tex->h;
return tex->bytesize * 6 * tex->w * tex->h * samp;
case GL_TEXTURE_CUBE_MAP_ARRAY:
return tex->bytesize * 6 * tex->w * tex->h * tex->d;
return tex->bytesize * 6 * tex->w * tex->h * tex->d * samp;
default:
return 0;
}