Test single/double buffering.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Dec 2011 12:04:54 +0000 (12:04 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Dec 2011 12:04:54 +0000 (12:04 +0000)
apps/CMakeLists.txt
apps/gl/CMakeLists.txt
apps/gl/default.ref.json
apps/gl/default_db.ref.json [new file with mode: 0644]
apps/gl/default_db.ref.txt [new file with mode: 0644]
apps/gl/default_sb.ref.json [new file with mode: 0644]
apps/gl/default_sb.ref.txt [new file with mode: 0644]
apps/gl/tri.c

index c1a1762114a7750aa4cf51e6113ed4ac7c1ba09d..4d425f649e224ff6710ca712f61a077829a92a09 100644 (file)
@@ -17,6 +17,7 @@ function (ADD_APP_TEST)
             --build ${APITRACE_BINARY_DIR}
             --api ${api}
             --ref-dump ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_REF}
+            --
             "$<TARGET_FILE:${TEST_TARGET}>"
             ${TEST_ARGS}
     )
index e5a78b5c672c1102913c5c1b73be586d05e50831..d78fce2f67d96d5fb142de13e3d8b560912d02e9 100644 (file)
@@ -19,6 +19,20 @@ add_app_test (
     REF default.ref.txt
 )
 
+add_app_test (
+    NAME "gl_default_sb"
+    TARGET ${api}_tri
+    REF default_sb.ref.txt
+    ARGS -sb
+)
+
+add_app_test (
+    NAME "gl_default_db"
+    TARGET ${api}_tri
+    REF default_db.ref.txt
+    ARGS -db
+)
+
 set (targets
     tri
     gremedy
index 995d724bb73a210f1a8528741af65d8412e11d07..df155f52c6bdd18ce131656fb26644b2d4eb4867 100644 (file)
@@ -79,8 +79,7 @@
     "GL_INDEX_LOGIC_OP": false,
     "GL_COLOR_LOGIC_OP": false,
     // Some implementations return more GL_AUX_BUFFERS than requested
-    "GL_DRAW_BUFFER": "GL_BACK",
-    "GL_READ_BUFFER": "GL_BACK",
+    // GL_DRAW_BUFFER and GL_READ_BUFFER vary with visual
     // GL_SCISSOR_BOX depends on the drawable
     "GL_SCISSOR_TEST": false,
     "GL_INDEX_CLEAR_VALUE": 0,
@@ -89,7 +88,7 @@
     "GL_COLOR_WRITEMASK": [true, true, true, true],
     "GL_INDEX_MODE": false,
     "GL_RGBA_MODE": true,
-    "GL_DOUBLEBUFFER": true,
+    // GL_DOUBLEBUFFER varies with visual
     "GL_STEREO": false,
     "GL_RENDER_MODE": "GL_RENDER",
     "GL_PERSPECTIVE_CORRECTION_HINT": "GL_DONT_CARE",
     "GL_STENCIL_BACK_FAIL": "GL_KEEP",
     "GL_STENCIL_BACK_PASS_DEPTH_FAIL": "GL_KEEP",
     "GL_STENCIL_BACK_PASS_DEPTH_PASS": "GL_KEEP",
-    "GL_DRAW_BUFFER0": "GL_BACK",
+    // GL_DRAW_BUFFER0 varies with visual
     "GL_DRAW_BUFFER1": "GL_ZERO",
     "GL_DRAW_BUFFER2": "GL_ZERO",
     "GL_DRAW_BUFFER3": "GL_ZERO",
diff --git a/apps/gl/default_db.ref.json b/apps/gl/default_db.ref.json
new file mode 100644 (file)
index 0000000..bde1c36
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "parameters": {
+    "GL_DRAW_BUFFER": "GL_BACK",
+    "GL_DRAW_BUFFER0": "GL_BACK",
+    "GL_READ_BUFFER": "GL_BACK",
+    "GL_DOUBLEBUFFER": true
+  }
+}
diff --git a/apps/gl/default_db.ref.txt b/apps/gl/default_db.ref.txt
new file mode 100644 (file)
index 0000000..17281f8
--- /dev/null
@@ -0,0 +1 @@
+#state default_db.ref.json
diff --git a/apps/gl/default_sb.ref.json b/apps/gl/default_sb.ref.json
new file mode 100644 (file)
index 0000000..381ccbc
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "parameters": {
+    "GL_DRAW_BUFFER": "GL_FRONT",
+    "GL_DRAW_BUFFER0": "GL_FRONT",
+    "GL_READ_BUFFER": "GL_FRONT",
+    "GL_DOUBLEBUFFER": false
+  }
+}
diff --git a/apps/gl/default_sb.ref.txt b/apps/gl/default_sb.ref.txt
new file mode 100644 (file)
index 0000000..48c6224
--- /dev/null
@@ -0,0 +1 @@
+#state default_sb.ref.json
index c6c1849607b3ac6367541a58f5e414838335602f..baff0246c2254e07ae90898ef54a5c488b9c46a9 100644 (file)
 static GLboolean doubleBuffer = GL_TRUE;
 static int win;
 
+static void parseArgs(int argc, char** argv)
+{
+   int i;
+
+   for (i = 1; i < argc; ++i) {
+      const char *arg = argv[i];
+      if (strcmp(arg, "-sb") == 0) {
+         doubleBuffer = GL_FALSE;
+      } else if (strcmp(arg, "-db") == 0) {
+         doubleBuffer = GL_TRUE;
+      } else {
+         fprintf(stderr, "error: unknown arg %s\n", arg);
+         exit(1);
+      }
+   }
+}
+
 static void Init(void)
 {
    glClearColor(0.3, 0.1, 0.3, 1.0);
@@ -85,6 +102,8 @@ int main(int argc, char **argv)
 {
    GLenum type;
 
+   parseArgs(argc, argv);
+
    glutInit(&argc, argv);
 
    glutInitWindowSize(250, 250);