[Piglit] [PATCH] arb_transform_feedback3: fix error expectation of invalid args test

Tapani Pälli tapani.palli at intel.com
Mon Oct 10 06:48:10 UTC 2016


Test assumed GL_INVALID_VALUE in case glTransformFeedbackVaryings was
given non-existing program. However there is also existing rule that
specifies that INVALID_OPERATION should be returned in case object given
is not of expected type (shader vs program case).

This matches the error expectation of following dEQP test:
   dEQP-GLES31.functional.debug.negative_coverage.get_error.shader.transform_feedback_varyings

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 .../set_varyings_with_invalid_args.c               | 34 ++++++++++++++++++----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c b/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
index 562477f..a353a7c 100644
--- a/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
+++ b/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
@@ -34,6 +34,14 @@
  *  <program> is not the name of a program object, or if <bufferMode> is
  *  SEPARATE_ATTRIBS and <count> is greater than the limit
  *  MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS."
+ *
+ * Additionally accept following common rule with shader object API, specified
+ * by the 'Shader Objects' section of OpenGL spec:
+ *
+ * "Commands that accept shader or program object names will generate the error
+ * INVALID VALUE if the provided name is not the name of either a shader or pro-
+ * gram object and INVALID OPERATION if the provided name identifies an object
+ * that is not the expected type."
  */
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
@@ -80,7 +88,7 @@ try_max_varyings(GLuint prog, unsigned n)
 void
 piglit_init(int argc, char **argv)
 {
-	GLuint prog;
+	GLuint vs, gs, prog;
 	GLint max_attrib_n;
 
 	piglit_require_extension("GL_ARB_transform_feedback3");
@@ -92,16 +100,32 @@ piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	prog = piglit_build_simple_program_multiple_shaders(
-			GL_VERTEX_SHADER, vs_pass_thru_text,
-			GL_GEOMETRY_SHADER, gs_simple_text, 0);
+	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_pass_thru_text);
+	gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gs_simple_text);
+
+	if (!vs || !gs)
+		piglit_report_result(PIGLIT_FAIL);
+
+	prog = glCreateProgram();
+	glAttachShader(prog, vs);
+	glAttachShader(prog, gs);
+	glLinkProgram(prog);
+
+	if(!piglit_link_check_status(prog))
+		piglit_report_result(PIGLIT_FAIL);
 
 	/* Try invalid program */
-	glTransformFeedbackVaryings(prog + 1, ARRAY_SIZE(varyings), varyings,
+	glTransformFeedbackVaryings(42, ARRAY_SIZE(varyings), varyings,
 				GL_INTERLEAVED_ATTRIBS);
 	if (!piglit_check_gl_error(GL_INVALID_VALUE))
 		piglit_report_result(PIGLIT_FAIL);
 
+	/* Try shader in place of program. */
+	glTransformFeedbackVaryings(vs, ARRAY_SIZE(varyings), varyings,
+				GL_INTERLEAVED_ATTRIBS);
+	if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+		piglit_report_result(PIGLIT_FAIL);
+
 	/* Try too many attributes */
 	try_max_varyings(prog, max_attrib_n + 1);
 	if (!piglit_check_gl_error(GL_INVALID_VALUE))
-- 
2.7.4



More information about the Piglit mailing list