mirror of
https://github.com/joel16/SDL2.git
synced 2024-12-04 17:44:35 +00:00
Added an environment variable to select which driver the software renderer will use.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401974
This commit is contained in:
parent
1d8a5a2349
commit
74b85ef7fe
@ -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,15 +217,21 @@ 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) {
|
||||
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) {
|
||||
SW_DestroyRenderer(renderer);
|
||||
SDL_SetError("Couldn't find display render driver");
|
||||
|
Loading…
Reference in New Issue
Block a user