From 6c202db59e250331736694353c419784a5d8e17c Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 15 Feb 2026 00:02:17 +0100 Subject: [PATCH] Update derived poses 1s after interaction profile Also ignore it for hand interaction --- client/scenes/stream.h | 2 ++ client/scenes/stream_tracking.cpp | 21 ++++++++++++++------- server/driver/wivrn_session.cpp | 3 --- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/client/scenes/stream.h b/client/scenes/stream.h index f9b37a58..47e56a50 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -77,6 +77,7 @@ private: thread_safe tracking_control{}; std::array, 2> interaction_profiles; // left and right hand std::atomic interaction_profile_changed = false; + std::atomic scheduled_derived_pose = 0; // Tracking thread will compute derived pose when time is reached std::atomic recenter_requested = false; std::atomic hid_forwarding = false; std::atomic display_time_phase = 0; @@ -235,6 +236,7 @@ private: void read_actions(); void on_interaction_profile_changed(const XrEventDataInteractionProfileChanged &); + void send_derived_pose(); void setup(const to_headset::video_stream_description &); void setup_reprojection_swapchain(uint32_t width, uint32_t height); diff --git a/client/scenes/stream_tracking.cpp b/client/scenes/stream_tracking.cpp index 461789c4..5ba77581 100644 --- a/client/scenes/stream_tracking.cpp +++ b/client/scenes/stream_tracking.cpp @@ -622,6 +622,13 @@ void scenes::stream::tracking() } network_session->send_stream(std::span(packets.data(), packet_count)); + + XrTime old = scheduled_derived_pose; + if (old and now > old) + { + send_derived_pose(); + scheduled_derived_pose.compare_exchange_strong(old, 0); + } } catch (std::exception & e) { @@ -721,6 +728,12 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction interaction_profiles[i] = interaction_profile::none; } + // Wait for runtime to know about the controllers before sending data + scheduled_derived_pose = instance.now() + 1'000'000'000; +} + +void scenes::stream::send_derived_pose() +{ auto now = instance.now(); for (device_id target: { device_id::LEFT_AIM, @@ -735,14 +748,8 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction { // don't do derived poses for hand interaction const bool right = (target >= device_id::RIGHT_GRIP && target <= device_id::RIGHT_PALM) || target == device_id::RIGHT_PINCH_POSE || target == device_id::RIGHT_POKE; - if (interaction_profiles[right].load() == interaction_profile::ext_hand_interaction_ext) - { - network_session->send_control(from_headset::derived_pose{ - .source = target, - .target = target, - }); + if (interaction_profiles[right] == interaction_profile::ext_hand_interaction_ext) continue; - } auto source = derived_from(target); auto source_space = application::space(device_to_space(source)); diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index cac0ddeb..9c233047 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -616,10 +616,7 @@ void wivrn_session::operator()(from_headset::override_foveation_center && foveat void wivrn_session::operator()(from_headset::derived_pose && derived) { left_controller.set_derived_pose(derived); - left_hand_interaction.set_derived_pose(derived); - right_controller.set_derived_pose(derived); - right_hand_interaction.set_derived_pose(derived); } void wivrn_session::operator()(from_headset::hand_tracking && hand_tracking)