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

Brian Paul brianp at vmware.com
Fri Oct 16 14:27:57 PDT 2015


---
 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)
+    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



More information about the Piglit mailing list