Open kubaau opened 3 months ago
Changing glXSwapIntervalSGI
to glXSwapIntervalMESA
does not crash in WSL but does not achieve the desired effect (or does it?). It seems to act as if no frame limit was set.
WSL is some "difficult" terrain here, it might be that the wsl GL driver reports things as working but they arent. disabling vsync all together might work
(e.g see https://stackoverflow.com/questions/26437078/sfml-vsync-always-on)
So on WSL we use glXSwapIntervalSGI
.
glXSwapIntervalMESA works. The pointer returned for glXSwapIntervalSGI is valid, so SFML can't detect this issue without taking an approach similiar to SDL's.
glXSwapIntervalMESA does not crash in WSL but does not achieve the desired effect
Those seem to contradict. I'm also wondering what it is that SDL does. But doesn't look like we can/should do anything due to "SFML [and hence we] can't detect this issue "
Why running in WSL anyway when there are native builds for Windows? I'd say the use case is rare enough for us to ignore or refer to the workaround.
If we can detect WSL (likely only at runtime) we could not set wglSwapIntervalEXT
to not use hardware VSync though
TLDR workaround: Manually change
~/.s25rttr/CONFIG.INI
section[video]
parameterframerate=0
to something other than zero.Using the Windows Subsystem for Linux and running the game segfaults immediately with a cryptic error:
Running under debugger shows this stack trace:
The segfault happens because some bad context is passed to
SDL_GL_DeleteContext(context);
, but what actually causes this segfault is this function:If you manually set framerate != 0 in CONFIG.INI then the game launches fine, but changing the "Limit Framerate" setting in game to "Dynamic" also immediately segfaults in the same location, although now the offending function that results in a bad context is:
In any case, it seems that setting the framerate limit to match hardware refresh rate is not supported in WSL.
I think either:
bool VideoDriverWrapper::setHwVSync(bool enabled)
must immediately return false and never callwglSwapIntervalEXT (ext glXSwapIntervalSGI)
if running under WSLwglSwapIntervalEXT
must somehow be made not to fail under WSLSince the second option can be quite complicated and the third option may not be feasible, probably the workaround can suffice, but I'm still reporting this for interested parties. Maybe it is also possible to modify some WSL configuration to fix this, but I have no idea.