protonscr

[BUG] xrCreateSwapchain fails with XR_ERROR_RUNTIME_FAILURE and GL_INVALID_OPERATION for supported formats (e.g., GL_RGBA8, GL_RGBA16F)

steamvropen bug
ValveSoftware/SteamVR-for-Linux#782 · opened 2025-04-10 by O-LEX · updated 2026-07-23 · 2 comments · github
OO-LEX 2025-04-10 github

Describe the bug

When attempting to run OpenXR applications using the OpenGL graphics backend on Linux via SteamVR (version 2.9.6 confirmed), the xrCreateSwapchain function call fails with XR_ERROR_RUNTIME_FAILURE. Detailed logs reveal a preceding GL_INVALID_OPERATION error occurring during the swapchain creation process.

This failure occurs even when using swapchain formats that are reported as supported by SteamVR via xrEnumerateSwapchainFormats, such as GL_RGBA8 (reported as 0x81A5) and GL_RGBA16F (reported as 0x8CAC).

Furthermore, there is a notable discrepancy between the format values reported by SteamVR for some formats (e.g., 0x8CAC for GL_RGBA16F) and the values defined in standard OpenGL header files like <GL/glcorearb.h> or GLAD-generated headers (which consistently define GL_RGBA16F as 0x881A). While this value mismatch itself can cause format selection issues in applications relying on header definitions, the core problem reported here is that even when this mismatch is manually bypassed (by using the runtime-reported values), the xrCreateSwapchain call still fundamentally fails within the SteamVR runtime.

The Vulkan graphics backend works correctly under the same conditions.

To Reproduce

Steps to reproduce the behavior:

  1. Build the OpenXR SDK hello_xr sample application on a Linux system.
  2. Ensure SteamVR is running and set as the active OpenXR runtime.
  3. Run the hello_xr sample from the build directory with the OpenGL backend specified: ./hello_xr -g OpenGL
  4. Observe the application terminating with XR_ERROR_RUNTIME_FAILURE originating from xrCreateSwapchain after selecting a swapchain format (either GL_RGBA8 or GL_RGBA16F, depending on application preference logic if modified). Detailed logs show a preceding GL_INVALID_OPERATION error.

(Self-correction for header value mismatch required to even reach xrCreateSwapchain: The stock hello_xr might fail earlier due to the format value mismatch. To reproduce the xrCreateSwapchain failure itself, one needs to modify SelectColorSwapchainFormat in graphicsplugin_opengl.cpp to either hardcode the runtime-reported values like 36012 / 0x8CAC / or 33189 / 0x81A5 /, or implement logic that explicitly searches for these values in the list returned by xrEnumerateSwapchainFormats.)

Expected behavior

hello_xr -g OpenGL should successfully create the OpenGL swapchain using one of the formats reported as supported by SteamVR (like GL_RGBA8 or GL_RGBA16F) and launch the application, rendering the VR scene.

System Information (please complete the following information):
Issue reproduced on SteamVR Stable 2.9.6.

  • Steam client version (build number or date): [Skipped]
  • SteamVR version: 2.9.6 (Confirmed via logs)
  • Distribution: Ubuntu 24.04.2 LTS
  • Graphics Driver: NVIDIA 570.124.06
  • GPU: NVIDIA GeForce RTX 4080
  • Steam runtime diagnostics: (Generated text file will be attached separately)
  • Steam and SteamVR logs: (Generated tar.gz file will be attached separately)
  • Minidumps: (Generated tar.gz file will be attached separately if any exist)

Screenshots

Not applicable. Relevant console logs showing enumerated formats and the subsequent failure will be attached separately.

Additional context

  • This issue specifically relates to using the OpenGL graphics API with SteamVR as the OpenXR runtime on Linux.
  • The Vulkan graphics API (./hello_xr -g Vulkan2) works without issues on the same system setup.
  • There are anecdotal reports suggesting the Monado OpenXR runtime might handle OpenGL correctly on Linux, indicating the issue might be specific to SteamVR's implementation.
  • The VR headset used during testing was a Meta Quest 3, connected via ALVR v20.13.0. However, the nature of the failure (xrCreateSwapchain failing with internal OpenGL errors within the runtime) strongly suggests the root cause lies within SteamVR's OpenXR/OpenGL handling, likely independent of ALVR.
  • Debugging revealed the discrepancy in reported vs. header-defined values for GL_RGBA16F (0x8CAC vs 0x881A). While this value mismatch is problematic for application compatibility, the core issue is that xrCreateSwapchain fails even when this mismatch is bypassed by using the runtime-reported values. GL_RGBA8 (value 0x81A5 matched headers) also fails during xrCreateSwapchain.
  • This issue appears distinct from the older, now reportedly fixed, issue #421 concerning OpenGL context changes after certain OpenXR calls, as this failure occurs in SteamVR 2.9.6.
Aaleiby 2025-08-04 github

The only supported OpenGL formats on Linux are:

  • GL_SRGB8 (0x8C41)
  • GL_SRGB8_ALPHA8 (0x8C43)
  • GL_DEPTH_COMPONENT16 (0x81A5)
  • GL_DEPTH_COMPONENT24 (0x81A6)
  • GL_DEPTH_COMPONENT32F (0x8CAC)

https://registry.khronos.org/OpenGL/api/GL/glext.h

such as GL_RGBA8 (reported as 0x81A5) and GL_RGBA16F (reported as 0x8CAC)

Where are you finding these mappings?

AAcceleration2299 2026-07-23 github

I'm not the original poster, and I don't have all the information i would need to publish to get the problem fixed. However, I am having this very problem with the Blender VR Viewport plugin. Crashing on "failed to create swapchain" as mentioned by OP.

Blender currently has a conflict with the NVidia open driver where blender will crash on boot if using the vulkan backend, so i am hitting a hard wall with using this software due to steamvr's unwillingness to use opengl.

NVIDIA-SMI 610.43.03 KMD Version: 610.43.03 CUDA UMD Version: 13.3
Kernel: Linux 7.1.3-2-cachyos
SteamVR 2.16.7
Steam Client Update released July 22nd. (Pacman states cachyos/steam version 1.0.0.86-2)

Here is the blender console output (blenderfucky.txt). If you need more information of me, please point me in the direction of the tools to actually obtain that information, as i'm rather clueless and new to Linux's internal systems.

blenderfucky.txt

Nothing extracted yet.