[Piglit] [PATCH 1/2] DSA: fix incorrect errors expected for BindTextureUnit()

Arthur Huillet arthur.huillet at free.fr
Fri Apr 24 06:05:26 PDT 2015


From: Arthur Huillet <ahuillet at 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 <ahuillet at 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..e257d3f 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 spec section 8.1:
+       "An INVALID_OPERATION error is generated by BindTextureUnit if tex-
+       ture is not zero or the name of an existing textuire 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 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


More information about the Piglit mailing list