[Piglit] [PATCH] bugs: reproduce bug 50925 (Primitive Restart + Tranform Feedback)

Paul Berry stereotype441 at gmail.com
Thu Jun 28 17:11:59 PDT 2012


On 28 June 2012 14:28, Brian Paul <brianp at vmware.com> wrote:

> On 06/28/2012 11:04 AM, Jordan Justen wrote:
>
>> Signed-off-by: Jordan Justen<jordan.l.justen at intel.**com<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);
>> +}
>>
>
> 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_**
> feedback/restart.c
>
> There's piglit helper functions so the test can be used with with GL 3.x
> or GL_EXT_transform_feedback.c
>

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().

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.


>
> -Brian
>
>
> ______________________________**_________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/**mailman/listinfo/piglit<http://lists.freedesktop.org/mailman/listinfo/piglit>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120628/0489392f/attachment-0001.html>


More information about the Piglit mailing list