Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added an environment variable to select which driver the software ren…

…derer will use.
  • Loading branch information
slouken committed Jul 23, 2006
1 parent 3f3ee25 commit b649894a98a44b941dc399b197e3de9905e61580
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/video/SDL_renderer_sw.c
@@ -159,6 +159,7 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
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 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
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) {

0 comments on commit b649894

Please sign in to comment.