Skip to content

Fix re-entering VR crash (#138) and startup crash with DLSS 5 mod layers - #139

Merged
2 commits merged into
masterfrom
0.20.1-dlss5-coexist
Nov 14, 2026
Merged

2 commits merged into
masterfrom
0.20.1-dlss5-coexist

Conversation

@mdiener87

@mdiener87 mdiener87 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Michael · project thread

Fixes #138. Branch is cut from v0.20.1.

Re-entering VR crash (#138)

0.20.1 stamps the runtime's clock just before xrCreateSession (dab7806, the PimaxXR stale-event fix) through xrConvertWin32PerformanceCounterToTimeKHR. That pointer was taken during the previous session and never cleared when the instance ended. MSFS 2024 destroys its instance when it leaves VR, and the Virtual Desktop runtime DLL gets unloaded. On re-entry, xrCreateSession called into the unmapped DLL. I checked this against the signed 0.20.1 DLL: the crash dump's faulting return address (+0xC512C) sits right after that clock call.

Every function pointer taken from the runtime's instance is now cleared when the instance ends. That covers the clock, xrGetInstanceProperties, xrGetVisibilityMaskKHR, xrPathToString, xrGetCurrentInteractionProfile and the chain's xrGetInstanceProcAddr. The clock is looked up again at each session's Turbo setup, as in 0.20.1, so an instance's first session behaves exactly as before (5f5feea).

Startup crash with DLSS 5 mod layers

Cheeky Foveated DLSS ships an OpenXR layer that calls the next layer's xrGetInstanceProcAddr(XR_NULL_HANDLE, "xrEnumerateInstanceExtensionProperties") before it creates its instance. With that layer above VectorXR, VectorXR called through an empty pointer and the game crashed at launch, in 0.20.0 and 0.20.1 alike. VectorXR now returns XR_ERROR_HANDLE_INVALID, and the probing layer treats the extensions as unknown.

Logging

The log now names Cheeky's OpenXR layer when it is above or below VectorXR, and lists its in-game modules. Above VectorXR, Cheeky removes XR_VARJO_quad_views from the request VectorXR gets. The "Quadviews INACTIVE" line now says this, instead of pointing at the game's quad-view setting.

Tests

  • layer_load (new checks): a function requested before any instance, and after the last instance is destroyed, is refused without calling the chain below. An instance created above Cheeky's layer logs it.
  • Full Release ctest: 45/48 passed. The three that failed (framegen_presenter_tests_pacing, _ceiling, _policy_late) are wall-clock pacing tests. Star Citizen was holding the CPU at 100% during the run, and they still failed when rerun one at a time. They need a rerun on an idle machine or in CI. This change doesn't touch the presenter.
  • Not flown. It needs an MSFS 2024 exit and re-entry of VR on Virtual Desktop, and a game with Cheeky's layer above VectorXR.

🤖 Generated with Claude Code

mdiener87 and others added 2 commits November 12, 2026 11:36
…s layer

Issue 138: MSFS 2024 crashed re-entering VR on Virtual Desktop. 0.20.1
stamps the runtime's clock just before xrCreateSession (dab7806), through
xrConvertWin32PerformanceCounterToTimeKHR taken at the previous session.
That pointer outlived its instance; after xrDestroyInstance the runtime's
DLL is unloaded, so the next xrCreateSession called into unmapped code
(the crash dump's faulting call is that clock call in the signed 0.20.1
DLL). Every function taken from the runtime's instance now goes with it
(the clock, xrGetInstanceProperties, xrGetVisibilityMaskKHR,
xrPathToString, xrGetCurrentInteractionProfile and the chain's
xrGetInstanceProcAddr), and the clock is taken again for each instance.

DLSS 5 mods: a layer above VectorXR that asks for a function before any
instance exists (Cheeky Foveated DLSS's layer probes
xrEnumerateInstanceExtensionProperties that way) made VectorXR call
through an empty pointer, so the game crashed at startup whenever such a
layer was above it. It now gets XR_ERROR_HANDLE_INVALID, which such
probes treat as unknown.

The log names Cheeky Foveated DLSS's OpenXR layer above or below
VectorXR, and its in-game modules. Above, it takes the application's
quad-view request for its own quad views, and the Quadviews INACTIVE line
now says so instead of pointing at the game's setting.

Test: layer_load. A function asked for before any instance, and after
the last instance is destroyed, is refused with no call below; an
instance above Cheeky's layer logs it. The framegen presenter timing
tests (pacing, ceiling, policy_late) failed on this run with Star Citizen
holding the CPU at 100%; unrelated to this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The clock conversion was also taken at instance creation, which gave an
instance's first xrCreateSession a runtime clock stamp it did not have in
0.20.1, and with it the clock-based stale-event check instead of the
first-IDLE fallback. Only the clearing is needed for issue 138; the
clock is again taken at the session's Turbo setup, so first sessions
behave exactly as in 0.20.1.

Test: layer_load, eye_gaze, turbo_frame, turbo_trace, turbo_recovery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mdiener87 mdiener87 closed this pull request by merging all changes into master in 3f1e174 Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version 0.20.1 Causing CTD When Re-entering VR

1 participant