Repository navigation
fix(steamvr): name the tracking sample each frame was rendered with - #8
Merged
Merged
Conversation
The SteamVR driver's FRAME_END never set sample_id, and metalvrd's ALVR driver drops a frame that names no tracking sample, so a Quest streaming SteamVR over ALVR connected and tracked but received no video: every session ended with "headset disconnected (0 frames sent, N dropped)". SteamVR does not say which pose it rendered a frame with, only the pose itself (SubmitLayer's mHmdPose). Keep the head orientations of the last 64 tracking samples and send the one nearest the first projection layer's pose, as ALVR's own SteamVR driver does (PoseHistory::GetBestPoseMatch). Newest samples win ties, so a still head names the newest sample rather than an older one that float noise happens to put closer. The headset then reprojects each frame from the pose it was drawn with.
6 of 10 tasks
…ple-id # Conflicts: # steamvr/driver_metalvr.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Quest streaming SteamVR over ALVR connects, tracks the head and controllers, and shows no video:
metalvrdlogs every session asheadset disconnected (0 frames sent, N dropped).The SteamVR driver's
FRAME_ENDnever setssample_id, so it is always 0, andAlvrDriver::sendFrame(daemon/driver_alvr.cpp) drops every frame that names no tracking sample before ALVR sees it. The OpenXR runtime sets it (runtime/session.cpp); only the SteamVR path was missing it.SteamVR does not say which pose it rendered a frame with, only the pose itself (
SubmitLayer'smHmdPose). The driver now keeps the head orientations of the last 64 tracking samples and names the one nearest the first projection layer's pose, which is what ALVR's own SteamVR driver does (PoseHistory::GetBestPoseMatch). Newer samples win ties (an older one has to be about 0.1° nearer), so a still head names the newest sample rather than one float noise happens to put closer. The headset then reprojects each frame from the pose it was drawn with.This is the change the other two SteamVR PRs (headset views, Touch grip offset) are easiest to see with, but it does not depend on them, nor they on it.
Testing
Built for macOS and for Windows (
build/native,build/win64): not run, no CMake or Ninja on this Mac.steamvr/driver_metalvr.dllwas built withx86_64-w64-mingw32-g++16.2 from the CMake target's sources, include paths and flags (C++20,-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers, static runtime): 0 warnings, as onmain. CI covers the full builds.scripts/test-native.shandscripts/test-failures.sh: not run. They do not reach the SteamVR driver, andtests/has no harness for it yet, so this change has no automated check; happy to add one if there is a preferred shape for it.scripts/test-wine.sh: not run.scripts/test-openvr.sh: not run (this is the SteamVR driver, not the OpenComposite path).On a headset: Meta Quest 3 over Wi-Fi with the ALVR client, metalvrd from the v0.2.1 release (ALVR server v20.14.1), SteamVR 2.18.4 on MetalSharp Wine 8.0 (Wine 11.17, x86_64 under Rosetta), Apple silicon Mac, macOS 27. Tried in SteamVR Home and Blade & Sorcery.
Before:
headset disconnected (0 frames sent, 5039 dropped), black in the headset. After:headset disconnected (2489 frames sent, 0 dropped)and SteamVR's picture in the headset. With a temporary log of the match (since removed), the named sample's orientation was within 0.01 to 0.03° of SteamVR's render pose on average, usually the newest sample or one to four back.Checklist
patches/, not edits inexternal/