diff test/testgl.c @ 3571:19691cebb866

Default to allow either accelerated or not
author Sam Lantinga <slouken@libsdl.org>
date Tue, 15 Dec 2009 20:53:09 +0000
parents 7812d3e9564e
children f8816ffa210b
line wrap: on
line diff
--- a/test/testgl.c	Tue Dec 15 20:36:31 2009 +0000
+++ b/test/testgl.c	Tue Dec 15 20:53:09 2009 +0000
@@ -370,7 +370,7 @@
 int
 RunGLTest(int argc, char *argv[],
           int logo, int logocursor, int slowly, int bpp, float gamma,
-          int noframe, int fsaa, int sync, int noaccel)
+          int noframe, int fsaa, int sync, int accel)
 {
     int i;
     int rgb_size[3];
@@ -454,7 +454,9 @@
         SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
         SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa);
     }
-    SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, !noaccel);
+    if (accel >= 0) {
+        SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, accel);
+    }
     if (SDL_SetVideoMode(w, h, bpp, video_flags) == NULL) {
         fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
         SDL_Quit();
@@ -491,8 +493,11 @@
         printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
                value);
     }
-    SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
-    printf("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", !noaccel, value);
+    if (accel >= 0) {
+        SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
+        printf("SDL_GL_ACCELERATED_VISUAL: requested %d, got %d\n", accel,
+               value);
+    }
     if (sync) {
         printf("Buffer swap interval: requested 1, got %d\n",
                SDL_GL_GetSwapInterval());
@@ -703,7 +708,7 @@
     float gamma = 0.0;
     int noframe = 0;
     int fsaa = 0;
-    int noaccel = 0;
+    int accel = -1;
     int sync = 0;
 
     logo = 0;
@@ -734,22 +739,22 @@
         if (strcmp(argv[i], "-fsaa") == 0) {
             ++fsaa;
         }
-        if (strcmp(argv[i], "-noaccel") == 0) {
-            ++noaccel;
+        if (strcmp(argv[i], "-accel") == 0) {
+            accel = atoi(argv[++i]);
         }
         if (strcmp(argv[i], "-sync") == 0) {
             ++sync;
         }
         if (strncmp(argv[i], "-h", 2) == 0) {
             printf
-                ("Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-noaccel] [-sync] [-fullscreen]\n",
+                ("Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-accel n] [-sync] [-fullscreen]\n",
                  argv[0]);
             exit(0);
         }
     }
     for (i = 0; i < numtests; ++i) {
         RunGLTest(argc, argv, logo, logocursor, slowly, bpp, gamma,
-                  noframe, fsaa, sync, noaccel);
+                  noframe, fsaa, sync, accel);
     }
     return 0;
 }