-
Notifications
You must be signed in to change notification settings - Fork 420
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
Crashing on multithreaded OpenGL when tabbing out and in #5795
Comments
Testing on Windows 10 with i3-3217U HD 4000. DirectX is working now but let's stick to OGL both legacy and non legacy first. The crash is significantly harder to repro, although it still occurs from time to time. To force it to happen, spam alt tab (with full release after each) for a while. Sometimes it crashes right away, other times it will crash after 5-6 seconds of spamming. Inconsistency suggests a multithreading issue. Also, when alt tabbing slowly, there's a significant lag and delay too. DirectX does not have this bug. You can spam alt tab to your heart's content. Alt tabbing is also significantly smoother. Great work team. |
It sounds like the Intel driver's recycled the window's framebuffer. We likely shouldn't be drawing when the window's minimised. |
To confirm the above, does it behave differently if minimising is disabled: diff --git a/osu.Framework/Platform/SDL2Window.cs b/osu.Framework/Platform/SDL2Window.cs
index 2d8ca2068..d4bbaa6f9 100644
--- a/osu.Framework/Platform/SDL2Window.cs
+++ b/osu.Framework/Platform/SDL2Window.cs
@@ -228,6 +228,7 @@ public virtual void Create()
SDL.SDL_SetHint(SDL.SDL_HINT_IME_SHOW_UI, "1");
SDL.SDL_SetHint(SDL.SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, "0");
SDL.SDL_SetHint(SDL.SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
+ SDL.SDL_SetHint(SDL.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
// we want text input to only be active when SDL2DesktopWindowTextInput is active.
// SDL activates it by default on some platforms: https://github.com/libsdl-org/SDL/blob/release-2.0.16/src/video/SDL_video.c#L573-L582 |
disable minimize seems to partly mitigate the problem. Window no longer crashes when alt tabbing in OGL. I'm still seeing the same crash/exception popping up when going through some test though, I'll investigate a bit more. |
Tested on latest Windows 8.1, i3-3217U, HD graphics 4000, Legacy and non-legacy OpenGL renderer on fullscreen and multithreaded.
When alt tab out, then alt tab back into visual test, the window will crash with the following exception and call stack (on draw thread):
Exception is thrown on the GL.Clear() call inside ClearImplementation().
On the same OS environment and hardware, this only happen with fullscreen enabled and multithreaded. DirectX11 does not work (for some reason) on Windows 8.1 on this hardware at least, so not sure if this happens on other renderers.
On both OGL and multithreaded, alt tab back in will crash the app. On new OGL and single thread, the app still run, keyboard and inputs are still handled as usual and we can still hear the sounds BUT it does not draw anything on the screen. On legacy OGL and single thread, this bug does NOT happen. This probably is worth another issue though.
Also tried repro on a newer i3-7020U with HD graphics 620 and Windows 10, but here all renderers does not have this bug.
Will try to install on Windows 10 + HD4k and Windows 8.1 + HD620 to see whether it's OS-dependent or GPU-dependent.
The text was updated successfully, but these errors were encountered: