From 985f2aec4a2ca74f6612f34ce0887eafcc163e08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 11 Nov 2012 15:25:55 +0100 Subject: [PATCH] mesa: fix error checking of TexStorage(levels) for array and rect textures NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul Reviewed-by: Dave Airlie --- src/mesa/main/texstorage.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 9e0b54317c3..00f19bae51c 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -214,7 +214,6 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target, GLsizei width, GLsizei height, GLsizei depth) { struct gl_texture_object *texObj; - GLuint maxDim; GLboolean legalFormat; /* check internal format - note that only sized formats are allowed */ @@ -294,8 +293,7 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target, } /* check levels against width/height/depth */ - maxDim = MAX3(width, height, depth); - if (levels > (GLint) _mesa_logbase2(maxDim) + 1) { + if (levels > _mesa_get_tex_max_num_levels(target, width, height, depth)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(too many levels for max texture dimension)", dims); -- 2.30.2