From 8035c99b15f52ae1faad119f6bc85d7632d33d5e Mon Sep 17 00:00:00 2001 From: Wedge009 Date: Tue, 24 Sep 2019 16:14:37 +1000 Subject: [PATCH 1/2] Disable SDL default render batches behaviour. * Rendering in batches is default behaviour as of SDL 2.0.10 but causes rendering issues in Wesnoth. * Fixes #4237 * Fixes #4245 * Not sure if #4309 may benefit as well --- src/sdl/window.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sdl/window.cpp b/src/sdl/window.cpp index 5e5347e00e06..cd95e65ab96c 100644 --- a/src/sdl/window.cpp +++ b/src/sdl/window.cpp @@ -36,6 +36,10 @@ window::window(const std::string& title, throw exception("Failed to create a SDL_Window object.", true); } + // Rendering in batches (for efficiency) is enabled by default from SDL 2.0.10 + // The way Wesnoth uses SDL as of September 2019 does not work well with this rendering mode (eg story-only scenarios) + SDL_SetHint(SDL_HINT_RENDER_BATCHING, "0"); + if(!SDL_CreateRenderer(window_, -1, render_flags)) { throw exception("Failed to create a SDL_Renderer object.", true); } From f9ad6073ea443a7a622b924826f4cfe6c698dbab Mon Sep 17 00:00:00 2001 From: Wedge009 Date: Tue, 24 Sep 2019 16:59:16 +1000 Subject: [PATCH 2/2] Wrap the SDL render batch hint with SDL version conditional. --- src/sdl/window.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sdl/window.cpp b/src/sdl/window.cpp index cd95e65ab96c..60288d85f55a 100644 --- a/src/sdl/window.cpp +++ b/src/sdl/window.cpp @@ -36,9 +36,11 @@ window::window(const std::string& title, throw exception("Failed to create a SDL_Window object.", true); } +#if SDL_VERSION_ATLEAST(2, 0, 10) // Rendering in batches (for efficiency) is enabled by default from SDL 2.0.10 // The way Wesnoth uses SDL as of September 2019 does not work well with this rendering mode (eg story-only scenarios) SDL_SetHint(SDL_HINT_RENDER_BATCHING, "0"); +#endif if(!SDL_CreateRenderer(window_, -1, render_flags)) { throw exception("Failed to create a SDL_Renderer object.", true);