summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-11-11 15:25:06 +0100
committerMarek Olšák <[email protected]>2012-11-12 21:37:30 +0100
commit12a4fd7e45c8a410c3904f3153b912f04ca8eb10 (patch)
treeedb41cb368c06aef89542e3505eed5b220676897 /src/mesa/main
parent8111342e814304730bed34446ea816cbc17a5775 (diff)
mesa: use MaxNumlevels in _mesa_test_texobj_completeness
Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texobj.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index c083c72e2aa..d650c75e4e7 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -445,7 +445,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
{
const GLint baseLevel = t->BaseLevel;
const struct gl_texture_image *baseImage;
- GLint maxLog2 = 0, maxLevels = 0;
+ GLint maxLevels = 0;
/* We'll set these to FALSE if tests fail below */
t->_BaseComplete = GL_TRUE;
@@ -501,31 +501,22 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
switch (t->Target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY_EXT:
- maxLog2 = baseImage->WidthLog2;
maxLevels = ctx->Const.MaxTextureLevels;
break;
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_ARRAY_EXT:
- maxLog2 = MAX2(baseImage->WidthLog2,
- baseImage->HeightLog2);
maxLevels = ctx->Const.MaxTextureLevels;
break;
case GL_TEXTURE_3D:
- maxLog2 = MAX3(baseImage->WidthLog2,
- baseImage->HeightLog2,
- baseImage->DepthLog2);
maxLevels = ctx->Const.Max3DTextureLevels;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
case GL_TEXTURE_CUBE_MAP_ARRAY:
- maxLog2 = MAX2(baseImage->WidthLog2,
- baseImage->HeightLog2);
maxLevels = ctx->Const.MaxCubeTextureLevels;
break;
case GL_TEXTURE_RECTANGLE_NV:
case GL_TEXTURE_BUFFER:
case GL_TEXTURE_EXTERNAL_OES:
- maxLog2 = 0; /* not applicable */
maxLevels = 1; /* no mipmapping */
break;
default:
@@ -535,7 +526,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
ASSERT(maxLevels > 0);
- t->_MaxLevel = baseLevel + maxLog2; /* 'p' in the GL spec */
+ t->_MaxLevel =
+ baseLevel + baseImage->MaxNumLevels - 1; /* 'p' in the GL spec */
t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel);
t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1); /* 'q' in the GL spec */