Mesa (master): mesa: Fix valid texture target test in _mesa_GetTexLevelParameteriv()

Anuj Phogat aphogat at kemper.freedesktop.org
Tue Mar 6 03:11:41 UTC 2012


Module: Mesa
Branch: master
Commit: a9523af0e88017d683c19ff238bfc5eb7cb88fd0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9523af0e88017d683c19ff238bfc5eb7cb88fd0

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Fri Mar  2 12:00:51 2012 -0800

mesa: Fix valid texture target test in _mesa_GetTexLevelParameteriv()

_mesa_max_texture_levels() is also used to test valid texture target
in _mesa_GetTexLevelParameteriv(). GL_TEXTURE_CUBE_MAP is not allowed
as texture target in glGetTexLevelParameter(). So, this should throw
GL_INVALID_ENUM error.

Few other functions which use _mesa_max_texture_levels() like
getcompressedteximage_error_check() and getteximage_error_check()
also don't accept GL_TEXTURE_CUBE_MAP.

Above fix makes piglit fbo-cubemap test to fail. This is because of
incorrect texture target passed to _mesa_max_texture_levels() in
framebuffer_texture(). Fixing that as well

Note: This is a candidate for the stable branches

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/fbobject.c |    2 +-
 src/mesa/main/teximage.c |    1 -
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 6ee062d..281b1ca 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1994,7 +1994,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
       }
 
       if ((level < 0) ||
-          (level >= _mesa_max_texture_levels(ctx, texObj->Target))) {
+          (level >= _mesa_max_texture_levels(ctx, textarget))) {
          _mesa_error(ctx, GL_INVALID_VALUE,
                      "glFramebufferTexture%sEXT(level)", caller);
          return;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 4fb81e6..c0e5b9b 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -915,7 +915,6 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
    case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
    case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
    case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
-   case GL_TEXTURE_CUBE_MAP_ARB:
    case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
       return ctx->Extensions.ARB_texture_cube_map
          ? ctx->Const.MaxCubeTextureLevels : 0;




More information about the mesa-commit mailing list