From 12a4fd7e45c8a410c3904f3153b912f04ca8eb10 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 11 Nov 2012 15:25:06 +0100 Subject: [PATCH] mesa: use MaxNumlevels in _mesa_test_texobj_completeness Reviewed-by: Brian Paul Reviewed-by: Dave Airlie --- src/mesa/main/texobj.c | 14 +++----------- 1 file 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 */ -- 2.30.2