Whoops. I forgot to add the shader. I'll send another version.
-Jordan On Mon, Jul 2, 2012 at 1:19 PM, Jordan Justen <[email protected]> wrote: > Signed-off-by: Jordan Justen <[email protected]> > --- > tests/all.tests | 1 + > .../spec/ext_transform_feedback/CMakeLists.gl.txt | 1 + > .../ext_transform_feedback/primitive-restart.c | 115 > ++++++++++++++++++++ > 3 files changed, 117 insertions(+) > create mode 100644 tests/spec/ext_transform_feedback/primitive-restart.c > > diff --git a/tests/all.tests b/tests/all.tests > index 63937b9..6e9b92e 100644 > --- a/tests/all.tests > +++ b/tests/all.tests > @@ -1762,6 +1762,7 @@ for mode in ['discard', 'buffer', 'prims_generated', > 'prims_written']: > test_name = 'generatemipmap {0}'.format(mode) > ext_transform_feedback[test_name] = concurrent_test( > 'ext_transform_feedback-{0}'.format(test_name)) > +ext_transform_feedback['primitive-restart'] = > concurrent_test('ext_transform_feedback-primitive-restart') > > arb_transform_feedback2 = Group() > spec['ARB_transform_feedback2'] = arb_transform_feedback2 > diff --git a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt > b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt > index b8c2693..a24fa5a 100644 > --- a/tests/spec/ext_transform_feedback/CMakeLists.gl.txt > +++ b/tests/spec/ext_transform_feedback/CMakeLists.gl.txt > @@ -32,5 +32,6 @@ piglit_add_executable (ext_transform_feedback-output-type > output-type.c) > piglit_add_executable (ext_transform_feedback-order order.c) > piglit_add_executable (ext_transform_feedback-overflow-edge-cases > overflow-edge-cases.c) > piglit_add_executable (ext_transform_feedback-tessellation tessellation.c) > +piglit_add_executable (ext_transform_feedback-primitive-restart > primitive-restart.c) > > # vim: ft=cmake: > diff --git a/tests/spec/ext_transform_feedback/primitive-restart.c > b/tests/spec/ext_transform_feedback/primitive-restart.c > new file mode 100644 > index 0000000..ac98b36 > --- /dev/null > +++ b/tests/spec/ext_transform_feedback/primitive-restart.c > @@ -0,0 +1,115 @@ > +/* > + * 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. > + */ > + > +/** > + * \file primitive-restart.c > + * > + * Tests for a bug in the i965 driver where transform feedback would > + * return an invalid value when primitive restart was used. > + */ > + > +#include "piglit-util.h" > + > +PIGLIT_GL_TEST_MAIN( > + 20 /*window_width*/, > + 20 /*window_height*/, > + GLUT_RGB | GLUT_DOUBLE) > + > + > +enum piglit_result > +piglit_display(void) > +{ > + GLfloat (*verts)[2]; > + GLubyte indices[4] = { > + 0, > + 1, > + 2, > + 0xff > + }; > + enum piglit_result result = PIGLIT_PASS; > + GLuint num_generated_primitives; > + GLuint generated_query; > + > + verts = (GLfloat(*)[2]) calloc(sizeof(verts[0]), 0x100); > + verts[1][1] = (GLfloat) 20.0f; > + verts[2][0] = (GLfloat) 20.0f; > + verts[0xff][0] = (GLfloat) 20.0f; > + verts[0xff][1] = (GLfloat) 20.0f; > + > + 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); > + > + if (piglit_check_gl_error(GL_NO_ERROR)) { > + result = PIGLIT_FAIL; > + } > + > + piglit_EnablePrimitiveRestart(0xff); > + > + /* Draw */ > + glDrawElements(GL_TRIANGLE_STRIP, ARRAY_SIZE(indices), > + GL_UNSIGNED_BYTE, indices); > + > + piglit_DisablePrimitiveRestart(); > + > + glDisableClientState(GL_VERTEX_ARRAY); > + > + > + free(verts); > + > + glEndQuery(GL_PRIMITIVES_GENERATED); > + glGetQueryObjectuiv(generated_query, GL_QUERY_RESULT, > + &num_generated_primitives); > + glDeleteQueries(1, &generated_query); > + > + if (piglit_check_gl_error(GL_NO_ERROR)) { > + result = PIGLIT_FAIL; > + } > + > + if (num_generated_primitives != 1) { > + fprintf(stderr, "GL_PRIMITIVES_GENERATED: expected=1, got=%u\n", > + num_generated_primitives); > + result = PIGLIT_FAIL; > + } > + > + piglit_present_results(); > + > + return result; > +} > + > + > +void > +piglit_init(int argc, char **argv) > +{ > + piglit_require_primitive_restart(); > + piglit_require_transform_feedback(); > +} > -- > 1.7.9.5 > > _______________________________________________ > Piglit mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/piglit _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
