<div dir="ltr">On 7 June 2013 21:33, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Test that glDrawArrays() triggers the required errors.<br>
<br>
The geometry shader input type limits the valid primitive types of glBegin()<br>
(including implicit glBegin()).<br>
<br>
>From the ARB_geometry_shader4 spec (section Errors):<br>
"The error INVALID_OPERATION is generated if Begin, or any command that<br>
implicitly calls Begin, is called when a geometry shader is active and:<br>
<br>
* the input primitive type of the current geometry shader is<br>
POINTS and <mode> is not POINTS,<br>
<br>
* the input primitive type of the current geometry shader is<br>
LINES and <mode> is not LINES, LINE_STRIP, or LINE_LOOP,<br>
<br>
* the input primitive type of the current geometry shader is<br>
TRIANGLES and <mode> is not TRIANGLES, TRIANGLE_STRIP or<br>
TRIANGLE_FAN,<br>
<br>
* the input primitive type of the current geometry shader is<br>
LINES_ADJACENCY_ARB and <mode> is not LINES_ADJACENCY_ARB or<br>
LINE_STRIP_ADJACENCY_ARB, or<br>
<br>
* the input primitive type of the current geometry shader is<br>
TRIANGLES_ADJACENCY_ARB and <mode> is not<br>
TRIANGLES_ADJACENCY_ARB or TRIANGLE_STRIP_ADJACENCY_ARB."<br>
---<br>
tests/all.tests | 1 +<br>
.../execution/program-parameter/CMakeLists.gl.txt | 1 +<br>
.../execution/program-parameter/input-type-draw.c | 126 +++++++++++++++++++++<br>
3 files changed, 128 insertions(+)<br>
create mode 100644 tests/spec/arb_geometry_shader4/execution/program-parameter/input-type-draw.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index b6d7cd1..785c864 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -2298,6 +2298,7 @@ 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>
+add_concurrent_test(arb_geometry_shader4, 'program-parameter-input-type-draw')<br>
add_concurrent_test(arb_geometry_shader4, 'program-parameter-output-type')<br>
for mode in ['4', 'tf 1', '32', 'tf 32']:<br>
add_concurrent_test(arb_geometry_shader4, 'program-parameter-vertices-out {0}'.format(mode))<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>
index 5768ead..0e526dc 100644<br>
--- a/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_geometry_shader4/execution/program-parameter/CMakeLists.gl.txt<br>
@@ -11,5 +11,6 @@ link_libraries (<br>
)<br>
<br>
piglit_add_executable (program-parameter-input-type input-type.c)<br>
+piglit_add_executable (program-parameter-input-type-draw input-type-draw.c)<br>
piglit_add_executable (program-parameter-output-type output-type.c)<br>
piglit_add_executable (program-parameter-vertices-out vertices-out.c)<br>
diff --git a/tests/spec/arb_geometry_shader4/execution/program-parameter/input-type-draw.c b/tests/spec/arb_geometry_shader4/execution/program-parameter/input-type-draw.c<br>
new file mode 100644<br>
index 0000000..bcbf5ec<br>
--- /dev/null<br>
+++ b/tests/spec/arb_geometry_shader4/execution/program-parameter/input-type-draw.c<br>
@@ -0,0 +1,126 @@<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-draw.c<br>
+ *<br>
+ * Test required errors for wrong GL_GEOMETRY_INPUT_TYPE and drawing mode<br>
+ * parameter combinations.<br>
+ */<br>
+<br>
+#include "common.h"<br>
+<br>
+<br>
+struct primitive_draw_info {<br>
+ GLenum type;<br>
+ GLenum base_type;<br>
+};<br>
+<br>
+<br>
+static const struct primitive_draw_info primitives_draw[] = {<br>
+ {GL_POINTS, GL_POINTS},<br>
+<br>
+ {GL_LINES, GL_LINES},<br>
+ {GL_LINE_STRIP, GL_LINES},<br>
+ {GL_LINE_LOOP, GL_LINES},<br>
+<br>
+ {GL_TRIANGLES, GL_TRIANGLES},<br>
+ {GL_TRIANGLE_STRIP, GL_TRIANGLES},<br>
+ {GL_TRIANGLE_FAN, GL_TRIANGLES},<br>
+<br>
+ {GL_LINES_ADJACENCY, GL_LINES_ADJACENCY},<br>
+ {GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY},<br>
+<br>
+ {GL_TRIANGLES_ADJACENCY, GL_TRIANGLES_ADJACENCY},<br>
+ {GL_TRIANGLE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY},<br>
+<br>
+ {GL_QUADS, 0xFFFF},<br>
+ {GL_QUAD_STRIP, 0xFFFF},<br>
+ {GL_POLYGON, 0xFFFF},<br>
+};<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, j;<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>This test needs "piglit_require_extension("GL_ARB_geometry_shader4");". With that fix, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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 geom = primitives_in[i];<br>
+<br>
+ if (geom.error != GL_NO_ERROR)<br>
+ continue;<br>
+<br>
+ glProgramParameteri(prog, GL_GEOMETRY_INPUT_TYPE_ARB, geom.type);<br>
+<br>
+ glLinkProgram(prog);<br>
+ if (!piglit_link_check_status(prog) ||<br>
+ !piglit_check_gl_error(GL_NO_ERROR)) {<br>
+ piglit_report_result(PIGLIT_FAIL);<br>
+ }<br>
+ glUseProgram(prog);<br>
+ glUniform1i(glGetUniformLocation(prog, "vertex_count"), 1);<br>
+<br>
+ for (j = 0; j < ARRAY_SIZE(primitives_draw); j++) {<br>
+ const struct primitive_draw_info draw = primitives_draw[j];<br>
+ GLenum e;<br>
+<br>
+ printf("Testing drawing type %s, geometry input type %s.\n",<br>
+ piglit_get_prim_name(draw.type),<br>
+ piglit_get_prim_name(geom.type));<br>
+<br>
+ if (draw.base_type == geom.type)<br>
+ e = GL_NO_ERROR;<br>
+ else<br>
+ e = GL_INVALID_OPERATION;<br>
+<br>
+ glDrawArrays(draw.type, 0, 0);<br>
+ pass = piglit_check_gl_error(e) && pass;<br>
+ }<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=""><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>