comparison src/video/SDL_renderer_sw.c @ 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 8a162bfdc838
children 9483df98e011
comparison
equal deleted inserted replaced
1928:861bc36f0ab3 1929:595ac54a8f9f
157 SW_RenderData *data; 157 SW_RenderData *data;
158 int i, n; 158 int i, n;
159 int bpp; 159 int bpp;
160 Uint32 Rmask, Gmask, Bmask, Amask; 160 Uint32 Rmask, Gmask, Bmask, Amask;
161 Uint32 renderer_flags; 161 Uint32 renderer_flags;
162 const char *desired_driver;
162 163
163 if (!SDL_PixelFormatEnumToMasks 164 if (!SDL_PixelFormatEnumToMasks
164 (displayMode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { 165 (displayMode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
165 SDL_SetError("Unknown display format"); 166 SDL_SetError("Unknown display format");
166 return NULL; 167 return NULL;
214 renderer_flags = (SDL_Renderer_SingleBuffer | 215 renderer_flags = (SDL_Renderer_SingleBuffer |
215 SDL_Renderer_PresentDiscard); 216 SDL_Renderer_PresentDiscard);
216 if (flags & SDL_Renderer_PresentVSync) { 217 if (flags & SDL_Renderer_PresentVSync) {
217 renderer_flags |= SDL_Renderer_PresentVSync; 218 renderer_flags |= SDL_Renderer_PresentVSync;
218 } 219 }
220 desired_driver = SDL_getenv("SDL_VIDEO_RENDERER_SWDRIVER");
219 for (i = 0; i < display->num_render_drivers; ++i) { 221 for (i = 0; i < display->num_render_drivers; ++i) {
220 SDL_RenderDriver *driver = &display->render_drivers[i]; 222 SDL_RenderDriver *driver = &display->render_drivers[i];
221 if (driver->info.name != SW_RenderDriver.info.name) { 223 if (driver->info.name == SW_RenderDriver.info.name) {
222 data->renderer = driver->CreateRenderer(window, renderer_flags); 224 continue;
223 if (data->renderer) { 225 }
224 break; 226 if (desired_driver
225 } 227 && SDL_strcasecmp(desired_driver, driver->info.name) != 0) {
228 continue;
229 }
230 data->renderer = driver->CreateRenderer(window, renderer_flags);
231 if (data->renderer) {
232 break;
226 } 233 }
227 } 234 }
228 if (i == display->num_render_drivers) { 235 if (i == display->num_render_drivers) {
229 SW_DestroyRenderer(renderer); 236 SW_DestroyRenderer(renderer);
230 SDL_SetError("Couldn't find display render driver"); 237 SDL_SetError("Couldn't find display render driver");