Mesa (9.0): mesa: fix error checking of TexStorage(levels) for array and rect textures

Marek Olšák mareko at kemper.freedesktop.org
Fri Nov 23 01:01:35 UTC 2012


Module: Mesa
Branch: 9.0
Commit: 5b007761fef03547ef09585bef6920a8dcedf1ce
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b007761fef03547ef09585bef6920a8dcedf1ce

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sun Nov 11 15:25:55 2012 +0100

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 <brianp at vmware.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit 985f2aec4a2ca74f6612f34ce0887eafcc163e08)

Conflicts:
	src/mesa/main/texstorage.c

---

 src/mesa/main/texstorage.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index f8a9397..b4dd13e 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -244,7 +244,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 */
@@ -324,8 +323,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 > _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);




More information about the mesa-commit mailing list