Merge lp:~widelands-dev/widelands/bug-1536377-fail-gracefully-on-graphics-driver-problems into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8875
Proposed branch: lp:~widelands-dev/widelands/bug-1536377-fail-gracefully-on-graphics-driver-problems
Merge into: lp:widelands
Diff against target: 43 lines (+25/-2)
1 file modified
src/graphic/gl/initialize.cc (+25/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1536377-fail-gracefully-on-graphics-driver-problems
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+355757@code.launchpad.net

Commit message

Show a basic SDL error message box to the user if the shading language can't be detected or is too old.

Description of the change

Some UI feedback for the user if we can't work with what the graphics driver is giving us.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4055. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/434035449.
Appveyor build 3851. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1536377_fail_gracefully_on_graphics_driver_problems-3851.

Revision history for this message
Notabilis (notabilis27) wrote :

Diff is looking good. I added a few smaller remarks as comments, though.
Testing by modifying the conditions displayed the message boxes for me.

8859. By GunChleoc

Addressed code review

8860. By GunChleoc

Merged trunk.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks for the review - comments implemented :)

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4104. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/439245252.
Appveyor build 3899. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1536377_fail_gracefully_on_graphics_driver_problems-3899.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/graphic/gl/initialize.cc'
2--- src/graphic/gl/initialize.cc 2018-09-10 06:11:01 +0000
3+++ src/graphic/gl/initialize.cc 2018-10-09 16:40:23 +0000
4@@ -20,6 +20,7 @@
5 #include "graphic/gl/initialize.h"
6
7 #include <csignal>
8+#include <cstdlib>
9
10 #include <SDL.h>
11
12@@ -177,8 +178,30 @@
13 glGetIntegerv(GL_MAX_TEXTURE_SIZE, max_texture_size);
14 log("Graphics: OpenGL: Max texture size: %u\n", *max_texture_size);
15
16- log("Graphics: OpenGL: ShadingLanguage: \"%s\"\n",
17- reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
18+ // TODO(GunChleoc): Localize the on-screen error messages
19+ // Exit if we can't detect the shading language version
20+ const char* const shading_language_version_string = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
21+ if (strcmp(shading_language_version_string, "(null)") == 0) {
22+ log("ERROR: Unable to detect the shading language version!\n");
23+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
24+ "OpenGL Error",
25+ "Widelands won’t work because we were unable to detect the shading language version -- there is an unknown problem with reading the information from the graphics driver.",
26+ NULL);
27+ exit(1);
28+ }
29+
30+ log("Graphics: OpenGL: ShadingLanguage: \"%s\"\n", shading_language_version_string);
31+
32+ // Exit if the shading language version is too old
33+ const double shading_language_version = atof(shading_language_version_string);
34+ if (shading_language_version < 1.20) {
35+ log("ERROR: Shading language version is too old!\n");
36+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
37+ "OpenGL Error",
38+ "Widelands won’t work because your graphics driver is too old -- version 1.20 or newer is required.",
39+ NULL);
40+ exit(1);
41+ }
42
43 glDrawBuffer(GL_BACK);
44

Subscribers

People subscribed via source and target branches

to status/vote changes: