Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLES2: Check for GPU capabilities to display an error #5909

Merged
merged 2 commits into from
Jul 26, 2016

Conversation

akien-mga
Copy link
Member

The engine will still segfault, but the error message should be displayed by the
OS in a blocking manner, so that it will only crash once users have acknowledged
the error dialog.

Please test, especially if you have hardware that does not support GL 2.1 / GLES 2.0. I only tested on Linux X11, and by tweaking the if to make it fail when GL 2.1 was actually supported. @SuperUserNameMan's test in #1162 (comment) seems to indicate that it would be working on Windows for his hardware.

Closes #1162.

The engine will still segfault, but the error message should be displayed by the
OS in a blocking manner, so that it will only crash once users have acknowledged
the error dialog.

Closes godotengine#1162.
@akien-mga
Copy link
Member Author

I pushed a test build of this commit on our CI-based deployment system: https://github.com/GodotBuilder/godot-builds/releases/tag/test_20160725
There should be binaries to test for all platforms in a couple of hours.

@SuperUserNameMan
Copy link
Contributor

SuperUserNameMan commented Jul 25, 2016

to test under linux without changing the code and recompiling, i think you can set the environment variable MESA_GL_VERSION_OVERRIDE to 2.0 : http://www.mesa3d.org/envvars.html

IIRC, that's also how to proceeded to force MESA to allow black listed GPU to work with Godot.

@akien-mga
Copy link
Member Author

to test under linux without changing the code and recompiling, i think you can set the environment variable MESA_GL_VERSION_OVERRIDE to 2.0

Nice trick, that works for me :)

@akien-mga
Copy link
Member Author

Note that only desktop platforms use GLEW, so this error should not show on Android and iOS devices.

@SuperUserNameMan
Copy link
Contributor

SuperUserNameMan commented Jul 26, 2016

So I tested on my Acer eMachine Netbook with Intel Atom N450 and integrated Intel GMA 3150 :

under LinuxMint18, MATE, 32bits (MESA Opengl 1.4) :

  • the warning dialog box is displayed correctly.
  • through the console, it complains that it could not load libXrandr.so.
  • If I override opengl version to 2.1 or 3.0 using the env var, Godot runs despite the missing libXrandr, But the 3D viewport is all messed up.
  • also, as side note, 1024x768 is too small to display Godot interface correctly. The project manager interface is not displayed correctly unless you expand the window, and into the editor I can't even access the "Quit" menu item.

same netbook, under Windows 10, 32bits (Opengl 1.4 default Microsoft Opengl 1.1 ) :

  • it crashed without displaying the dialog box.
  • however into the console, the ERROR: RasterizerGLES2::init: message is written.

I also tested on my regular laptop with radeon R4 and Windows 8.1 and it worked correctly.

@SuperUserNameMan
Copy link
Contributor

Okay, i've found why the dialog box was not displayed into Windows 10 before crashing.

Into godot/platform/windows/os_windows.cpp, at line 1346, into OS_Windows::alert(), MessageBoxW() requires MB_TASKMODAL as extra flag :

        MessageBoxW(NULL,p_alert.c_str(),p_title.c_str(),MB_OK|MB_ICONEXCLAMATION|MB_TASKMODAL);

@akien-mga
Copy link
Member Author

Nice catch @SuperUserNameMan. Here's the corresponding API reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx

Does the message box then appear in the foreground, or in the background? I see that there is a MB_SETFOREGROUND flag we could use too.

@SuperUserNameMan
Copy link
Contributor

It appears on foreground.
The Godot ongoing process is paused till OKAY is pressed. Then it crashes and display system dialog box "Godot Engine Editor (rc1) has stopped to work" .
I don't think more MB_ flags are required.

This flag pauses the current running thread, allowing for the user to see the
alert and acknowledge it before the thread continues (and e.g. crashes :)).

Thanks to @SuperUserNameMan for finding it.
Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx
@akien-mga
Copy link
Member Author

Pushed a new commit adding this flag, thanks again :)

@reduz reduz merged commit 548a69a into godotengine:master Jul 26, 2016
@akien-mga akien-mga deleted the pr-gles2-error-before-crash branch July 26, 2016 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants