On 28 June 2012 14:28, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 06/28/2012 11:04 AM, Jordan Justen wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Signed-off-by: Jordan Justen<<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.<u></u>com</a>><br>
---<br>
  tests/all.tests              |    1 +<br>
  tests/bugs/CMakeLists.gl.txt |    1 +<br>
  tests/bugs/fdo50925.c        |  105 ++++++++++++++++++++++++++++++<u></u>++++++++++++<br>
  3 files changed, 107 insertions(+)<br>
  create mode 100644 tests/bugs/fdo50925.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 63937b9..b584375 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -623,6 +623,7 @@ add_plain_test(bugs, 'r300-readcache')<br>
  add_plain_test(bugs, 'tex1d-2dborder')<br>
  add_plain_test(bugs, 'tri-tex-crash')<br>
  add_plain_test(bugs, 'vbo-buffer-unmap')<br>
+add_plain_test(bugs, 'fdo50925')<br>
<br>
  glx = Group()<br>
  add_plain_test(glx, 'glx-copy-sub-buffer')<br>
diff --git a/tests/bugs/CMakeLists.gl.txt b/tests/bugs/CMakeLists.gl.txt<br>
index 64c3093..d5e33e6 100644<br>
--- a/tests/bugs/CMakeLists.gl.txt<br>
+++ b/tests/bugs/CMakeLists.gl.txt<br>
@@ -31,5 +31,6 @@ piglit_add_executable (fdo28551 fdo28551.c)<br>
  piglit_add_executable (fdo31934 fdo31934.c)<br>
  piglit_add_executable (tri-tex-crash tri-tex-crash.c)<br>
  piglit_add_executable (vbo-buffer-unmap vbo-buffer-unmap.c)<br>
+piglit_add_executable (fdo50925 fdo50925.c)<br>
<br>
  # vim: ft=cmake:<br>
diff --git a/tests/bugs/fdo50925.c b/tests/bugs/fdo50925.c<br>
new file mode 100644<br>
index 0000000..3de9642<br>
--- /dev/null<br>
+++ b/tests/bugs/fdo50925.c<br>
@@ -0,0 +1,105 @@<br>
+/*<br>
+ * Copyright 2010 VMware, Inc.<br>
+ * Copyright (c) 2012 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>
+#include "piglit-util.h"<br>
+<br>
+PIGLIT_GL_TEST_MAIN(<br>
+    20 /*window_width*/,<br>
+    20 /*window_height*/,<br>
+    GLUT_RGB | GLUT_DOUBLE)<br>
+<br>
+GLboolean<br>
+fdo50925_reproduce()<br>
+{<br>
+   GLfloat verts[][2] = {<br>
+      {  0,  0 },<br>
+      {  0, 20 },<br>
+      { 20,  0 },<br>
+   };<br>
+   GLubyte indices[4] = {<br>
+      0,<br>
+      1,<br>
+      2,<br>
+      0xff<br>
+   };<br>
+   GLboolean pass = GL_TRUE;<br>
+   GLuint num_generated_primitives;<br>
+   GLuint generated_query;<br>
+<br>
+   glGenQueries(1,&generated_<u></u>query);<br>
+<br>
+   piglit_ortho_projection(<u></u>piglit_width, piglit_height, GL_FALSE);<br>
+<br>
+   glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+   glVertexPointer(2, GL_FLOAT, 0, (void *)verts);<br>
+<br>
+   glEnableClientState(GL_VERTEX_<u></u>ARRAY);<br>
+<br>
+   glBeginQuery(GL_PRIMITIVES_<u></u>GENERATED, generated_query);<br>
+<br>
+   assert(glGetError()==0);<br>
+<br>
+   glEnableClientState(GL_<u></u>PRIMITIVE_RESTART_NV);<br>
+   glPrimitiveRestartIndexNV(<u></u>0xff);<br>
+<br>
+   /* Draw */<br>
+   glDrawElements(GL_TRIANGLE_<u></u>STRIP, ARRAY_SIZE(indices),<br>
+                  GL_UNSIGNED_BYTE, indices);<br>
+<br>
+   glDisableClientState(GL_<u></u>PRIMITIVE_RESTART_NV);<br>
+   glDisableClientState(GL_<u></u>VERTEX_ARRAY);<br>
+<br>
+   glEndQuery(GL_PRIMITIVES_<u></u>GENERATED);<br>
+   glGetQueryObjectuiv(generated_<u></u>query, GL_QUERY_RESULT,<br>
+&num_generated_primitives);<br>
+   glDeleteQueries(1,&generated_<u></u>query);<br>
+<br>
+   assert(glGetError()==0);<br>
+<br>
+   if (num_generated_primitives != 1) {<br>
+      fprintf(stderr, "Transform Feedback: expected=1, got=%u\n",<br>
+              num_generated_primitives);<br>
+      pass = GL_FALSE;<br>
+   }<br>
+<br>
+   piglit_present_results();<br>
+<br>
+   return pass;<br>
+}<br>
+<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+   return fdo50925_reproduce() ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
+<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+   piglit_require_extension("GL_<u></u>NV_primitive_restart");<br>
+   piglit_require_gl_version(30);<br>
+}<br>
</blockquote>
<br></div></div>
The test looks OK.  But I seem to remember someone suggesting that we move away from tests being named after bug reports.  It's impossible to know what fdo12345.c tests by looking at the name.  It's probably better to rename this to something like tests/spec/ext_transform_<u></u>feedback/restart.c<br>

<br>
There's piglit helper functions so the test can be used with with GL 3.x or GL_EXT_transform_feedback.c<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br>Note: most of those helper functions aren't necessary anymore, since the piglit-dispatch mechanism takes care of calling the appropriate (EXT or non-EXT) function based on the implementation's extension string.  So all you should have to do to make the test work with EXT_transform_feedback is to replace the piglit_require_gl_version(30) call with piglit_require_transform_feedback().<br>
<br>I was meaning to remove all the unnecessary functions after I implemented piglit-dispatch mechanism, but I got sidetracked onto other things.  I'll try to remove them in the next week.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="HOEnZb"><font color="#888888">
<br>
-Brian</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/piglit</a><br>
</div></div></blockquote></div><br>