[Piglit] [PATCH] lineloop: add -dlist option for testing display lists

Dylan Baker baker.dylan.c at gmail.com
Fri Oct 16 14:56:03 PDT 2015


On Fri, Oct 16, 2015 at 2:27 PM, Brian Paul <brianp at vmware.com> wrote:

> ---
>  tests/all.py             |  3 ++-
>  tests/general/lineloop.c | 36 +++++++++++++++++++++++++++++++-----
>  2 files changed, 33 insertions(+), 6 deletions(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 95c5c61..4f03dd0 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -874,7 +874,8 @@ with profile.group_manager(
>      g(['infinite-spot-light'], run_concurrent=False)
>      g(['line-aa-width'], run_concurrent=False)
>      g(['line-flat-clip-color'])
> -    g(['lineloop'], run_concurrent=False)
> +    g(['lineloop'], 'lineloop', run_concurrent=False)
>


JFYI, if a name is not provided for a test then the arguments will be
joined with spaces, so the explicit name is redundant. But it really
doesn't matter to me if you prefer it.


> +    g(['lineloop', '-dlist'], 'lineloop-dlist', run_concurrent=False)
>      g(['linestipple'], run_concurrent=False)
>      g(['longprim'], run_concurrent=False)
>      g(['masked-clear'])
> diff --git a/tests/general/lineloop.c b/tests/general/lineloop.c
> index a612987..0111267 100644
> --- a/tests/general/lineloop.c
> +++ b/tests/general/lineloop.c
> @@ -43,16 +43,21 @@ PIGLIT_GL_TEST_CONFIG_END
>
>  static const char *TestName = "lineloop";
>  static int vert_count = 10000;
> +static bool use_dlist = false;
> +static GLuint dlist;
> +
>
>  static void
> -draw(GLuint numVerts)
> +draw(GLuint numVerts, float radius)
>  {
>     GLuint i;
>
>     glColor3f(1,0,1);
>     glBegin(GL_LINE_LOOP);
>     for (i = 0; i < numVerts; i++) {
> -      glVertex3f(sin(i*M_PI*2/numVerts), cos(i*M_PI*2/numVerts),0);
> +      float x = radius * sin(i*M_PI*2/numVerts);
> +      float y = radius * cos(i*M_PI*2/numVerts);
> +      glVertex3f(x, y, 0);
>     }
>     glEnd();
>  }
> @@ -62,8 +67,14 @@ test_prims(void)
>  {
>     if (!piglit_automatic)
>        printf("%s: %u vertices\n", TestName, vert_count);
> +
>     glClear(GL_COLOR_BUFFER_BIT);
> -   draw(vert_count);
> +
> +   if (use_dlist) {
> +      glCallList(dlist);
> +   } else {
> +      draw(vert_count, 1.0);
> +   }
>     piglit_present_results();
>  }
>
> @@ -87,13 +98,28 @@ piglit_init(int argc, char**argv)
>  {
>     int i;
>     for (i = 1; i < argc; ++i) {
> -      if (i + 1 < argc) {
> +      if (i < argc) {
>           if (strcmp(argv[i], "-count") == 0) {
> -            vert_count = strtoul(argv[++i], NULL, 0);
> +            i++;
> +            if (i == argc) {
> +               printf("please specify vertex count\n");
> +               piglit_report_result(PIGLIT_FAIL);
> +            }
> +            vert_count = strtoul(argv[i], NULL, 0);
> +         }
> +         else if (strcmp(argv[i], "-dlist") == 0) {
> +            use_dlist = true;
>           }
>        }
>     }
>
>     glViewport(0,0, WSIZE, WSIZE);
>     glOrtho(-1,1,-1,1,-1,1);
> +
> +   if (use_dlist) {
> +      dlist = glGenLists(1);
> +      glNewList(dlist, GL_COMPILE);
> +      draw(vert_count, 1.0);
> +      glEndList();
> +   }
>  }
> --
> 1.9.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20151016/8df90c06/attachment.html>


More information about the Piglit mailing list