shithub: choc

Download patch

ref: e55356d93a1408ca9db9a8cc57ec243f9fc8f99a
parent: 5b967edaf6e407b03455631734ee2e33e88304c8
author: Fabian Greffrath <[email protected]>
date: Tue Apr 6 08:38:12 EDT 2021

textscreen: try to create a VSync enabled renderer first (#1365)

Fall back to creating a software renderer only if that fails.

@vanfanel

--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -253,7 +253,13 @@
     if (TXT_SDLWindow == NULL)
         return 0;
 
-    renderer = SDL_CreateRenderer(TXT_SDLWindow, -1, SDL_RENDERER_SOFTWARE);
+    renderer = SDL_CreateRenderer(TXT_SDLWindow, -1, SDL_RENDERER_PRESENTVSYNC);
+
+    if (renderer == NULL)
+        renderer = SDL_CreateRenderer(TXT_SDLWindow, -1, SDL_RENDERER_SOFTWARE);
+
+    if (renderer == NULL)
+        return 0;
 
     // Special handling for OS X retina display. If we successfully set the
     // highdpi flag, check the output size for the screen renderer. If we get