stride3d / stride

Stride (formerly Xenko), a free and open-source cross-platform C# game engine.
https://stride3d.net
MIT License
6.65k stars 957 forks source link

[Linux] SDL: MakeCurrent returns sometimes EGL_BAD_ACCESS error on Wayland #2487

Open Jklawreszuk opened 1 month ago

Jklawreszuk commented 1 month ago

Release Type: Official Release

Version: 4.1.0.1805+

Platform(s): Linux, Fedora

Describe the bug

It is not possible to play any 3D game during runtime because of error : Error while compiling GLSL shader. [] using Wayland driver

To Reproduce Steps to reproduce the behavior:

  1. Run GameStudio
  2. Create new project based on SpaceEscape template
  3. Add Linux platform
  4. Go to Linux platform project and build It to test executable on Linux
  5. Run

Expected behavior The application should work flawlessly

Log and callstacks stacktrace.txt

Additional context Described bug exists only for Wayland. If you switch to X11 by setting following variable

export SDL_VIDEODRIVER=x11

then problem does not occur.

Jklawreszuk commented 1 month ago

I found another way to reproduce the error:

  1. create a project from an empty template - select HDR and Level 11
  2. remove skybox and leave only two elements for Main Scene - camera and light.
  3. import any custom model (for testing purposes I used royality free Train kit from Kenney).
Jklawreszuk commented 1 month ago

Another use case:

1 . create a project from an empty template

  1. remove skybox and leave only two elements for Main Scene - camera and light.
  2. this time import only spritesheet (download any image from the internet or create by yourself) and add it to the scene

Works

Jklawreszuk commented 1 month ago

Conclusion : Both Procedural and Imported models may share a common code that is flawed

Edit: Error occurs for MeshRenderFeature

Jklawreszuk commented 1 month ago

Okay...That's new.

Another use case 1 . create a project from an empty template, but this time don't check the HDR option and use LDR instead - also pick lowest API level - Level 9

  1. remove skybox and leave only two elements for Main Scene - camera and light.
  2. import any model - procedural cube for example

Works!

Doprez commented 1 month ago

Those steps sound like a similar issue to the mobile issue steps https://github.com/stride3d/stride/issues/2485

You might be able to just uncheck Generate mipmaps if Im right? I dont know how much that info actually helps you but if its true it may be useful.

Jklawreszuk commented 1 month ago

I'm not sure if this is the case because my test projects don't contain any materials at all 😕

Jklawreszuk commented 1 month ago

I compared the shader scripts and on both Windows and Linux they are the same Edit: Only difference I didn't noticed is GL.CreateProgram return 0. Also, SDL.MakeCurrent fails...

Jklawreszuk commented 1 month ago

Another progress, I was able to capture SDL error:

INFO: Unable to make EGL context current (call to eglMakeCurrent failed, reporting an error of EGL_BAD_ACCESS) -1
Jklawreszuk commented 1 month ago

Huh...Good news ! Looks like I have managed to making it work! Bad news is that there is something wrong with wayland Setting following env variable to X11 fixed an issue:

export SDL_VIDEODRIVER=x11