stride3d/stride · error · Exception

OpenXR is only compatible with DirectX11

Error message

OpenXR is only compatible with DirectX11

What it means

Stride's OpenXR session creation binds an XrSessionCreateInfo to a graphics binding structure. That binding (graphics_binding_dx11) is only compiled for the DirectX11 graphics backend, so on any other backend the #else branch throws an Exception stating OpenXR is only compatible with DirectX11 — session creation cannot proceed without a D3D11 device.

Solutions

  1. Configure the game to use the DirectX11 graphics backend (GraphicsBackend.Direct3D11) when VR/OpenXR is enabled.
  2. On Linux or with Vulkan-only requirements, use a different VR backend (e.g. OpenVR where available) instead of OpenXR.
  3. Gate VR initialization on backend detection and disable/warn when the backend is not Direct3D11.

Example fix

// before
Game.GraphicsDeviceManager.RequestedGraphicsProfile = GraphicsProfile.Level_11_0;
Game.GraphicsDeviceManager.DeviceType = ...; // Vulkan selected -> OpenXR Enable throws

// after
if (Game.GraphicsDeviceManager.RequiredBackend != GraphicsBackend.Direct3D11)
{
    // fallback: disable VR or switch backend
    Game.GraphicsDeviceManager.InitializeWithBackend(GraphicsBackend.Direct3D11);
}
Defensive patterns

Strategy: validation

Validate before calling

// C#
if (Game.GraphicsDeviceManager.RequiredBackend != GraphicsBackend.Direct3D11)
{
    // switch backend or disable OpenXR before Enable()
}

Try / catch

// C#
try { hmd.Enable(); }
catch (Exception ex) when (ex.Message.Contains("only compatible with DirectX11"))
{
    Logger.Warning("OpenXR requires Direct3D11; VR disabled");
    vrAvailable = false;
}

Prevention

When it happens

Trigger: Enabling the OpenXR HMD while the game/engine runs with a non-D3D11 GraphicsBackend (Vulkan, OpenGL, etc.), reaching the #else branch of the session creation code.

Common situations: Launching on Linux or with a Vulkan/OpenGL-configured Stride project; switching GraphicsDeviceProvider to Vulkan for performance; running headless/CI builds with a different backend default.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/aa13238f7f727e65. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.VirtualReality/OpenXR/OpenXRHmd.cs:239

            Logger.Debug(
                "DX11 device luid: " + dx11.AdapterLuid
                + " min feature level: " + dx11.MinFeatureLevel
            );

            var graphics_binding_dx11 = new GraphicsBindingD3D11KHR()
            {
                Type = StructureType.GraphicsBindingD3D11Khr,
                Device = baseDevice.NativeDevice,
                Next = null
            };
            session_create_info = new SessionCreateInfo()
            {
                Type = StructureType.SessionCreateInfo,
                Next = &graphics_binding_dx11,
                SystemId = SystemId
            };
#else
            throw new Exception("OpenXR is only compatible with DirectX11");
#endif

            Session session;
            Xr.CreateSession(Instance, &session_create_info, &session).CheckResult();
            globalSession = session;

            // --- Create swapchain for main VR rendering
            Swapchain swapchain = new Swapchain();
            SwapchainCreateInfo swapchain_create_info = new()
            {
                Type = StructureType.SwapchainCreateInfo,
                Next = null,
                UsageFlags = SwapchainUsageFlags.TransferDstBit |
                             SwapchainUsageFlags.SampledBit |
                             SwapchainUsageFlags.ColorAttachmentBit,
                CreateFlags = 0,
#if STRIDE_GRAPHICS_API_DIRECT3D11
                Format = (long)PixelFormat.R8G8B8A8_UNorm_SRgb,

View on GitHub (pinned to 96fad776d2)