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

Running incompatible games on wayland natively #8909

Closed
coronavirus6045 opened this issue Jan 23, 2024 · 5 comments
Closed

Running incompatible games on wayland natively #8909

coronavirus6045 opened this issue Jan 23, 2024 · 5 comments

Comments

@coronavirus6045
Copy link

There are some applications/games that are only designed for X11 that crash when switching video driver to wayland, notably vulkan games that do not support this extension and some older games using SDL 2. Can it be solved by translating or wrapping to render it on a wayland window without use of xwayland? is it going to be on sdl3 or the sdl2 compat layer?

@smcv
Copy link
Contributor

smcv commented Jan 23, 2024

Can it be solved by translating or wrapping to render it on a wayland window without use of xwayland?

No, if the game wants to call X11 functions directly, it will call X11 functions directly (and if that makes it crash in the absence of X11, it will crash). SDL cannot change what happens when the game calls X11 functions directly.

Technically something could probably reimplement the entire API of libX11 and all the associated libraries like libXext, but that would be a large project that's outside the scope of SDL, and the fact that it doesn't already exist suggests that it's probably too hard. The Wayland community has chosen to do backwards-compatibility by providing Xwayland, rather than having a library-level compatibility layer.

There is a quirks mechanism in SDL2 and sdl2-compat that can force individual games to use X11 via Xwayland, instead of attempting native Wayland. Games can explicitly ask for this during startup, or in SDL 2.30.x and sdl2-compat, the library will attempt to detect some common reasons to crash/fail under native Wayland (like GLEW and Nvidia Cg) and switch to X11 automatically if they are detected.

In SDL3, the expectation is that each "natively SDL3" game on Linux will either work correctly with native Wayland, or force X11 during its own startup.

@sulix
Copy link
Contributor

sulix commented Jan 23, 2024

It might be possible to get this working only wrapping a subset of X11 and the Vulkan WSI, but that's still both (a) probably a fair bit of work, and (b) a dodgy hack.

But it's not impossible to, for instance, get enough glX working to make Cg with wayland: https://gist.github.com/sulix/fe951daaeb4e51dfb329e5935e705cbf

But using SDL_VIDEODRIVER=x11 (as done by sdl12-compat and sdl2-compat in many cases) is the more reliable solution.

@slouken slouken closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2024
@smcv
Copy link
Contributor

smcv commented Jan 23, 2024

But using SDL_VIDEODRIVER=x11 (as done by sdl12-compat and sdl2-compat in many cases) is the more reliable solution.

SDL 2.30.x will do this, too (#8812).

@coronavirus6045
Copy link
Author

i am guessing that it stems from the game’s “libvulkan.so” which might not support wayland. I think dxvk-native works when forcing it on wayland (source 1 games)

@smcv
Copy link
Contributor

smcv commented Jan 26, 2024

If there's a library bundled with the game that assumes X11 and doesn't support Wayland, then that's basically the same as the game itself assuming X11 and not supporting Wayland.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants