[Bf-blender-cvs] [3f9f27e5a86] blender2.8: GPUTexture: Fix wrong multisample texture size.

Clément Foucault noreply at git.blender.org
Wed May 2 20:54:13 CEST 2018


Commit: 3f9f27e5a864f6e46cd47f31387390800e2600f2
Author: Clément Foucault
Date:   Sun Apr 22 21:20:23 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3f9f27e5a864f6e46cd47f31387390800e2600f2

GPUTexture: Fix wrong multisample texture size.

===================================================================

M	source/blender/gpu/intern/gpu_texture.c

===================================================================

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;
 	}



More information about the Bf-blender-cvs mailing list