Mesa (master): mesa: fix incorrect error in _mesa_BindTextureUnit()

Brian Paul brianp at kemper.freedesktop.org
Thu Oct 1 14:09:22 UTC 2015


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Sep 30 11:48:07 2015 -0600

mesa: fix incorrect error in _mesa_BindTextureUnit()

If the texture object exists, but the Name field is zero, it means
the object was created but never bound to a target.  Trying to bind it
in _mesa_BindTextureUnit() should generate GL_INVALID_OPERATION.

Fixes piglit's arb_direct_state_access-bind-texture-unit test.

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

---

 src/mesa/main/texobj.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 105ec1e..173e43c 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1816,7 +1816,8 @@ _mesa_BindTextureUnit(GLuint unit, GLuint texture)
       return;
    }
    if (texObj->Target == 0) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glBindTextureUnit(target)");
+      /* Texture object was gen'd but never bound so the target is not set */
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glBindTextureUnit(target)");
       return;
    }
    assert(valid_texture_object(texObj));




More information about the mesa-commit mailing list