SDL2: Don't use SDL_Renderer if it is a software fallback, because that would only waste memory and speed.

git-svn-id: https://svn.eduke32.com/eduke32@4271 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-01-27 10:30:54 +00:00
parent 9f42ffc1ef
commit 0bf2ae9bab

View file

@ -1499,6 +1499,15 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
SDL_GetError()); SDL_GetError());
} }
else else
{
SDL_RendererInfo sdl_rendererinfo;
SDL_GetRendererInfo(sdl_renderer, &sdl_rendererinfo);
if (sdl_rendererinfo.flags & SDL_RENDERER_SOFTWARE) // this would be useless
{
SDL_DestroyRenderer(sdl_renderer);
sdl_renderer = NULL;
}
else
{ {
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING, x, y); SDL_TEXTUREACCESS_STREAMING, x, y);
@ -1510,6 +1519,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
sdl_renderer = NULL; sdl_renderer = NULL;
} }
} }
}
if (sdl_renderer && sdl_texture) if (sdl_renderer && sdl_texture)
{ {