changeset 1929:595ac54a8f9f

Added an environment variable to select which driver the software renderer will use.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 23 Jul 2006 00:48:12 +0000
parents 861bc36f0ab3
children 9483df98e011
files src/video/SDL_renderer_sw.c
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_renderer_sw.c	Sun Jul 23 00:19:12 2006 +0000
+++ b/src/video/SDL_renderer_sw.c	Sun Jul 23 00:48:12 2006 +0000
@@ -159,6 +159,7 @@
     int bpp;
     Uint32 Rmask, Gmask, Bmask, Amask;
     Uint32 renderer_flags;
+    const char *desired_driver;
 
     if (!SDL_PixelFormatEnumToMasks
         (displayMode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
@@ -216,13 +217,19 @@
     if (flags & SDL_Renderer_PresentVSync) {
         renderer_flags |= SDL_Renderer_PresentVSync;
     }
+    desired_driver = SDL_getenv("SDL_VIDEO_RENDERER_SWDRIVER");
     for (i = 0; i < display->num_render_drivers; ++i) {
         SDL_RenderDriver *driver = &display->render_drivers[i];
-        if (driver->info.name != SW_RenderDriver.info.name) {
-            data->renderer = driver->CreateRenderer(window, renderer_flags);
-            if (data->renderer) {
-                break;
-            }
+        if (driver->info.name == SW_RenderDriver.info.name) {
+            continue;
+        }
+        if (desired_driver
+            && SDL_strcasecmp(desired_driver, driver->info.name) != 0) {
+            continue;
+        }
+        data->renderer = driver->CreateRenderer(window, renderer_flags);
+        if (data->renderer) {
+            break;
         }
     }
     if (i == display->num_render_drivers) {