Add OpenVR non-synced mode (AFR) with runtime reprojection#5
Add OpenVR non-synced mode (AFR) with runtime reprojection#5
Conversation
Implement Alternate Frame Rendering for OpenVR, matching OpenXR behavior: - Each eye submits with the pose from when it was actually rendered - Both eyes are submitted each present (one new, one resubmitted) - Runtime handles reprojection based on pose delta - Skip resubmission on first frame when no previous frame exists Co-authored-by: mutars <4204406+mutars@users.noreply.github.com>
|
@copilot you need to move async_aer from openxr to runtime level make it configurable and also modify in VR method which saying is async aer |
|
@copilot you need to move async_aer from openxr to runtime level make it configurable and also modify in VR method which saying is async aer |
…nXR and OpenVR - Move async_aer from OpenXR.hpp to VRRuntime.hpp base class - Update is_using_async_aer() to check both user setting and runtime capability - AFR now works for both OpenXR and OpenVR runtimes Co-authored-by: mutars <4204406+mutars@users.noreply.github.com>
Done in 6e92f3d. Moved |
|
@copilot src/mods/VR.hpp:139 you only need to rely on m_runtime->async_aer, |
- is_using_async_aer() now only checks m_runtime->async_aer - Set runtime's async_aer from config on load - Sync runtime's async_aer when UI toggle changes Co-authored-by: mutars <4204406+mutars@users.noreply.github.com>
Done in cb1ba6d. |
Summary of Changes
This PR implements Alternate Frame Rendering (AFR) for OpenVR, replicating the existing OpenXR behavior:
AFR Implementation:
l_frame/r_frame)vr::Submit_TextureWithPoseflag so runtime can reproject based on pose deltaRuntime Level Configuration:
async_aerfromOpenXR.hpptoVRRuntime.hppbase classis_using_async_aer()now only checksm_runtime->async_aer(single source of truth)m_use_async_aersyncs to runtime on config load and UI toggle changeFiles Changed:
src/mods/vr/D3D11Component.cpp- Added AFR logic for D3D11 OpenVR pathsrc/mods/vr/D3D12Component.cpp- Added AFR logic for D3D12 OpenVR pathsrc/mods/vr/runtimes/VRRuntime.hpp- Addedasync_aerat runtime levelsrc/mods/vr/runtimes/OpenXR.hpp- Removed duplicateasync_aersrc/mods/VR.hpp- Simplifiedis_using_async_aer()to only check runtimesrc/mods/VR.cpp- Sync user setting to runtime on config load and UI changeOriginal prompt
Let me first explore the existing codebase to understand the current OpenXR implementation with the non-synced mode and the OpenVR implementation structure. Now I have a good understanding of the OpenXR implementation. Let me search for more specific details about the non-synced mode and how the frame submission works in OpenXR, and also examine the OpenVR runtime more closely. Now let me also look at the D3D12Component and understand the full OpenXR end_frame implementation to understand the non-synced mode pattern: Now let me search for how OpenXR implements the AFR (Alternate Frame Rendering) mode with the pose resubmission logic in
end_frame:Now I have a comprehensive understanding of the codebase. Let me gather one more piece of information to understand the VR. cpp main flow and how it coordinates the submission: Now I have a comprehensive understanding of the codebase. Let me create a detailed implementation plan for adding non-synced mode (AFR - Alternate Frame Rendering) to OpenVR, replicating the behavior that already exists for OpenXR.Detailed Implementation Plan: OpenVR Non-Synced Mode (AFR with Runtime Reprojection)
Executive Summary
This plan details the implementation of a non-synced mode for OpenVR, replicating the existing OpenXR behavior where:
Core Concept Understanding
How OpenXR Currently Works (Reference Implementation)
In
OpenXR.cpp:: end_frame():Key Insight: Each eye's submitted frame uses the pose from when that eye was actually rendered, not the current pose. The runtime reprojects based on this historical pose.
Current OpenVR Behavior
Currently, in both
D3D11Component. cppandD3D12Component. cpp, OpenVR:GlobalPool::get_openvr_pose(vr->m_presenter_frame_count)- the current frame's poseImplementation Steps (Auto-CoT Breakdown)
Phase 1: Pose Storage Infrastructure Enhancement
Step 1.1: Verify ConstantsPool Already Supports OpenVR Poses
Location:
src/aer/ConstantsPool. hCurrent State: Already has:
Assessment: ✅ No changes needed - infrastructure exists with
CONSTANTS_HISTORY_SIZE = 10ring buffer.Step 1.2: Verify Pose Submission in update_hmd_state
Location:
src/mods/VR. cpp:: update_hmd_state()Current Code:
Assessment: ✅ Pose is already being stored per-frame. The key is that
frameparameter correctly identifies which frame the pose belongs to.Phase 2: D3D11Component OpenVR Modifications
Step 2.1: Understand Current D3D11 OpenVR Flow
Location:
src/mods/vr/D3D11Component. cpp:: on_frame()Current Flow:
Left eye frame (
is_left_eye_frame == true):m_left_eye_texRight eye frame (
is_left_eye_frame == false):m_right_eye_texProblem: No resubmission of the "other" eye.
Step 2.2: Implement AFR Submission Logic for D3D11
Location:
src/mods/vr/D3D11Component.cppImplementation Strategy:
For Left Eye Frame (when
is_left_eye_frame == true):m_left_eye_tex(existing)l_frame(newly rendered)m_right_eye_tex(previous frame's texture) with pose fromr_frameFor Right Eye Frame (when
is_right_eye_frame == true):✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.