[Piglit] [PATCH] bugs: reproduce bug 50925 (Primitive Restart + Tranform Feedback)
Jordan Justen
jordan.l.justen at intel.com
Thu Jun 28 10:04:27 PDT 2012
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
tests/all.tests | 1 +
tests/bugs/CMakeLists.gl.txt | 1 +
tests/bugs/fdo50925.c | 105 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 107 insertions(+)
create mode 100644 tests/bugs/fdo50925.c
diff --git a/tests/all.tests b/tests/all.tests
index 63937b9..b584375 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -623,6 +623,7 @@ add_plain_test(bugs, 'r300-readcache')
add_plain_test(bugs, 'tex1d-2dborder')
add_plain_test(bugs, 'tri-tex-crash')
add_plain_test(bugs, 'vbo-buffer-unmap')
+add_plain_test(bugs, 'fdo50925')
glx = Group()
add_plain_test(glx, 'glx-copy-sub-buffer')
diff --git a/tests/bugs/CMakeLists.gl.txt b/tests/bugs/CMakeLists.gl.txt
index 64c3093..d5e33e6 100644
--- a/tests/bugs/CMakeLists.gl.txt
+++ b/tests/bugs/CMakeLists.gl.txt
@@ -31,5 +31,6 @@ piglit_add_executable (fdo28551 fdo28551.c)
piglit_add_executable (fdo31934 fdo31934.c)
piglit_add_executable (tri-tex-crash tri-tex-crash.c)
piglit_add_executable (vbo-buffer-unmap vbo-buffer-unmap.c)
+piglit_add_executable (fdo50925 fdo50925.c)
# vim: ft=cmake:
diff --git a/tests/bugs/fdo50925.c b/tests/bugs/fdo50925.c
new file mode 100644
index 0000000..3de9642
--- /dev/null
+++ b/tests/bugs/fdo50925.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2010 VMware, Inc.
+ * Copyright (c) 2012 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"
+
+PIGLIT_GL_TEST_MAIN(
+ 20 /*window_width*/,
+ 20 /*window_height*/,
+ GLUT_RGB | GLUT_DOUBLE)
+
+GLboolean
+fdo50925_reproduce()
+{
+ GLfloat verts[][2] = {
+ { 0, 0 },
+ { 0, 20 },
+ { 20, 0 },
+ };
+ GLubyte indices[4] = {
+ 0,
+ 1,
+ 2,
+ 0xff
+ };
+ GLboolean pass = GL_TRUE;
+ GLuint num_generated_primitives;
+ GLuint generated_query;
+
+ glGenQueries(1, &generated_query);
+
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glVertexPointer(2, GL_FLOAT, 0, (void *)verts);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+
+ glBeginQuery(GL_PRIMITIVES_GENERATED, generated_query);
+
+ assert(glGetError()==0);
+
+ glEnableClientState(GL_PRIMITIVE_RESTART_NV);
+ glPrimitiveRestartIndexNV(0xff);
+
+ /* Draw */
+ glDrawElements(GL_TRIANGLE_STRIP, ARRAY_SIZE(indices),
+ GL_UNSIGNED_BYTE, indices);
+
+ glDisableClientState(GL_PRIMITIVE_RESTART_NV);
+ glDisableClientState(GL_VERTEX_ARRAY);
+
+ glEndQuery(GL_PRIMITIVES_GENERATED);
+ glGetQueryObjectuiv(generated_query, GL_QUERY_RESULT,
+ &num_generated_primitives);
+ glDeleteQueries(1, &generated_query);
+
+ assert(glGetError()==0);
+
+ if (num_generated_primitives != 1) {
+ fprintf(stderr, "Transform Feedback: expected=1, got=%u\n",
+ num_generated_primitives);
+ pass = GL_FALSE;
+ }
+
+ piglit_present_results();
+
+ return pass;
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+ return fdo50925_reproduce() ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_NV_primitive_restart");
+ piglit_require_gl_version(30);
+}
--
1.7.9.5
More information about the Piglit
mailing list