[Piglit] [PATCH 3/6] sso: new test IsProgramPipeline:

Gregory Hainaut gregory.hainaut at gmail.com
Sat May 25 03:29:28 PDT 2013


check the Pipeline object state creation. GenPipeline
only reserved name. I also take the opportunity to test negative value
on glGenProgramPipelines and glDeleteProgramPipelines.
Note: FGLRX don't follow the spec besides crash on glGenProgramPipelines because of -1...
Note: Nvidia crash on glGetProgramPipelineiv(id[3], GL_VERTEX_SHADER, &dummy), no shader
was set to they probably unreference a NULL pointer. By the way Nvidia doesn't follow the
spec neither.

V4: split the new test in a separate commit
---
 tests/all.tests                                    |    1 +
 .../IsProgramPipeline.c                            |  113 ++++++++++++++++++++
 2 files changed, 114 insertions(+)
 create mode 100644 tests/spec/arb_separate_shader_objects/IsProgramPipeline.c

diff --git a/tests/all.tests b/tests/all.tests
index 8047cd1..e8dfcbe 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1104,6 +1104,7 @@ add_concurrent_test(arb_occlusion_query, 'occlusion_query_order')
 arb_separate_shader_objects = Group()
 spec['ARB_separate_shader_objects'] = arb_separate_shader_objects
 arb_separate_shader_objects['sso-GetProgramPipelineiv'] = concurrent_test('arb_separate_shader_object-GetProgramPipelineiv')
+arb_separate_shader_objects['sso-IsProgramPipeline'] = concurrent_test('arb_separate_shader_object-IsProgramPipeline')
 
 # Group ARB_sampler_objects
 arb_sampler_objects = Group()
diff --git a/tests/spec/arb_separate_shader_objects/IsProgramPipeline.c b/tests/spec/arb_separate_shader_objects/IsProgramPipeline.c
new file mode 100644
index 0000000..8da08e7
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/IsProgramPipeline.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright © 2013 Gregory Hainaut <gregory.hainaut at gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/*
+ * The command
+ * void GenProgramPipelines( sizei n, uint *pipelines );
+ * returns n previously unused program pipeline object names in pipelines. These
+ * names are marked as used, for the purposes of GenProgramPipelines only, but
+ * they acquire state only when they are first bound.
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 10;
+
+	config.window_width = 32;
+	config.window_height = 32;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLboolean pass;
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+static void
+IsProgramPipeline(GLuint pipe, GLboolean expected) {
+	GLboolean status = glIsProgramPipeline(pipe);
+	if(status != expected) {
+		pass &= GL_FALSE;
+		fprintf(stderr, "Pipeline %d has wrong IsProgramPipeline. Expected %d, got %d\n", pipe, expected, status);
+	}
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLuint id[4];
+	int i;
+	GLint dummy;
+
+	piglit_require_gl_version(20);
+	piglit_require_extension("GL_ARB_separate_shader_objects");
+
+	pass = GL_TRUE;
+
+	assert(glGetError() == GL_NO_ERROR);
+
+	printf("glGenProgramPipelines with negative n value\n");
+	glGenProgramPipelines( -1, id);
+	pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+
+	printf("glGenProgramPipelines with correct n value\n");
+	glGenProgramPipelines( 4, id);
+	pass &= piglit_check_gl_error(GL_NO_ERROR);
+
+	for (i = 0; i < 4 ; i++) {
+		IsProgramPipeline(id[i], GL_FALSE);
+	}
+
+	glBindProgramPipeline(id[0]);
+	glUseProgramStages(id[1], GL_ALL_SHADER_BITS, 0);
+	glActiveShaderProgram(id[2], 0);
+	glGetProgramPipelineiv(id[3], GL_VERTEX_SHADER, &dummy);
+	/* Flush any errors. The goal is to check that object acquire a state */
+	while (glGetError() != GL_NO_ERROR)
+		;
+
+	for (i = 0; i < 4 ; i++) {
+		IsProgramPipeline(id[i], GL_TRUE);
+	}
+
+	printf("glDeleteProgramPipelines with negative n value\n");
+	glDeleteProgramPipelines( -1, id);
+	pass &= piglit_check_gl_error(GL_INVALID_VALUE);
+
+	printf("glDeleteProgramPipelines with correct n value\n");
+	glDeleteProgramPipelines( 4, id);
+	pass &= piglit_check_gl_error(GL_NO_ERROR);
+
+	piglit_present_results();
+
+	if (pass)
+		piglit_report_result(PIGLIT_PASS);
+	else
+		piglit_report_result(PIGLIT_FAIL);
+}
-- 
1.7.10.4



More information about the Piglit mailing list