mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-27 22:07:15 +01:00
The OpenXR session could not be created: eglGetCurrentContext returned nothing while SDL was certain a context was current. SDL binds the GL context against the window's EGL surface. In a headset there is no window being presented - every pixel reaches the display through the swapchains - so that surface never arrives. What SDL does then is the trap. SDL_EGL_MakeCurrent, handed no surface and without gl_allow_no_surface, calls eglMakeCurrent(EGL_NO_SURFACE, EGL_NO_CONTEXT) to unbind everything and returns success; SDL_GL_MakeCurrent then records the context as current. So SDL's bookkeeping and EGL's actual state disagree permanently, and asking SDL to bind it again does nothing, because SDL_GL_MakeCurrent sees its own record agree and returns early. RTCWQuest never meets this because it never depends on a window surface: it makes its context current against a 16x16 pbuffer (TBXR_Common.c, egl->TinySurface). Same here, except the context is the one SDL already made, since the engine renders in it. The EGLConfig comes from eglQueryContext, which VR_CreateSession was already recovering for the graphics binding. The pbuffer outlives the session deliberately - the session is torn down and rebuilt around renderer restarts, and unbinding the context in the middle of that is the thing this prevents. It is released in VR_Shutdown. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>