[Piglit] [PATCH 1/4] GL_ARB_shader_objects: Test for error on glGetActiveUniform() in begin/end.

Eric Anholt eric at anholt.net
Mon May 14 16:30:05 PDT 2012


Based on an error report from oglconform.
---
 tests/all.tests                                    |    1 +
 tests/spec/arb_shader_objects/CMakeLists.gl.txt    |    1 +
 .../arb_shader_objects/getactiveuniform-beginend.c |   82 ++++++++++++++++++++
 3 files changed, 84 insertions(+)
 create mode 100644 tests/spec/arb_shader_objects/getactiveuniform-beginend.c

diff --git a/tests/all.tests b/tests/all.tests
index f1be7cf..4281447 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1122,6 +1122,7 @@ spec['ARB_shader_objects'] = arb_shader_objects
 arb_shader_objects['getuniform'] = PlainExecTest(['arb_shader_objects-getuniform', '-auto'])
 arb_shader_objects['getuniform'].runConcurrent = True
 arb_shader_objects['bindattriblocation-scratch-name'] = concurrent_test('arb_shader_objects-bindattriblocation-scratch-name')
+arb_shader_objects['getactiveuniform-beginend'] = concurrent_test('arb_shader_objects-getactiveuniform-beginend')
 arb_shader_objects['getuniformlocation-array-of-struct-of-array'] = concurrent_test('arb_shader_objects-getuniformlocation-array-of-struct-of-array')
 arb_shader_objects['clear-with-deleted'] = concurrent_test('arb_shader_objects-clear-with-deleted')
 arb_shader_objects['delete-repeat'] = concurrent_test('arb_shader_objects-delete-repeat')
diff --git a/tests/spec/arb_shader_objects/CMakeLists.gl.txt b/tests/spec/arb_shader_objects/CMakeLists.gl.txt
index 12b16d5..984698b 100644
--- a/tests/spec/arb_shader_objects/CMakeLists.gl.txt
+++ b/tests/spec/arb_shader_objects/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ link_libraries (
 )
 
 piglit_add_executable (arb_shader_objects-bindattriblocation-scratch-name bindattriblocation-scratch-name.c)
+piglit_add_executable (arb_shader_objects-getactiveuniform-beginend getactiveuniform-beginend.c)
 piglit_add_executable (arb_shader_objects-getuniform getuniform.c)
 piglit_add_executable (arb_shader_objects-getuniformlocation-array-of-struct-of-array getuniformlocation-array-of-struct-of-array.c)
 piglit_add_executable (arb_shader_objects-clear-with-deleted clear-with-deleted.c)
diff --git a/tests/spec/arb_shader_objects/getactiveuniform-beginend.c b/tests/spec/arb_shader_objects/getactiveuniform-beginend.c
new file mode 100644
index 0000000..bd10a43
--- /dev/null
+++ b/tests/spec/arb_shader_objects/getactiveuniform-beginend.c
@@ -0,0 +1,82 @@
+/* © 2011 Intel Corporation
+ *
+ * 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.
+ */
+
+#include "piglit-util.h"
+
+/**
+ * @file getactiveuniform-beginend.c
+ *
+ * Tests for a missing error condition in Mesa:
+ *
+ *     "Executing any other GL command between the execution of Begin
+ *      and the corresponding execution of End results in the error
+ *      INVALID OPERATION."
+ */
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+	/* Not reached */
+	return PIGLIT_FAIL;
+}
+
+const char *vs_source =
+	"uniform vec4 u;\n"
+	"void main()\n"
+	"{\n"
+	"	gl_Position = u;\n"
+	"}\n";
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLuint vs, prog;
+	char name[4];
+	GLint size, len;
+	GLenum type;
+
+	piglit_require_vertex_shader();
+	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
+
+	prog = piglit_link_simple_program(vs, 0);
+	glUseProgram(prog);
+	if (!vs || !prog)
+		piglit_report_result(PIGLIT_FAIL);
+
+	glGetActiveUniformARB(prog, 0, sizeof(name), &len, &size, &type, name);
+
+	if (!piglit_check_gl_error(0))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glBegin(GL_TRIANGLES);
+	glGetActiveUniformARB(prog, 0, sizeof(name), &len, &size, &type, name);
+	glEnd();
+
+	if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+		piglit_report_result(PIGLIT_FAIL);
+
+	piglit_report_result(PIGLIT_PASS);
+}
-- 
1.7.10



More information about the Piglit mailing list