Update SDL render hints, resolves #8038.

* Request Direct3D v11 instead of default Direct3D v9 on Windows builds (#8038).
* No longer need to disable batched renders with rendering overhaul in done in 1.17.4 to 1.17.7.
This commit is contained in:
Wedge009 2023-11-13 12:03:56 +11:00 committed by Pentarctagon
parent 3f0d653718
commit 5fc945ebcd

View file

@ -40,11 +40,17 @@ window::window(const std::string& title,
throw exception("Failed to create a SDL_Window object.", true);
}
if(sdl::runtime_at_least(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");
}
#ifdef _WIN32
// SDL uses Direct3D v9 by default on Windows systems. However, returning
// from the Windows lock screen causes issues with rendering. Resolution
// is either to rebuild render textures on the SDL_RENDER_TARGETS_RESET
// event or use an alternative renderer that does not have this issue.
// Suitable options are Direct3D v11+ or OpenGL.
// See https://github.com/wesnoth/wesnoth/issues/8038 for details.
// Note that SDL_HINT_RENDER_DRIVER implies SDL_HINT_RENDER_BATCHING is
// disabled, according to https://discourse.libsdl.org/t/a-couple-of-questions-regarding-batching-in-sdl-2-0-10/26453/2.
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "direct3d11");
#endif
if(!SDL_CreateRenderer(window_, -1, render_flags)) {
throw exception("Failed to create a SDL_Renderer object.", true);