diff --git a/flake.nix b/flake.nix index 79e690f9..9ef23eed 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,7 @@ # Keep in sync with CMakeLists.txt monado rev rev = lib.strings.trim (builtins.readFile ./monado-rev); # Nix will output the correct hash when it doesn't match - hash = "sha256-z3WdVsoodQczeUaMZP7M6UhWlKW30IJbpix8M0MCHc8="; + hash = "sha256-Y/aTn6lRafPAuRhTWHOVnZ0xCZVfeD2mmOJ5p2jG8L8="; }; }; diff --git a/monado-rev b/monado-rev index e6e21fea..3f7c0920 100644 --- a/monado-rev +++ b/monado-rev @@ -1 +1 @@ -734f3f569ac8a82500cdd25c8d822680705f8ef5 +29eaac3e172992cfc0b87c8e57b5c9c28d4ce155 diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index fa6430ef..0d28133a 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -110,18 +110,18 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr connection throw; } - static_roles.head = xdevs[xdev_count++] = &hmd; + static_roles.head = static_xdevs[static_xdev_count++] = &hmd; if (hmd.supported.face_tracking) static_roles.face = &hmd; - roles.left = left_controller_index = xdev_count++; - static_roles.hand_tracking.unobstructed.left = xdevs[left_controller_index] = &left_controller; - xdevs[left_hand_interaction_index = xdev_count++] = &left_hand_interaction; + roles.left = left_controller_index = static_xdev_count++; + static_roles.hand_tracking.unobstructed.left = static_xdevs[left_controller_index] = &left_controller; + static_xdevs[left_hand_interaction_index = static_xdev_count++] = &left_hand_interaction; - roles.right = right_controller_index = xdev_count++; - static_roles.hand_tracking.unobstructed.right = xdevs[right_controller_index] = &right_controller; - xdevs[right_hand_interaction_index = xdev_count++] = &right_hand_interaction; + roles.right = right_controller_index = static_xdev_count++; + static_roles.hand_tracking.unobstructed.right = static_xdevs[right_controller_index] = &right_controller; + static_xdevs[right_hand_interaction_index = static_xdev_count++] = &right_hand_interaction; #if WIVRN_FEATURE_STEAMVR_LIGHTHOUSE auto use_steamvr_lh = configuration().use_steamvr_lh || std::getenv("WIVRN_USE_STEAMVR_LH"); @@ -135,31 +135,31 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr connection U_LOG_W("====================="); if (steamvr_lh_create_devices(nullptr, &lhdevs) == XRT_SUCCESS) { - for (int i = 0; i < lhdevs->xdev_count; i++) + for (int i = 0; i < lhdevs->static_xdev_count; i++) { - auto lhdev = lhdevs->xdevs[i]; + auto lhdev = lhdevs->static_xdevs[i]; switch (lhdev->device_type) { case XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER: - roles.left = xdev_count; + roles.left = static_xdev_count; static_roles.hand_tracking.unobstructed.left = nullptr; static_roles.hand_tracking.conforming.left = lhdev; break; case XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER: - roles.right = xdev_count; + roles.right = static_xdev_count; static_roles.hand_tracking.unobstructed.right = nullptr; static_roles.hand_tracking.conforming.right = lhdev; break; case XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER: if (roles.left == left_controller_index) { - roles.left = xdev_count; + roles.left = static_xdev_count; static_roles.hand_tracking.unobstructed.left = nullptr; static_roles.hand_tracking.conforming.left = lhdev; } else if (roles.right == right_controller_index) { - roles.right = xdev_count; + roles.right = static_xdev_count; static_roles.hand_tracking.unobstructed.right = nullptr; static_roles.hand_tracking.conforming.right = lhdev; } @@ -167,7 +167,7 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr connection default: break; } - xdevs[xdev_count++] = lhdev; + static_xdevs[static_xdev_count++] = lhdev; } } } @@ -175,16 +175,16 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr connection if (get_info().eye_gaze || is_forced_extension("EXT_eye_gaze_interaction")) { // The tracker space needs to be attached to the head pose once the space overseer is created - xdevs[xdev_count++] = static_roles.eyes = &eye_tracker.emplace(*this); + static_xdevs[static_xdev_count++] = static_roles.eyes = &eye_tracker.emplace(*this); } auto face = get_info().face_tracking; if (face == from_headset::face_type::android || is_forced_extension("ANDROID_face_tracking")) - xdevs[xdev_count++] = static_roles.face = &android_face_tracker.emplace(&hmd, *this); + static_xdevs[static_xdev_count++] = static_roles.face = &android_face_tracker.emplace(&hmd, *this); else if (face == from_headset::face_type::fb2 || is_forced_extension("FB_face_tracking2")) - xdevs[xdev_count++] = static_roles.face = &fb_face2_tracker.emplace(&hmd, *this); + static_xdevs[static_xdev_count++] = static_roles.face = &fb_face2_tracker.emplace(&hmd, *this); else if (face == wivrn::from_headset::face_type::htc || is_forced_extension("HTC_facial_tracking")) - xdevs[xdev_count++] = static_roles.face = &htc_face_tracker.emplace(&hmd, *this); + static_xdevs[static_xdev_count++] = static_roles.face = &htc_face_tracker.emplace(&hmd, *this); auto num_generic_trackers = get_info().num_generic_trackers; if (num_generic_trackers > 0) @@ -196,35 +196,35 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr connection from_headset::body_tracking::max_tracked_poses); num_generic_trackers = from_headset::body_tracking::max_tracked_poses; } - if (num_generic_trackers + xdev_count > std::size(xdevs)) + if (num_generic_trackers + static_xdev_count > std::size(static_xdevs)) { U_LOG_W("Too many generic trackers: %d, only %lu will be active", num_generic_trackers, - std::size(xdevs) - xdev_count); - num_generic_trackers = std::size(xdevs) - xdev_count; + std::size(static_xdevs) - static_xdev_count); + num_generic_trackers = std::size(static_xdevs) - static_xdev_count; } U_LOG_I("Creating %d generic trackers", num_generic_trackers); for (int i = 0; i < num_generic_trackers; ++i) - xdevs[xdev_count++] = &generic_trackers.emplace_back(i, &hmd, *this); + static_xdevs[static_xdev_count++] = &generic_trackers.emplace_back(i, &hmd, *this); } #if WIVRN_FEATURE_SOLARXR - uint32_t num_devs = solarxr_device_create_xdevs(static_cast(hmd).tracking_origin, &xdevs[xdev_count], ARRAY_SIZE(xdevs) - xdev_count); + uint32_t num_devs = solarxr_device_create_xdevs(static_cast(hmd).tracking_origin, &static_xdevs[static_xdev_count], ARRAY_SIZE(static_xdevs) - static_xdev_count); if (num_devs != 0) { - static_roles.body = xdevs[xdev_count]; - solarxr_device_set_feeder_devices(static_roles.body, xdevs, xdev_count); + static_roles.body = static_xdevs[static_xdev_count]; + solarxr_device_set_feeder_devices(static_roles.body, static_xdevs, static_xdev_count); } - xdev_count += num_devs; + static_xdev_count += num_devs; #endif if (roles.left >= 0) - roles.left_profile = xdevs[roles.left]->name; + roles.left_profile = static_xdevs[roles.left]->name; if (roles.right >= 0) - roles.right_profile = xdevs[roles.right]->name; + roles.right_profile = static_xdevs[roles.right]->name; if (roles.gamepad >= 0) - roles.gamepad_profile = xdevs[roles.gamepad]->name; + roles.gamepad_profile = static_xdevs[roles.gamepad]->name; if (auto system_name = get_info().system_name; !system_name.empty()) { @@ -256,9 +256,9 @@ wivrn_session::~wivrn_session() solarxr_device_clear_feeder_devices(static_roles.body); #endif - for (size_t i = 0; i < ARRAY_SIZE(xdevs); i++) + for (size_t i = 0; i < ARRAY_SIZE(static_xdevs); i++) { - xrt_device_destroy(&xdevs[i]); + xrt_device_destroy(&static_xdevs[i]); } connection->shutdown(); @@ -300,8 +300,8 @@ xrt_result_t wivrn::wivrn_session::create_session(std::unique_ptrleft_controller, &self->right_controller, nullptr, - self->xdevs, - self->xdev_count, + self->static_xdevs, + self->static_xdev_count, false, false, out_xspovrs);