]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
GL: display a more useful error dialog if context creation fails
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 30 Oct 2023 11:25:11 +0000 (21:25 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Wed, 8 Nov 2023 17:26:20 +0000 (03:26 +1000)
There's no need to repeatedly retry if context creation fails, the
GPU and driver capabilities won't have changed.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
vid_sdl.c

index 710b430b4554b84a98e8289399c8186562499538..7f33a50f77062ab5a2f7e843f97f3594c57c906d 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -1751,11 +1751,7 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
 
        context = SDL_GL_CreateContext(window);
        if (context == NULL)
-       {
-               Con_Printf(CON_ERROR "Failed to initialize OpenGL context: %s\n", SDL_GetError());
-               VID_Shutdown();
-               return false;
-       }
+               Sys_Error("Failed to initialize OpenGL context: %s\n", SDL_GetError());
 
        GL_InitFunctions();
 
@@ -1770,11 +1766,7 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
                SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
                context = SDL_GL_CreateContext(window);
                if (context == NULL)
-               {
-                       Con_Printf(CON_ERROR "Failed to initialize OpenGL context: %s\n", SDL_GetError());
-                       VID_Shutdown();
-                       return false;
-               }
+                       Sys_Error("Failed to initialize OpenGL context: %s\n", SDL_GetError());
        }
 #endif