<div dir="ltr">On 16 August 2013 11:57, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</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">
Assuming we'll have tougher tests later, this test is<br>
<br>
Reviewed-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com" target="_blank">ian.d.romanick@intel.com</a>><br>
<br>
On side comment below...<div><div class="h5"><br>
<br>
On 08/07/2013 10:15 AM, Paul Berry wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
  tests/all.tests                                    |   2 +<br>
  .../spec/ext_transform_<u></u>feedback/CMakeLists.gl.txt  |   1 +<br>
  .../geometry-shaders-basic.c                       | 171 +++++++++++++++++++++<br>
  3 files changed, 174 insertions(+)<br>
  create mode 100644 tests/spec/ext_transform_<u></u>feedback/geometry-shaders-<u></u>basic.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 2f32120..bf46ae1 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -2116,6 +2116,8 @@ for api_suffix, possible_options in [('', [[], ['interface']]),<br>
                                          api_suffix, ' '.join(args))<br>
                                  ext_transform_feedback[test_<u></u>name] = concurrent_test(<br>
                                          'ext_transform_feedback-{0}'.<u></u>format(test_name))<br>
+ext_transform_feedback['<u></u>geometry-shaders-basic'] = concurrent_test(<br>
+        'ext_transform_feedback-<u></u>geometry-shaders-basic')<br>
<br>
  arb_transform_feedback2 = Group()<br>
  spec['ARB_transform_feedback2'<u></u>] = arb_transform_feedback2<br>
diff --git a/tests/spec/ext_transform_<u></u>feedback/CMakeLists.gl.txt b/tests/spec/ext_transform_<u></u>feedback/CMakeLists.gl.txt<br>
index e881033..1d03abd 100644<br>
--- a/tests/spec/ext_transform_<u></u>feedback/CMakeLists.gl.txt<br>
+++ b/tests/spec/ext_transform_<u></u>feedback/CMakeLists.gl.txt<br>
@@ -21,6 +21,7 @@ piglit_add_executable (ext_transform_feedback-<u></u>discard-copypixels discard-copypix<br>
  piglit_add_executable (ext_transform_feedback-<u></u>discard-drawarrays discard-drawarrays.c)<br>
  piglit_add_executable (ext_transform_feedback-<u></u>discard-drawpixels discard-drawpixels.c)<br>
  piglit_add_executable (ext_transform_feedback-<u></u>generatemipmap generatemipmap.c)<br>
+piglit_add_executable (ext_transform_feedback-<u></u>geometry-shaders-basic geometry-shaders-basic.c)<br>
  piglit_add_executable (ext_transform_feedback-get-<u></u>buffer-state get-buffer-state.c)<br>
  piglit_add_executable (ext_transform_feedback-<u></u>position position.c)<br>
  piglit_add_executable (ext_transform_feedback-<u></u>immediate-reuse immediate-reuse.c)<br>
diff --git a/tests/spec/ext_transform_<u></u>feedback/geometry-shaders-<u></u>basic.c b/tests/spec/ext_transform_<u></u>feedback/geometry-shaders-<u></u>basic.c<br>
new file mode 100644<br>
index 0000000..ad63dc1<br>
--- /dev/null<br>
+++ b/tests/spec/ext_transform_<u></u>feedback/geometry-shaders-<u></u>basic.c<br>
@@ -0,0 +1,171 @@<br>
+/*<br>
+ * Copyright © 2013 Intel Corporation<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 geometry-shaders-basic.c<br>
+ *<br>
+ * Verify basic functionality of transform feedback when a geometry<br>
+ * shader is in use.<br>
+ *<br>
+ * This test checks that:<br>
+ *<br>
+ * - The number of primitives counted by GL_PRIMITIVES_GENERATED and<br>
+ *   GL_TRANSFORM_FEEDBACK_<u></u>PRIMITIVES_WRITTEN is based on the number<br>
+ *   of geometry shader output vertices (rather than the number of<br>
+ *   primitives sent down the pipeline).<br>
+ *<br>
+ * - Data output by the geometry shader is properly recorded in the<br>
+ *   transform feedback buffer.<br>
+ */<br>
+<br>
+#include "piglit-util-gl-common.h"<br>
+<br>
+#define GEOM_OUT_VERTS 10<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+       config.supports_gl_compat_<u></u>version = 32;<br>
+       config.supports_gl_core_<u></u>version = 32;<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+static const char *vstext =<br>
+       "#version 150\n"<br>
+       "in int vertex_count;\n"<br>
+       "out int vertex_count_to_gs;\n"<br>
+       "\n"<br>
+       "void main()\n"<br>
+       "{\n"<br>
+       "  vertex_count_to_gs = vertex_count;\n"<br>
+       "}\n";<br>
+<br>
+static const char *gstext =<br>
+       "#version 150\n"<br>
+       "layout(points) in;\n"<br>
+       "layout(points, max_vertices=10) out;\n"<br>
+       "in int vertex_count_to_gs[1];\n"<br>
+       "out int vertex_id;\n"<br>
+       "\n"<br>
+       "void main()\n"<br>
+       "{\n"<br>
+       "  for (int i = 0; i < vertex_count_to_gs[0]; i++) {\n"<br>
+       "    vertex_id = i;\n"<br>
+       "    EmitVertex();\n"<br>
+       "  }\n"<br>
+       "}\n";<br>
+<br>
+static const char *varyings[] = { "vertex_id" };<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       GLint vertex_data[1] = { GEOM_OUT_VERTS };<br>
+       bool pass = true;<br>
+       GLuint vs, gs, prog, array_buf, query_result, xfb_buf, generated_query,<br>
+               written_query, vao;<br>
+       GLint vertex_count_loc;<br>
+       const GLint *readback;<br>
+       int i;<br>
+<br>
+       vs = piglit_compile_shader_text(GL_<u></u>VERTEX_SHADER, vstext);<br>
+       gs = piglit_compile_shader_text(GL_<u></u>GEOMETRY_SHADER, gstext);<br>
+       prog = glCreateProgram();<br>
+       glAttachShader(prog, vs);<br>
+       glAttachShader(prog, gs);<br>
+       glTransformFeedbackVaryings(<u></u>prog, 1, varyings, GL_INTERLEAVED_ATTRIBS);<br>
+       glLinkProgram(prog);<br>
+       if (!piglit_link_check_status(<u></u>prog)) {<br>
+               glDeleteProgram(prog);<br>
+               piglit_report_result(PIGLIT_<u></u>FAIL);<br>
+       }<br>
</blockquote>
<br></div></div>
I have seen or written code like this lots of places in piglit.  I think we need a piglit_build_simple_program_<u></u>unlinked that does everything upto the glLinkProgram call.</blockquote><div><br></div><div>Yeah, that's a good point.  I'll do that as a follow-up.<br>
</div></div></div></div>