From ded51e6ae25b85d39e89794a907ac9470175e30d Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Fri, 6 Aug 2021 17:51:03 +0200 Subject: [PATCH] Workaround SteamVR-for-Linux issue 421 https://github.com/ValveSoftware/SteamVR-for-Linux/issues/421 --- src/openxr/OpenXRApi.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/openxr/OpenXRApi.cpp b/src/openxr/OpenXRApi.cpp index 47826ee1..171cba6e 100644 --- a/src/openxr/OpenXRApi.cpp +++ b/src/openxr/OpenXRApi.cpp @@ -1909,6 +1909,12 @@ void OpenXRApi::render_openxr(int eye, uint32_t texid, bool has_external_texture return; } } + +#ifdef __linux__ + // TODO: should not be necessary, but is for SteamVR 1.16.4 (but not 1.15.x) + glXMakeCurrent(graphics_binding_gl.xDisplay, graphics_binding_gl.glxDrawable, + graphics_binding_gl.glxContext); +#endif } void OpenXRApi::fill_projection_matrix(int eye, godot_real p_z_near, godot_real p_z_far, godot_real *p_projection) { @@ -2273,6 +2279,12 @@ int OpenXRApi::get_external_texture_for_eye(int eye, bool *has_support) { return 0; } +#ifdef __linux__ + // TODO: should not be necessary, but is for SteamVR 1.16.4 (but not 1.15.x) + glXMakeCurrent(graphics_binding_gl.xDisplay, graphics_binding_gl.glxDrawable, + graphics_binding_gl.glxContext); +#endif + // process should be called by now but just in case... if (state > XR_SESSION_STATE_UNKNOWN && buffer_index != NULL) { // make sure we know that we're rendering directly to our @@ -2499,6 +2511,12 @@ void OpenXRApi::process_openxr() { // TODO: Tell godot not do render VR to save resources. // See render_openxr() for the corresponding early exit. } + +#ifdef __linux__ + // TODO: should not be necessary, but is for SteamVR 1.16.4 (but not 1.15.x) + glXMakeCurrent(graphics_binding_gl.xDisplay, graphics_binding_gl.glxDrawable, + graphics_binding_gl.glxContext); +#endif } ////////////////////////////////////////////////////////////////////////////////