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

@ -1500,15 +1500,25 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
} }
else else
{ {
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_RendererInfo sdl_rendererinfo;
SDL_TEXTUREACCESS_STREAMING, x, y); SDL_GetRendererInfo(sdl_renderer, &sdl_rendererinfo);
if (!sdl_texture) if (sdl_rendererinfo.flags & SDL_RENDERER_SOFTWARE) // this would be useless
{ {
initprintf("Falling back to SDL_GetWindowSurface: SDL_CreateTexture failed: %s\n",
SDL_GetError());
SDL_DestroyRenderer(sdl_renderer); SDL_DestroyRenderer(sdl_renderer);
sdl_renderer = NULL; sdl_renderer = NULL;
} }
else
{
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING, x, y);
if (!sdl_texture)
{
initprintf("Falling back to SDL_GetWindowSurface: SDL_CreateTexture failed: %s\n",
SDL_GetError());
SDL_DestroyRenderer(sdl_renderer);
sdl_renderer = NULL;
}
}
} }
if (sdl_renderer && sdl_texture) if (sdl_renderer && sdl_texture)