From: Arthur Huillet <ahuil...@nvidia.com>

Updated BindTextureUnit() to match the OpenGL specification: 
GL_INVALID_OPERATION
is expected when the texture object doesn't exist, not GL_INVALID_ENUM.
When the texture unit doesn't exist, the specification doesn't strictly speaking
define the error, and although BindTextures() uses GL_INVALID_OPERATION for this
case, table 2.3 serves as a default and states that GL_INVALID_VALUE is the
correct error.

Signed-off-by: Arthur Huillet <ahuil...@nvidia.com>
---
 .../arb_direct_state_access/bind-texture-unit.c    | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tests/spec/arb_direct_state_access/bind-texture-unit.c 
b/tests/spec/arb_direct_state_access/bind-texture-unit.c
index b6a98a9..de06791 100644
--- a/tests/spec/arb_direct_state_access/bind-texture-unit.c
+++ b/tests/spec/arb_direct_state_access/bind-texture-unit.c
@@ -53,21 +53,35 @@ piglit_display(void)
        GLint nunits;
 
        /* Throw some invalid inputs at BindTextureUnit. */
-       /* Non-gen-d texture name */
+
+
+       /* GL 4.5 spec section 8.1:
+          "An INVALID_OPERATION error is generated by BindTextureUnit if
+           texture is not zero or the name of an existing texture object." */
+
+       /* Texture name doesn't exist */
        glBindTextureUnit(0, name);
        pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
 
-       /* No target */
+       /* Texture name exists, but texture object does not */
        glGenTextures(1, &name);
        glBindTextureUnit(0, name);
-       pass &= piglit_check_gl_error(GL_INVALID_ENUM);
+       pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+
+       /* GL 4.5 spec section 8.1 says of BindTextures:
+          "An INVALID_OPERATION error is generated if first + count is greater
+               than the number of texture image units supported by the
+               implementation."
+          However, it doesn't say the same about BindTextureUnit.
+          Table 2.3 implies that a numeric argument out of range yields
+          INVALID_VALUE, not INVALID_OPERATION. */
 
        /* Texture unit doesn't exist */
        glDeleteTextures(1, &name);
        glCreateTextures(GL_TEXTURE_2D, 1, &name);
        glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &nunits);
        glBindTextureUnit(nunits, name); /* Too High */
-       pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
+       pass &= piglit_check_gl_error(GL_INVALID_VALUE);
 
        /* Trivial, but should work. */
        glBindTextureUnit(1, name);
-- 
2.3.5
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to