<div dir="ltr">On 7 June 2013 11:12, Fabian Bieler <span dir="ltr"><<a href="mailto:fabianbieler@fastmail.fm" target="_blank">fabianbieler@fastmail.fm</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Test that glProgramParameter() triggers the required errors.<br>
<br>
The geometry shader input primitive type is limited to a subset<br>
of OpenGL primitive types.<br>
<br>
>From the ARB_geometry_shader4 spec (section Errors):<br>
"The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is<br>
GEOMETRY_INPUT_TYPE_ARB and <value> is not one of POINTS, LINES,<br>
LINES_ADJACENCY_ARB, TRIANGLES or TRIANGLES_ADJACENCY_ARB."<br>
---<br>
 tests/all.tests                                    |   1 +<br>
 tests/spec/CMakeLists.txt                          |   1 +<br>
 tests/spec/arb_geometry_shader4/CMakeLists.txt     |   1 +<br>
 .../arb_geometry_shader4/execution/CMakeLists.txt  |   1 +<br>
 .../execution/program-parameter/CMakeLists.gl.txt  |  13 +++<br>
 .../execution/program-parameter/CMakeLists.txt     |   1 +<br>
 .../execution/program-parameter/common.h           | 117 +++++++++++++++++++++<br>
 .../execution/program-parameter/input-type.c       |  69 ++++++++++++<br>
 8 files changed, 204 insertions(+)<br>
 create mode 100644 tests/spec/arb_geometry_shader4/CMakeLists.txt<br>
 create mode 100644 tests/spec/arb_geometry_shader4/execution/CMakeLists.txt<br>
 create mode 100644 tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt<br>
 create mode 100644 tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.txt<br>
 create mode 100644 tests/spec/arb_geometry_shader4/execution/program-parameter/common.h<br>
 create mode 100644 tests/spec/arb_geometry_shader4/execution/program-parameter/input-type.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 73f08f4..897542e 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -2297,6 +2297,7 @@ spec['ARB_map_buffer_alignment'] = arb_map_buffer_alignment<br>
 add_plain_test(arb_map_buffer_alignment, 'arb_map_buffer_alignment-sanity_test')<br>
<br>
 arb_geometry_shader4 = Group()<br>
+add_concurrent_test(arb_geometry_shader4, 'program-parameter-input-type')<br>
 spec['ARB_geometry_shader4'] = arb_geometry_shader4<br>
 add_shader_test_dir(spec['ARB_geometry_shader4'],<br>
                     os.path.join(testsDir, 'spec', 'arb_geometry_shader4'),<br>
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt<br>
index 690f463..e6cd6d2 100644<br>
--- a/tests/spec/CMakeLists.txt<br>
+++ b/tests/spec/CMakeLists.txt<br>
@@ -5,6 +5,7 @@ add_subdirectory (arb_draw_instanced)<br>
 add_subdirectory (arb_es2_compatibility)<br>
 add_subdirectory (arb_framebuffer_object)<br>
 add_subdirectory (arb_framebuffer_srgb)<br>
+add_subdirectory (arb_geometry_shader4)<br>
 add_subdirectory (arb_instanced_arrays)<br>
 add_subdirectory (arb_internalformat_query)<br>
 add_subdirectory (arb_map_buffer_alignment)<br>
diff --git a/tests/spec/arb_geometry_shader4/CMakeLists.txt b/tests/spec/arb_geometry_shader4/CMakeLists.txt<br>
new file mode 100644<br>
index 0000000..bb76f08<br>
--- /dev/null<br>
+++ b/tests/spec/arb_geometry_shader4/CMakeLists.txt<br>
@@ -0,0 +1 @@<br>
+add_subdirectory (execution)<br>
diff --git a/tests/spec/arb_geometry_shader4/execution/CMakeLists.txt b/tests/spec/arb_geometry_shader4/execution/CMakeLists.txt<br>
new file mode 100644<br>
index 0000000..872db20<br>
--- /dev/null<br>
+++ b/tests/spec/arb_geometry_shader4/execution/CMakeLists.txt<br>
@@ -0,0 +1 @@<br>
+add_subdirectory (program-parameter)<br>
diff --git a/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt<br>
new file mode 100644<br>
index 0000000..786eb31<br>
--- /dev/null<br>
+++ b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt<br>
@@ -0,0 +1,13 @@<br>
+include_directories(<br>
+       ${GLEXT_INCLUDE_DIR}<br>
+       ${OPENGL_INCLUDE_PATH}<br>
+       ${piglit_SOURCE_DIR}/tests/util<br>
+)<br>
+<br>
+link_libraries (<br>
+       piglitutil_${piglit_target_api}<br>
+       ${OPENGL_gl_LIBRARY}<br>
+       ${OPENGL_glu_LIBRARY}<br>
+)<br>
+<br>
+piglit_add_executable (program-parameter-input-type input-type.c)<br>
diff --git a/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.txt b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.txt<br>
new file mode 100644<br>
index 0000000..144a306<br>
--- /dev/null<br>
+++ b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.txt<br>
@@ -0,0 +1 @@<br>
+piglit_include_target_api()<br>
diff --git a/tests/spec/arb_geometry_shader4/execution/program-parameter/common.h b/tests/spec/arb_geometry_shader4/execution/program-parameter/common.h<br>
new file mode 100644<br>
index 0000000..7504591<br>
--- /dev/null<br>
+++ b/tests/spec/arb_geometry_shader4/execution/program-parameter/common.h<br>
@@ -0,0 +1,117 @@<br>
+/*<br>
+ * Copyright © 2013 The Piglit project<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
+ * DEALINGS IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/**<br>
+ * \file common.h<br>
+ *<br>
+ * Common code for glProgramParameter testing.<br>
+ */<br>
+<br>
+#include "piglit-util-gl-common.h"<br>
+<br>
+<br>
+struct primitive_geom_info {<br>
+       GLenum type;<br>
+       GLenum error;<br>
+};<br>
+<br>
+<br>
+static const struct primitive_geom_info primitives_in[] = {<br>
+       {GL_POINTS, GL_NO_ERROR},<br>
+<br>
+       {GL_LINES, GL_NO_ERROR},<br>
+       {GL_LINE_STRIP, GL_INVALID_VALUE},<br>
+       {GL_LINE_LOOP, GL_INVALID_VALUE},<br>
+<br>
+       {GL_TRIANGLES, GL_NO_ERROR},<br>
+       {GL_TRIANGLE_STRIP, GL_INVALID_VALUE},<br>
+       {GL_TRIANGLE_FAN, GL_INVALID_VALUE},<br>
+<br>
+       {GL_LINES_ADJACENCY, GL_NO_ERROR},<br>
+       {GL_LINE_STRIP_ADJACENCY, GL_INVALID_VALUE},<br>
+<br>
+       {GL_TRIANGLES_ADJACENCY, GL_NO_ERROR},<br>
+       {GL_TRIANGLE_STRIP_ADJACENCY, GL_INVALID_VALUE},<br>
+<br>
+       {GL_QUADS, GL_INVALID_VALUE},<br>
+       {GL_QUAD_STRIP, GL_INVALID_VALUE},<br>
+       {GL_POLYGON, GL_INVALID_VALUE},<br>
+};<br>
+<br>
+<br>
+/* Primitive types passed to glBegin (or equivalent) and matching geometry<br>
+ * shader input type; */<br></blockquote><div><br></div><div>This comment seems out of place.  Is it meant to go above "static const struct primitive_geom_info primitives_in[] = {"?<br><br>Also, our usual style for formatting comments is to put "*/" on a line by itself for multi-line comments.  For example:<br>
<br></div><div>/* Here is a<br></div><div> * multiline<br></div><div> * comment<br> */<br><br></div><div>For single-line comments, we put the "*/" on the same line as the comment:<br><br></div><div>/* Like this */<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+static const char vs_text[] =<br>
+       "void main()\n"<br>
+       "{\n"<br>
+       "       gl_Position = vec4(0);\n"<br>
+       "}\n";<br>
+<br>
+static const char gs_text4[] =<br>
+       "#extension GL_ARB_geometry_shader4: enable\n"<br>
+       "uniform int vertex_count;\n"<br>
+       "void main()\n"<br>
+       "{\n"<br>
+       "       for (int i = 0; i < vertex_count; i++) {\n"<br>
+       "               gl_Position = vec4(0.0);\n"<br>
+       "               EmitVertex();\n"<br>
+       "       }\n"<br>
+       "}\n";<br>
+<br>
+static const char fs_text4[] =<br>
+       "void main()\n"<br>
+       "{\n"<br>
+       "       gl_FragColor = vec4(1.0);\n"<br>
+       "}\n";<br>
+<br>
+<br>
+static GLuint<br>
+create_shader(const char *const vs_text, const char *const gs_text,<br>
+             const char *const fs_text)<br>
+{<br>
+       const char *const varying = "var";<br>
+       GLuint vs, gs, fs, prog;<br>
+<br>
+       prog = glCreateProgram();<br>
+       vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);<br>
+       glAttachShader(prog, vs);<br>
+       glDeleteShader(vs);<br>
+       gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gs_text);<br>
+       glAttachShader(prog, gs);<br>
+       glDeleteShader(gs);<br>
+       if (fs_text) {<br>
+               fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);<br>
+               glAttachShader(prog, fs);<br>
+               glDeleteShader(fs);<br>
+       } else {<br>
+               glTransformFeedbackVaryings(prog, 1, &varying,<br>
+                                           GL_INTERLEAVED_ATTRIBS);<br>
+       }<br>
+<br>
+       if (!piglit_check_gl_error(GL_NO_ERROR))<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+<br>
+       return prog;<br>
+}<br>
+<br>
diff --git a/tests/spec/arb_geometry_shader4/execution/program-parameter/input-type.c b/tests/spec/arb_geometry_shader4/execution/program-parameter/input-type.c<br>
new file mode 100644<br>
index 0000000..fcc4223<br>
--- /dev/null<br>
+++ b/tests/spec/arb_geometry_shader4/execution/program-parameter/input-type.c<br>
@@ -0,0 +1,69 @@<br>
+/*<br>
+ * Copyright © 2013 The Piglit project<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
+ * DEALINGS IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/**<br>
+ * \file input-type.c<br>
+ *<br>
+ * Test required errors for wrong GL_GEOMETRY_INPUT_TYPE parameters.<br>
+ */<br>
+<br>
+#include "common.h"<br>
+<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+       config.supports_gl_compat_version = 20;<br>
+       config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       bool pass = true;<br>
+       GLuint prog;<br>
+       int i;<br>
+<br>
+       /* NV_geometry_shader4 relaxes some restrictions on valid program<br>
+        * parameters.<br>
+        */<br>
+       piglit_require_not_extension("GL_NV_geometry_shader4");<br></blockquote><div><br></div><div>Need to also add:<br><br></div><div>piglit_require_extension("GL_ARB_geometry_shader4");<br><br></div>
<div>With those fixes, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+<br>
+       /* Create shader. */<br>
+       prog = create_shader(vs_text, gs_text4, fs_text4);<br>
+<br>
+       for (i = 0; i < ARRAY_SIZE(primitives_in); i++) {<br>
+               const struct primitive_geom_info p = primitives_in[i];<br>
+               printf("Testing %s.\n", piglit_get_prim_name(p.type));<br>
+               glProgramParameteri(prog, GL_GEOMETRY_INPUT_TYPE_ARB, p.type);<br>
+               pass = piglit_check_gl_error(p.error) && pass;<br>
+       }<br>
+<br>
+       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+       /* Should never be reached */<br>
+       return PIGLIT_FAIL;<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.2<br>
<br>
</font></span><br>_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
<br></blockquote></div><br></div></div>