Sodium

Sodium

44M Downloads

Requesting a No Error Context causes a crash at startup on Wayland

jellysquid3 opened this issue ยท 7 comments

commented

Description

If you are using a patched version of GLFW to enable Wayland support, the following error may occur.

GLFW error 65543: EGL: Failed to create context: An unrecognized attribute or attribute value was passed in the attribute list.
Please make sure you have up-to-date drivers (see aka.ms/mcdriver for instructions).

This is caused by a change in Sodium 0.4.10 which makes it so a No Error Context is requested by default, in order to help reduce CPU overhead when executing draw calls. However, it seems that GLFW cannot properly pass the hint along when using Wayland, or that something else is going wrong in the stack.

We should try to find (or open) a bug report with upstream if we can find the culprit.

Workaround

The user can disable the use of a No Error Context by modifying the configuration like so:

    "use_no_error_gl_context": false

Seeing that users are already replacing system libraries, it seems reasonable enough to me that those users also be asked to edit their configuration file once to workaround the issue. I don't see an obvious way we can detect this problem, and I don't want to disable the use of No Error Contexts by default on Linux.

commented

If this happens reliably on all Wayland systems, you could try querying the $XDG_SESSION_TYPE environment variable on *nix systems to determine whether a system is running X11 or Wayland (note: since BSD-based systems can run Wayland, you need to check this on all *nix systems, not just Linux-based systems).

commented

I can reproduce this issue on Fedora Kinoite 38 with Wayland

commented

If this happens reliably on all Wayland systems

Considering you need a patched GLFW to even get Minecraft starting on Wayland, it should. So checking XDG_SESSION_TYPE should be reliable enough.

commented

This is caused by a change in Sodium 0.4.10

I was only able to reproduce this on 0.4.11 so far

commented

fixed by glfw/glfw@eeeb56e . as a solution before it been tagged, you can use glfw-git with env var XDG_SESSION_TYPE= (to prevent NO_ERROR_CONTEXT_UNSUPPORTED workaround been used) and DISPLAY= (to force wayland). or simply set MESA_NO_ERROR=1

commented

That's great news. When that changeset has been tagged, we'll update the workaround to check the GLFW version before applying.

commented

(Bumping this issue, GLFW 3.4 was released with that fix in February.)