SteamVR-for-Linux icon indicating copy to clipboard operation
SteamVR-for-Linux copied to clipboard

[BUG] xrCreateSession and xrCreateSwapchain don't restore EGL context

Open amalon opened this issue 1 month ago • 0 comments

Describe the bug If the app's specified EGL context (via XR_MNDX_egl_enable extension) is not current when xrCreateSession or xrCreateSwapchain are called, those calls return with the EGL context changed to the app's EGL context. Whenever changing the EGL context, SteamVR should restore the previous value, as is now done for GLX, otherwise an app may legitimately assume the context isn't in use and attempt to eglMakeCurrent from another thread, which then fails with eglGetError() returning EGL_BAD_ACCESS.

(My notes indicate that prior to 1.16.2, linux_v1.14 switched GLX context but didn't restore, similar to this bug, but I think only for xrCreateSwapchain).

To Reproduce Steps to reproduce the behavior:

  1. Use eglMakeCurrent() to clear the EGL context
  2. Call xrCreateSwapchain or xrCreateSession (using XR_MNDX_egl_enable)
  3. Use eglGetCurrentContext() and observe that the context has been altered

Expected behavior eglGetCurrentContext() before and after these calls should always show the exact same value.

System Information (please complete the following information): Please use the latest Steam beta client and SteamVR beta for your bug reports!

  • Steam client version (build number or date): Steam Beta Update, version 1761259186 (client build Oct 23 11:23 PM UTC -08:00)
  • SteamVR version: STEAMVR beta 2.13.6
  • Distribution (e.g. Ubuntu): ArchLinux
  • Mesa 25.2.4-arch1.2

amalon avatar Oct 26 '25 13:10 amalon