[Mesa-dev] [PATCH] st/mesa: fix computation of last_level for array textures
Marek Olšák
maraeo at gmail.com
Sun Nov 11 05:01:40 PST 2012
NOTE: This is a candidate for the stable branches.
---
src/mesa/state_tracker/st_gen_mipmap.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 8892006..7e97edd 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -129,8 +129,24 @@ compute_num_levels(struct gl_context *ctx,
_mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel);
GLuint size, numLevels;
- size = MAX2(baseImage->Width2, baseImage->Height2);
- size = MAX2(size, baseImage->Depth2);
+ switch (target) {
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_1D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP: /* cubemaps are squares, don't check Height2 */
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ size = baseImage->Width2;
+ break;
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_2D_ARRAY:
+ size = MAX2(baseImage->Width2, baseImage->Height2);
+ break;
+ case GL_TEXTURE_3D:
+ size = MAX3(baseImage->Width2, baseImage->Height2, baseImage->Depth2);
+ break;
+ default:
+ assert(0);
+ return 1;
+ }
numLevels = texObj->BaseLevel;
--
1.7.9.5
More information about the mesa-dev
mailing list