From 3f9f27e5a864f6e46cd47f31387390800e2600f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sun, 22 Apr 2018 21:20:23 +0200 Subject: GPUTexture: Fix wrong multisample texture size. --- source/blender/gpu/intern/gpu_texture.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index d55bc02c836..19e26dcce8c 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -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; } -- cgit v1.2.3