shithub: choc

Download patch

ref: d3466465397e8778ec1fdf44f5691cd713db5211
parent: f0e330bdfe123fa9d802340c9823a8dc1eafac4c
parent: fe9a6a864d1a3f34ae7dbecf803fb6803c7d8ae7
author: Mike Swanson <mikeonthecomputer@gmail.com>
date: Thu Dec 5 22:59:58 EST 2019

Merge pull request #1221 from chocolate-doom/render_retry

video: if renderer creation failed, try again without acceleration

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1246,6 +1246,23 @@
 
     renderer = SDL_CreateRenderer(screen, -1, renderer_flags);
 
+    // If we could not find a matching render driver,
+    // try again without hardware acceleration.
+
+    if (renderer == NULL && !force_software_renderer)
+    {
+        renderer_flags |= SDL_RENDERER_SOFTWARE;
+        renderer_flags &= ~SDL_RENDERER_PRESENTVSYNC;
+
+        renderer = SDL_CreateRenderer(screen, -1, renderer_flags);
+
+        // If this helped, save the setting for later.
+        if (renderer != NULL)
+        {
+            force_software_renderer = 1;
+        }
+    }
+
     if (renderer == NULL)
     {
         I_Error("Error creating renderer for screen window: %s",