[Piglit] [PATCH] clearbuffer-invalid-drawbuffer: Fix test cases calling glClearBufferiv with depth buffers

Eduardo Lima Mitev elima at igalia.com
Tue Feb 24 01:46:51 PST 2015


Page 262 of the PDF, section '4.2.3 Clearing the Buffers' of the
OpenGL 3.0 spec states:

    "Only ClearBufferfv should be used to clear depth buffers."

And in the Errors definition of the same section (page 263 of the PDF):

    "ClearBuffer generates an INVALID ENUM error if buffer does not
     identify a valid buffer in or attachment of the currently bound
     draw framebuffer, or if buffer is not one of the buffer names
     specified as valid for that form of ClearBuffer command."

The affected test is not complying with this wording, and is expecting a
GL_INVALID_VALUE when glClearBufferiv is called with a depth buffer but, due to
other constrain.
---
 .../gl-3.0/api/clearbuffer-invalid-drawbuffer.c    | 36 ++++++++++++++--------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/tests/spec/gl-3.0/api/clearbuffer-invalid-drawbuffer.c b/tests/spec/gl-3.0/api/clearbuffer-invalid-drawbuffer.c
index 262b8b7..0ac04f2 100644
--- a/tests/spec/gl-3.0/api/clearbuffer-invalid-drawbuffer.c
+++ b/tests/spec/gl-3.0/api/clearbuffer-invalid-drawbuffer.c
@@ -77,14 +77,6 @@ void piglit_init(int argc, char **argv)
 	if (!piglit_check_gl_error(GL_INVALID_VALUE))
 		piglit_report_result(PIGLIT_FAIL);
 
-	glClearBufferiv(GL_DEPTH, 1, zero_i);
-	if (!piglit_check_gl_error(GL_INVALID_VALUE))
-		piglit_report_result(PIGLIT_FAIL);
-
-	glClearBufferiv(GL_DEPTH, -1, zero_i);
-	if (!piglit_check_gl_error(GL_INVALID_VALUE))
-		piglit_report_result(PIGLIT_FAIL);
-
 	glClearBufferuiv(GL_DEPTH, 1, (GLuint *) zero_i);
 	if (!piglit_check_gl_error(GL_INVALID_VALUE))
 		piglit_report_result(PIGLIT_FAIL);
@@ -211,10 +203,6 @@ void piglit_init(int argc, char **argv)
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		piglit_report_result(PIGLIT_FAIL);
 
-	glClearBufferiv(GL_DEPTH, 0, zero_i);
-	if (!piglit_check_gl_error(GL_NO_ERROR))
-		piglit_report_result(PIGLIT_FAIL);
-
 	glClearBufferuiv(GL_DEPTH, 0, (GLuint *) zero_i);
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		piglit_report_result(PIGLIT_FAIL);
@@ -235,5 +223,29 @@ void piglit_init(int argc, char **argv)
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		piglit_report_result(PIGLIT_FAIL);
 
+	/* Page 262 of the PDF, section '4.2.3 Clearing the Buffers' of the
+	 * OpenGL 3.0 spec states:
+	 *
+	 *    "Only ClearBufferfv should be used to clear depth buffers."
+	 *
+	 * And in the Errors definition of the same section (page 263 of the PDF):
+	 *
+	 *    "ClearBuffer generates an INVALID ENUM error if buffer does not
+	 *     identify a valid buffer in or attachment of the currently bound
+	 *     draw framebuffer, or if buffer is not one of the buffer names
+	 *     specified as valid for that form of ClearBuffer command."
+	 */
+	glClearBufferiv(GL_DEPTH, 1, zero_i);
+	if (!piglit_check_gl_error(GL_INVALID_ENUM))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glClearBufferiv(GL_DEPTH, -1, zero_i);
+	if (!piglit_check_gl_error(GL_INVALID_ENUM))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glClearBufferiv(GL_DEPTH, 0, zero_i);
+	if (!piglit_check_gl_error(GL_INVALID_ENUM))
+		piglit_report_result(PIGLIT_FAIL);
+
 	piglit_report_result(PIGLIT_PASS);
 }
-- 
2.1.3



More information about the Piglit mailing list