Fix T58250: crash starting Blender on X11 without OpenGL 3.3.

Instead display an error message and exit.
This commit is contained in:
Brecht Van Lommel
2019-01-03 16:43:09 +01:00
parent 407272d158
commit 3c411f5ba1
3 changed files with 12 additions and 7 deletions

View File

@@ -298,7 +298,7 @@ const bool GLXEW_ARB_create_context_robustness =
} }
else { else {
/* Don't create legacy context */ /* Don't create legacy context */
fprintf(stderr, "Warning! GLX_ARB_create_context not available.\n"); fprintf(stderr, "Error! GLX_ARB_create_context not available.\n");
} }
GHOST_TSuccess success; GHOST_TSuccess success;
@@ -328,10 +328,7 @@ const bool GLXEW_ARB_create_context_robustness =
version = glGetString(GL_VERSION); version = glGetString(GL_VERSION);
if (!version || version[0] < '3' || ((version[0] == '3') && (version[2] < '3'))) { if (!version || version[0] < '3' || ((version[0] == '3') && (version[2] < '3'))) {
fprintf(stderr, "Error! Blender requires OpenGL 3.3 to run. Try updating your drivers.\n"); success = GHOST_kFailure;
fflush(stderr);
/* ugly, but we get crashes unless a whole bunch of systems are patched. */
exit(0);
} }
else else
success = GHOST_kSuccess; success = GHOST_kSuccess;
@@ -341,6 +338,14 @@ const bool GLXEW_ARB_create_context_robustness =
success = GHOST_kFailure; success = GHOST_kFailure;
} }
if (success == GHOST_kFailure) {
fprintf(stderr, "Error! Unsupported graphics driver.\n");
fprintf(stderr, "Blender requires a graphics driver with at least OpenGL 3.3 support.\n");
fprintf(stderr, "The program will now close.\n");
fflush(stderr);
/* ugly, but we get crashes unless a whole bunch of systems are patched. */
exit(1);
}
GHOST_X11_ERROR_HANDLERS_RESTORE(handler_store); GHOST_X11_ERROR_HANDLERS_RESTORE(handler_store);

View File

@@ -361,7 +361,7 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
NULL, NULL,
"Blender requires a graphics driver with at least OpenGL 3.3 support.\n\n" "Blender requires a graphics driver with at least OpenGL 3.3 support.\n\n"
"The program will now close.", "The program will now close.",
"Blender - Unsupported Graphics Driver!", "Blender - Unsupported Graphics Driver",
MB_OK | MB_ICONERROR); MB_OK | MB_ICONERROR);
delete context; delete context;
exit(); exit();

View File

@@ -673,7 +673,7 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
m_hWnd, m_hWnd,
"Blender requires a graphics driver with at least OpenGL 3.3 support.\n\n" "Blender requires a graphics driver with at least OpenGL 3.3 support.\n\n"
"The program will now close.", "The program will now close.",
"Blender - Unsupported Graphics Driver!", "Blender - Unsupported Graphics Driver",
MB_OK | MB_ICONERROR); MB_OK | MB_ICONERROR);
delete context; delete context;
exit(0); exit(0);