SDL: Prefer OpenGL over Metal rendering on macOS

SDL 2.0.10 and above favors Metal over OpenGL rendering on macOS, but
this currently causes blurriness issues on Retina displays.

Going back to OpenGL rendering works around this bug for now.

Users can override this with the SDL_RENDER_DRIVER environment variable.

c59bf95ba8 and 70f79d3df8 are still a requirement to
work around this bug, too.

Bug #11430.
This commit is contained in:
Donovan Watteau 2020-10-04 21:14:40 +02:00 committed by Thierry Crozat
parent 5f7842db57
commit cbaa9cfd92

View file

@ -2633,6 +2633,14 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height,
return nullptr; return nullptr;
} }
#if defined(MACOSX) && SDL_VERSION_ATLEAST(2, 0, 10)
// WORKAROUND: Bug #11430: "macOS: blurry content on Retina displays"
// Since SDL 2.0.10, Metal takes priority over OpenGL rendering on macOS,
// but this causes blurriness issues on Retina displays. Just switch
// back to OpenGL for now.
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
#endif
_renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, 0); _renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, 0);
if (!_renderer) { if (!_renderer) {
deinitializeRenderer(); deinitializeRenderer();