Compare commits

...
Author SHA1 Message Date
Vindicus999 9f362ed74c Merge remote-tracking branch 'upstream/master' 2025-06-16 23:14:13 +00:00
Patrick Nicolas 7e3b6d001e Fail if too many generic trackers are reported 2025-06-16 23:41:11 +02:00
Sapphire cdba101fe8 Remove htc and pico body tracking tooltips 2025-06-16 19:42:36 +02:00
Sapphire eb0aa46b83 Store body trackers in variant 2025-06-16 19:42:36 +02:00
SapphireandAwzri ad136eae43 Vive Ultimate Tracker support
Co-authored-by: Awzri <awzri@awzricat.com>
2025-06-16 19:42:36 +02:00
Just some guy 5422a66176 2025-06-15 23:13:47 +00:00
Just some guy 0ccc8b6239 Merge branch 'WiVRn:master' into sneed 2025-06-15 19:41:44 +00:00
Vindicus999 7f0a56448f Merge remote-tracking branch 'upstream/master' 2025-06-15 11:11:58 +00:00
Patrick Nicolas f2050fbe54 Re-fix build with older vulkan_hpp 2025-06-15 10:00:29 +02:00
Patrick Nicolas 804bfc6291 Fix build with older vulkan_hpp 2025-06-15 09:53:01 +02:00
Vindicus999 b8c3d21ad1 Merge remote-tracking branch 'upstream/master' 2025-06-13 11:29:38 +00:00
Patrick Nicolas 2ee0604ccf fix "Steam informations" -> "Steam information" 2025-06-13 11:38:50 +02:00
Vindicus999 92a381b1e0 Merge remote-tracking branch 'upstream/master' 2025-06-12 23:32:12 +00:00
Patrick Nicolas 40aeaab762 Cap num DPB slots to 16 2025-06-12 21:34:33 +02:00
Vindicus999 a20110ea08 Merge remote-tracking branch 'upstream/master' 2025-06-12 17:38:48 +00:00
Patrick Nicolas 711be3754b fix comp_target deletion (again) 2025-06-12 15:46:37 +02:00
Patrick Nicolas f6eb528ea7 Name most vulkan objects 2025-06-12 15:46:37 +02:00
Patrick Nicolas 1ed4d3cfe6 Name vulkan video objects 2025-06-12 15:46:37 +02:00
Patrick Nicolas 5be3a8aef4 Utility to name vulkan objects 2025-06-12 15:46:37 +02:00
Patrick Nicolas a6c20e9520 Send vulkan video idr over tcp 2025-06-12 11:07:10 +02:00
Vindicus999 3f91f9450f Merge remote-tracking branch 'upstream/master' 2025-06-10 17:38:56 +00:00
Patrick Nicolas 52b0bb0c42 update monado 2025-06-10 14:44:01 +02:00
Patrick Nicolas e5fd6a69dc Update monado 2025-06-10 14:44:01 +02:00
Patrick Nicolas f2679f21d0 Update monado 2025-06-10 14:44:01 +02:00
Patrick Nicolas d065229cb7 update monado 2025-06-10 14:44:01 +02:00
Patrick Nicolas 629f26acd7 Ignore newline in monado-rev 2025-06-10 14:44:01 +02:00
Patrick Nicolas 80622e16e6 Update monado git url 2025-06-10 14:44:01 +02:00
Patrick Nicolas caa2219a99 Rebuild on monado-rev change 2025-06-10 14:44:01 +02:00
Vindicus999 fa52f3eae8 Merge remote-tracking branch 'upstream/master' 2025-06-10 11:29:14 +00:00
Patrick Nicolas c98b461809 fix vulkan video conformance issues 2025-06-10 11:26:32 +02:00
Sapphire cc8092dd90 Cleanup body tracking 2025-06-10 09:38:49 +02:00
Vindicus999 557a70b28b Merge remote-tracking branch 'upstream/master' 2025-06-09 23:32:12 +00:00
Patrick Nicolas 810d3e9af3 fix newline in ja translation 2025-06-09 19:46:13 +02:00
Vindicus999 b09feca313 Merge remote-tracking branch 'upstream/master' 2025-06-09 17:34:33 +00:00
Patrick Nicolas 09ff9abba8 silence locale error 2025-06-09 19:26:55 +02:00
Patrick Nicolas 24c38e2a02 Move assert in body tracker destructor 2025-06-09 19:26:30 +02:00
mitsuami-megane fedd7917db update ja locale 2025-06-09 18:24:40 +02:00
Patrick Nicolas 18d1619d20 Don't crash on bigger than recommended image 2025-06-09 16:26:56 +02:00
galister b3f3c1c7fc fixed foveation: account for asymmetric v-fov 2025-06-09 16:19:12 +02:00
62 changed files with 839 additions and 321 deletions
+1
View File
@@ -60,6 +60,7 @@
<uses-feature android:name="wave.feature.handtracking" android:required="false" />
<uses-feature android:name="wave.feature.eyetracking" android:required="false" />
<uses-feature android:name="wave.feature.lipexpression" android:required="false" />
<uses-feature android:name="wave.feature.tracker" android:required="false" />
<application
android:allowBackup="false"
+3 -2
View File
@@ -284,10 +284,11 @@ FetchContent_Declare(uni-algo EXCLUDE_FROM_ALL SYSTEM URL https://github.co
URL_HASH SHA256=f2a1539cd8635bc6088d05144a73ecfe7b4d74ee0361fabed6f87f9f19e74ca9)
file(GLOB MONADO_PATCHES CONFIGURE_DEPENDS patches/monado/*)
file(READ monado-rev MONADO_REV)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS monado-rev)
file(STRINGS monado-rev MONADO_REV)
# Server dependencies
FetchContent_Declare(monado
GIT_REPOSITORY https://gitlab.freedesktop.org/monado/monado
GIT_REPOSITORY https://gitlab.freedesktop.org/monado/monado.git
# The flatpak manifest is updated automatically
GIT_TAG ${MONADO_REV}
PATCH_COMMAND ${CMAKE_CURRENT_LIST_DIR}/patches/apply.sh ${MONADO_PATCHES}
+46 -21
View File
@@ -505,6 +505,11 @@ static std::vector<interaction_profile> interaction_profiles{
"/user/hand/right/input/thumbstick/touch",
"/user/hand/right/input/thumbrest/touch",
}},
interaction_profile{
"/interaction_profiles/htc/vive_xr_tracker",
{"XR_HTC_vive_xr_tracker_interaction", "XR_HTC_path_enumeration"},
{},
},
interaction_profile{
"/interaction_profiles/ext/eye_gaze_interaction",
{"XR_EXT_eye_gaze_interaction"},
@@ -895,6 +900,8 @@ void application::initialize_actions()
{
spdlog::debug("Initializing actions");
auto * htc_body = std::get_if<xr::htc_body_tracker>(&body_tracker);
// Build an action set with all possible input sources
std::vector<XrActionSet> action_sets;
xr_actionset = xr::actionset(xr_instance, "all_actions", "All actions");
@@ -921,6 +928,18 @@ void application::initialize_actions()
profile.input_sources.push_back("/user/hand/right/input/palm_ext/pose");
}
// Dynamically add VIVE XR Trackers to the profile if available
if (htc_body && utils::contains(profile.required_extensions, XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME))
{
for (const auto & user_path: htc_body->get_paths())
{
for (const auto & input_path: htc_body->get_paths(user_path))
{
profile.input_sources.push_back(path_to_string(user_path) + path_to_string(input_path));
}
}
}
suggested_bindings.emplace(profile.profile_name, std::vector<XrActionSuggestedBinding>{});
for (const std::string & source: profile.input_sources)
@@ -957,6 +976,8 @@ void application::initialize_actions()
spaces[size_t(xr::spaces::palm_right)] = xr_session.create_action_space(a);
else if (name == "/user/hand/left/input/palm_ext/pose")
spaces[size_t(xr::spaces::palm_left)] = xr_session.create_action_space(a);
else if (name.contains("/input/entity_htc/pose") && htc_body)
htc_body->add(xr_session.create_action_space(a));
}
// Build an action set for each scene
@@ -1040,6 +1061,8 @@ void application::initialize()
opt_extensions.push_back(XR_FB_PASSTHROUGH_EXTENSION_NAME);
opt_extensions.push_back(XR_HTC_PASSTHROUGH_EXTENSION_NAME);
opt_extensions.push_back(XR_HTC_FACIAL_TRACKING_EXTENSION_NAME);
opt_extensions.push_back(XR_HTC_PATH_ENUMERATION_EXTENSION_NAME);
opt_extensions.push_back(XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME);
opt_extensions.push_back(XR_FB_FACE_TRACKING2_EXTENSION_NAME);
opt_extensions.push_back(XR_FB_BODY_TRACKING_EXTENSION_NAME);
opt_extensions.push_back(XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME);
@@ -1145,20 +1168,6 @@ void application::initialize()
htc_face_tracking_lip_supported = htc_face_properties.supportLipFacialTracking;
}
if (utils::contains_all(xr_extensions, std::array{XR_FB_BODY_TRACKING_EXTENSION_NAME, XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME, XR_META_BODY_TRACKING_FIDELITY_EXTENSION_NAME}))
{
XrSystemBodyTrackingPropertiesFB fb_body_properties = xr_system_id.fb_body_tracking_properties();
spdlog::info(" FB body tracking support: {}", (bool)fb_body_properties.supportsBodyTracking);
fb_body_tracking_supported = fb_body_properties.supportsBodyTracking;
}
if (utils::contains(xr_extensions, XR_BD_BODY_TRACKING_EXTENSION_NAME))
{
XrSystemBodyTrackingPropertiesBD bd_body_properties = xr_system_id.bd_body_tracking_properties();
spdlog::info(" PICO body tracking support: {}", (bool)bd_body_properties.supportsBodyTracking);
pico_body_tracking_supported = bd_body_properties.supportsBodyTracking;
}
if (utils::contains(xr_extensions, XR_FB_COMPOSITION_LAYER_SETTINGS_EXTENSION_NAME))
{
spdlog::info(" OpenXR post-processing extension support: true");
@@ -1223,16 +1232,26 @@ void application::initialize()
pico_face_tracker = xr_session.create_pico_face_tracker();
}
if (fb_body_tracking_supported)
if (utils::contains_all(xr_extensions, std::array{XR_FB_BODY_TRACKING_EXTENSION_NAME, XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME, XR_META_BODY_TRACKING_FIDELITY_EXTENSION_NAME}))
{
fb_body_tracker = xr_session.create_fb_body_tracker();
// HACK: always have an active body tracker so the quest runtime doesn't blow up (crash in random functions, controllers not working)
fb_body_tracker.start(false, false);
XrSystemBodyTrackingPropertiesFB fb_body_properties = xr_system_id.fb_body_tracking_properties();
spdlog::info(" FB body tracking support: {}", (bool)fb_body_properties.supportsBodyTracking);
if (fb_body_properties.supportsBodyTracking)
body_tracker = xr_session.create_fb_body_tracker();
}
if (pico_body_tracking_supported)
if (std::holds_alternative<std::monostate>(body_tracker) && utils::contains_all(xr_extensions, std::array{XR_HTC_PATH_ENUMERATION_EXTENSION_NAME, XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME}))
{
pico_body_tracker = xr_session.create_pico_body_tracker();
spdlog::info(" HTC body tracking support: true");
body_tracker = xr_session.create_htc_body_tracker();
}
if (std::holds_alternative<std::monostate>(body_tracker) && utils::contains(xr_extensions, XR_BD_BODY_TRACKING_EXTENSION_NAME))
{
XrSystemBodyTrackingPropertiesBD bd_body_properties = xr_system_id.bd_body_tracking_properties();
spdlog::info(" PICO body tracking support: {}", (bool)bd_body_properties.supportsBodyTracking);
if (bd_body_properties.supportsBodyTracking)
body_tracker = xr_session.create_pico_body_tracker();
}
vk::CommandPoolCreateInfo cmdpool_create_info;
@@ -1769,7 +1788,13 @@ void application::poll_events()
exit_requested = true;
}
break;
case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED:
case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED: {
if (auto * htc_body = std::get_if<xr::htc_body_tracker>(&body_tracker))
{
htc_body->update_active();
}
}
break;
case XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING:
break;
case XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED: {
+7 -18
View File
@@ -24,7 +24,9 @@
#include "xr/fb_body_tracker.h"
#include "xr/fb_face_tracker2.h"
#include "xr/hand_tracker.h"
#include "xr/htc_body_tracker.h"
#include "xr/htc_face_tracker.h"
#include "xr/pico_body_tracker.h"
#include "xr/pico_face_tracker.h"
#ifdef __ANDROID__
#include <android_native_app_glue.h>
@@ -138,10 +140,7 @@ class application : public singleton<application>
bool pico_face_tracking_supported = false;
xr::pico_face_tracker pico_face_tracker;
bool fb_body_tracking_supported = false;
xr::fb_body_tracker fb_body_tracker;
bool pico_body_tracking_supported = false;
xr::pico_body_tracker pico_body_tracker;
std::variant<std::monostate, xr::fb_body_tracker, xr::htc_body_tracker, xr::pico_body_tracker> body_tracker;
bool eye_gaze_supported = false;
@@ -451,14 +450,9 @@ public:
return instance().pico_face_tracking_supported;
}
static bool get_fb_body_tracking_supported()
static bool get_body_tracking_supported()
{
return instance().fb_body_tracking_supported;
}
static bool get_pico_body_tracking_supported()
{
return instance().pico_body_tracking_supported;
return !std::holds_alternative<std::monostate>(instance().body_tracker);
}
static bool get_eye_gaze_supported()
@@ -501,14 +495,9 @@ public:
return instance().pico_face_tracker;
}
static xr::fb_body_tracker & get_fb_body_tracker()
static auto & get_body_tracker()
{
return instance().fb_body_tracker;
}
static xr::pico_body_tracker & get_pico_body_tracker()
{
return instance().pico_body_tracker;
return instance().body_tracker;
}
static const std::vector<std::string> & get_xr_extensions()
+8 -2
View File
@@ -127,7 +127,13 @@ bool configuration::check_feature(feature f) const
{
case model::meta_quest_3:
case model::meta_quest_3s:
if (not application::get_fb_body_tracking_supported())
if (not std::holds_alternative<xr::fb_body_tracker>(application::get_body_tracker()))
return false;
break;
case model::htc_vive_focus_3:
case model::htc_vive_xr_elite:
case model::htc_vive_focus_vision:
if (not std::holds_alternative<xr::htc_body_tracker>(application::get_body_tracker()))
return false;
break;
case model::pico_neo_3:
@@ -135,7 +141,7 @@ bool configuration::check_feature(feature f) const
case model::pico_4s:
case model::pico_4_pro:
case model::pico_4_enterprise:
if (not application::get_pico_body_tracking_supported())
if (not std::holds_alternative<xr::pico_body_tracker>(application::get_body_tracker()))
return false;
break;
default:
+11 -7
View File
@@ -32,6 +32,7 @@
#include "lobby.h"
#include "stream.h"
#include "utils/i18n.h"
#include "utils/overloaded.h"
#include "version.h"
#include <cassert>
#include <chrono>
@@ -741,7 +742,7 @@ void scenes::lobby::gui_settings()
}
{
ImGui::BeginDisabled(not(application::get_fb_body_tracking_supported() or application::get_pico_body_tracking_supported()));
ImGui::BeginDisabled(not application::get_body_tracking_supported());
bool enabled = config.check_feature(feature::body_tracking);
if (ImGui::Checkbox(_S("Enable body tracking"), &enabled))
{
@@ -757,16 +758,19 @@ void scenes::lobby::gui_settings()
}
else
{
if (application::get_fb_body_tracking_supported())
tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings,\notherwise body data will be guessed from controller and headset positions"));
else if (application::get_pico_body_tracking_supported())
tooltip(_("Uses the Pico Motion Trackers to track body joint positions"));
std::visit(utils::overloaded{
[](auto &) {},
[this](xr::fb_body_tracker &) {
tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings,\notherwise body data will be guessed from controller and headset positions"));
},
},
application::get_body_tracker());
}
}
vibrate_on_hover();
}
if (application::get_fb_body_tracking_supported())
if (std::holds_alternative<xr::fb_body_tracker>(application::get_body_tracker()))
{
ImGui::BeginDisabled(not config.check_feature(feature::body_tracking));
ImGui::Indent();
@@ -1485,7 +1489,7 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
});
}
if (application::get_fb_body_tracking_supported() or application::get_pico_body_tracking_supported())
if (application::get_body_tracking_supported())
{
items.push_back({
.f = feature::body_tracking,
+18 -13
View File
@@ -18,6 +18,8 @@
*/
#include "utils/overloaded.h"
#include "xr/fb_body_tracker.h"
#include "xr/htc_body_tracker.h"
#include "xr/pico_body_tracker.h"
#define GLM_FORCE_RADIANS
#include "stream.h"
@@ -228,19 +230,15 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
info.num_generic_trackers = 0;
if (config.check_feature(feature::body_tracking))
{
if (application::get_fb_body_tracking_supported())
{
auto num_trackers = config.fb_lower_body
? std::ranges::count_if(xr::fb_body_tracker::joint_whitelist, [&config](auto joint) {
return config.fb_hip || joint != XR_FULL_BODY_JOINT_HIPS_META;
})
: std::ranges::count_if(xr::fb_body_tracker::joint_whitelist, [](auto joint) {
return joint != XR_FULL_BODY_JOINT_HIPS_META && joint < XR_FULL_BODY_JOINT_LEFT_UPPER_LEG_META;
});
info.num_generic_trackers = num_trackers;
}
else if (application::get_pico_body_tracking_supported())
info.num_generic_trackers = xr::pico_body_tracker::joint_whitelist.size();
info.num_generic_trackers = std::visit(utils::overloaded{
[&](std::monostate &) {
return size_t(0);
},
[&](auto & b) {
return b.count();
},
},
application::get_body_tracker());
}
info.palm_pose = application::space(xr::spaces::palm_left) or application::space(xr::spaces::palm_right);
@@ -882,6 +880,13 @@ void scenes::stream::render(const XrFrameState & frame_state)
// defoveate the image
auto extents = reprojector->reproject(command_buffer, foveation, image_index);
for (size_t i = 0; i < view_count; ++i)
{
extents[i] = {
.width = std::min(extents[i].width, swapchain.width()),
.height = std::min(extents[i].height, swapchain.height()),
};
}
command_buffer.writeTimestamp(vk::PipelineStageFlagBits::eBottomOfPipe, *query_pool, 2);
+31 -39
View File
@@ -19,7 +19,9 @@
#include "application.h"
#include "stream.h"
#include "utils/overloaded.h"
#include "wivrn_packets.h"
#include "xr/fb_body_tracker.h"
#include <ranges>
#include <spdlog/spdlog.h>
#include <thread>
@@ -244,6 +246,7 @@ void scenes::stream::tracking()
const bool hand_tracking = config.check_feature(feature::hand_tracking);
from_headset::face_type face_tracking = from_headset::face_type::none;
const bool body_tracking = config.check_feature(feature::body_tracking);
if (config.check_feature(feature::face_tracking))
{
if (application::get_fb_face_tracking2_supported())
@@ -260,25 +263,17 @@ void scenes::stream::tracking()
}
}
enum
auto & body_tracker = application::get_body_tracker();
if (body_tracking)
{
body_none,
body_fb,
body_pico,
} body_tracking = body_none;
if (config.check_feature(feature::body_tracking))
{
if (application::get_fb_body_tracking_supported())
if (auto * body_fb = std::get_if<xr::fb_body_tracker>(&body_tracker))
{
body_tracking = body_fb;
// We start the tracker on connection because there are toggleable settings.
// TODO maybe handle reconnection better, if the settings are changed the tracker count will mismatch and stuff might break
application::get_fb_body_tracker().stop();
application::get_fb_body_tracker().start(config.fb_lower_body, config.fb_hip);
// TODO maybe handle reconnection better, if the settings are changed since
// last connection to running server, the tracker count will mismatch and
// stuff might break
body_fb->stop();
body_fb->start(config.fb_lower_body, config.fb_hip);
}
else if (application::get_pico_body_tracking_supported())
body_tracking = body_pico;
}
on_interaction_profile_changed({});
@@ -359,29 +354,26 @@ void scenes::stream::tracking()
locate_hands(application::get_right_hand(), world_space, t0 + Δt));
}
if (body_tracking != body_none and t0 >= last_body_sample + period and
(Δt == 0 or Δt >= prediction - 2 * period))
{
last_body_sample = t0;
if (control.enabled[size_t(tid::generic_tracker)])
{
auto & body_packet = body.emplace_back(from_headset::body_tracking{
.production_timestamp = t0,
.timestamp = t0 + Δt,
});
switch (body_tracking)
{
case body_none:
__builtin_unreachable();
case body_fb:
body_packet.poses = application::get_fb_body_tracker().locate_spaces(t0 + Δt, world_space);
break;
case body_pico:
body_packet.poses = application::get_pico_body_tracker().locate_spaces(t0 + Δt, world_space);
break;
}
}
}
if (body_tracking)
std::visit(utils::overloaded{
[](std::monostate &) {},
[&](auto & b) {
if (t0 >= last_body_sample + period and
(Δt == 0 or Δt >= prediction - 2 * period))
{
last_body_sample = t0;
if (control.enabled[size_t(tid::generic_tracker)])
{
body.push_back(from_headset::body_tracking{
.production_timestamp = t0,
.timestamp = t0 + Δt,
.poses = b.locate_spaces(t0 + Δt, world_space),
});
}
}
},
},
body_tracker);
if (control.enabled[size_t(tid::face)])
{
+1
View File
@@ -26,6 +26,7 @@
#include "utils/typename.h"
#include "xr/check.h"
#include <type_traits>
#include <vector>
#include <vulkan/vulkan.h>
#include <openxr/openxr.h>
#include <openxr/openxr_platform.h>
+28 -9
View File
@@ -17,12 +17,27 @@
*/
#include "fb_body_tracker.h"
#include "application.h"
#include "spdlog/spdlog.h"
#include "xr/meta_body_tracking_fidelity.h"
#include "xr/xr.h"
#include <ranges>
#include <openxr/openxr.h>
static_assert(xr::pico_body_tracker::joint_whitelist.size() <= wivrn::from_headset::body_tracking::max_tracked_poses);
static_assert(xr::fb_body_tracker::joint_whitelist.size() <= wivrn::from_headset::body_tracking::max_tracked_poses);
std::vector<XrFullBodyJointMETA> xr::fb_body_tracker::get_whitelisted_joints(bool full_body, bool hip)
{
auto whitelisted_joints = std::ranges::filter_view(xr::fb_body_tracker::joint_whitelist, [=](auto joint) {
if (!full_body && (joint == XR_FULL_BODY_JOINT_HIPS_META || joint >= XR_FULL_BODY_JOINT_LEFT_UPPER_LEG_META))
return false;
if (!hip && joint == XR_FULL_BODY_JOINT_HIPS_META)
return false;
return true;
});
return {whitelisted_joints.begin(), whitelisted_joints.end()};
}
xr::fb_body_tracker::fb_body_tracker(instance & inst, session & s) :
s(s)
@@ -55,13 +70,23 @@ void xr::fb_body_tracker::start(bool full_body, bool hip)
// Enable IOBT.
CHECK_XR(xrRequestBodyTrackingFidelityMETA(handle, XR_BODY_TRACKING_FIDELITY_HIGH_META));
whitelisted_joints = get_whitelisted_joints(full_body, hip);
}
void xr::fb_body_tracker::stop()
{
assert(xrDestroyBodyTrackerFB);
full_body = false;
hip = false;
if (handle)
{
assert(xrDestroyBodyTrackerFB);
CHECK_XR(xrDestroyBodyTrackerFB(std::exchange(handle, nullptr)));
}
}
size_t xr::fb_body_tracker::count() const
{
const auto & config = application::get_config();
return get_whitelisted_joints(config.fb_lower_body, config.fb_hip).size();
}
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::fb_body_tracker::locate_spaces(XrTime time, XrSpace reference)
@@ -100,14 +125,8 @@ std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_h
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> poses{};
int num_poses = 0;
for (int i = 0; i < joint_whitelist.size(); i++)
for (auto joint: whitelisted_joints)
{
auto joint = joint_whitelist[i];
if (!full_body && (joint == XR_FULL_BODY_JOINT_HIPS_META || joint >= XR_FULL_BODY_JOINT_LEFT_UPPER_LEG_META))
continue;
if (!hip && joint == XR_FULL_BODY_JOINT_HIPS_META)
continue;
const auto & joint_loc = joints[joint];
wivrn::from_headset::body_tracking::pose pose{
.pose = joint_loc.pose,
+3
View File
@@ -42,6 +42,7 @@ class fb_body_tracker
bool full_body{};
bool hip{};
std::vector<XrFullBodyJointMETA> whitelisted_joints{};
public:
static constexpr std::array joint_whitelist{
@@ -56,6 +57,7 @@ public:
XR_FULL_BODY_JOINT_LEFT_FOOT_TRANSVERSE_META,
XR_FULL_BODY_JOINT_RIGHT_FOOT_TRANSVERSE_META,
};
static std::vector<XrFullBodyJointMETA> get_whitelisted_joints(bool full_body, bool hip);
fb_body_tracker() = default;
fb_body_tracker(instance & inst, session & s);
@@ -63,6 +65,7 @@ public:
void start(bool lower_body, bool hip);
void stop();
size_t count() const;
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> locate_spaces(XrTime time, XrSpace reference);
};
+156
View File
@@ -0,0 +1,156 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Awzri <awzri@awzricat.com>
* Copyright (C) 2025 Sapphire <imsapphire0@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "htc_body_tracker.h"
#include "xr/details/enumerate.h"
#include "xr/htc_exts.h"
#include "xr/xr.h"
#include <openxr/openxr.h>
// Note: This utilizes extensions not present in the OpenXR spec!
// For more info see:
// https://hub.vive.com/apidoc/api/VIVE.OpenXR.Tracker.ViveXRTracker.html
// https://hub.vive.com/apidoc/api/VIVE.OpenXR.VivePathEnumerationHelper.xrEnumeratePathsForInteractionProfileHTCDelegate.html
xr::vive_xr_tracker::vive_xr_tracker(xr::space && space) :
space(std::move(space)) {}
void xr::vive_xr_tracker::set_active(bool active)
{
is_active = active;
}
bool xr::vive_xr_tracker::get_active() const
{
return is_active;
}
XrSpace xr::vive_xr_tracker::get_space() const
{
return space;
}
static wivrn::from_headset::body_tracking::pose locate_space(XrSpace space, XrSpace reference, XrTime time)
{
XrSpaceVelocity velocity{
.type = XR_TYPE_SPACE_VELOCITY,
};
XrSpaceLocation location{
.type = XR_TYPE_SPACE_LOCATION,
.next = &velocity,
};
xrLocateSpace(space, reference, time, &location);
wivrn::from_headset::body_tracking::pose res{
.pose = location.pose,
.flags = 0,
};
if (location.locationFlags & XR_SPACE_LOCATION_ORIENTATION_VALID_BIT)
res.flags |= wivrn::from_headset::body_tracking::orientation_valid;
if (location.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT)
res.flags |= wivrn::from_headset::body_tracking::position_valid;
if (location.locationFlags & XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT)
res.flags |= wivrn::from_headset::body_tracking::orientation_tracked;
if (location.locationFlags & XR_SPACE_LOCATION_POSITION_TRACKED_BIT)
res.flags |= wivrn::from_headset::body_tracking::position_tracked;
return res;
}
std::vector<std::string> xr::htc_body_tracker::get_roles()
{
auto paths = get_paths();
std::vector<std::string> roles{};
roles.reserve(paths.size());
for (auto & path: paths)
{
XrInputSourceLocalizedNameGetInfo get_info{
.type = XR_TYPE_INPUT_SOURCE_LOCALIZED_NAME_GET_INFO,
.next = nullptr,
.sourcePath = path,
.whichComponents = XR_INPUT_SOURCE_LOCALIZED_NAME_USER_PATH_BIT,
};
roles.emplace_back(xr::details::enumerate<char>(xrGetInputSourceLocalizedName, s, &get_info));
}
return roles;
}
xr::htc_body_tracker::htc_body_tracker(instance & inst, session & s) :
inst(&inst),
s(s)
{
xrEnumeratePathsForInteractionProfileHTC = inst.get_proc<PFN_xrEnumeratePathsForInteractionProfileHTC>("xrEnumeratePathsForInteractionProfileHTC");
}
std::vector<XrPath> xr::htc_body_tracker::get_paths(XrPath user_path)
{
assert(xrEnumeratePathsForInteractionProfileHTC);
XrPath tracker_profile = inst->string_to_path("/interaction_profiles/htc/vive_xr_tracker");
XrPathsForInteractionProfileEnumerateInfoHTC profile_info{
.type = XR_TYPE_UNKNOWN,
.next = nullptr,
.interactionProfile = tracker_profile,
.userPath = user_path,
};
return xr::details::enumerate<XrPath>(xrEnumeratePathsForInteractionProfileHTC, *inst, profile_info);
}
void xr::htc_body_tracker::add(xr::space && space)
{
trackers.emplace_back(std::move(space));
}
size_t xr::htc_body_tracker::count() const
{
return trackers.size();
}
void xr::htc_body_tracker::update_active()
{
auto roles = get_roles();
assert(roles.size() >= trackers.size());
for (int i = 0; i < trackers.size(); i++)
trackers[i].set_active(!roles[i].contains('_'));
}
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> xr::htc_body_tracker::locate_spaces(XrTime time, XrSpace reference)
{
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> poses{};
for (int i = 0; i < trackers.size(); i++)
{
auto & tracker = trackers.at(i);
wivrn::from_headset::body_tracking::pose pose{
.pose = {},
.flags = 0,
};
if (tracker.get_active())
pose = locate_space(tracker.get_space(), reference, time);
poses[i] = pose;
}
return poses;
}
+66
View File
@@ -0,0 +1,66 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Awzri <awzri@awzricat.com>
* Copyright (C) 2025 Sapphire <imsapphire0@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "wivrn_packets.h"
#include "xr/htc_exts.h"
#include "xr/space.h"
#include <string>
#include <vector>
#include <openxr/openxr.h>
namespace xr
{
class instance;
class session;
class vive_xr_tracker
{
bool is_active = false;
xr::space space;
public:
vive_xr_tracker(xr::space && s);
void set_active(bool active);
bool get_active() const;
XrSpace get_space() const;
};
class htc_body_tracker
{
instance * inst;
XrSession s;
std::vector<vive_xr_tracker> trackers;
PFN_xrEnumeratePathsForInteractionProfileHTC xrEnumeratePathsForInteractionProfileHTC{};
std::vector<std::string> get_roles();
public:
htc_body_tracker() = default;
htc_body_tracker(instance & inst, session & s);
std::vector<XrPath> get_paths(XrPath user_path = XR_NULL_PATH);
void add(xr::space && space);
size_t count() const;
void update_active();
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> locate_spaces(XrTime time, XrSpace reference);
};
} // namespace xr
+8 -3
View File
@@ -36,6 +36,10 @@ xr::pico_body_tracker::pico_body_tracker(instance & inst, XrBodyTrackerBD h)
xrLocateBodyJointsBD = inst.get_proc<PFN_xrLocateBodyJointsBD>("xrLocateBodyJointsBD");
}
size_t xr::pico_body_tracker::count() const
{
return joint_whitelist.size();
}
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::pico_body_tracker::locate_spaces(XrTime time, XrSpace reference)
{
if (!xrLocateBodyJointsBD)
@@ -63,9 +67,10 @@ std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_h
}
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> poses{};
for (int i = 0; i < joint_whitelist.size(); i++)
int num_poses = 0;
for (auto joint: joint_whitelist)
{
const auto & joint_loc = joints[joint_whitelist[i]];
const auto & joint_loc = joints[joint];
wivrn::from_headset::body_tracking::pose pose{
.pose = joint_loc.pose,
.flags = 0,
@@ -80,7 +85,7 @@ std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_h
if (joint_loc.locationFlags & XR_SPACE_LOCATION_POSITION_TRACKED_BIT)
pose.flags |= wivrn::from_headset::body_tracking::position_tracked;
poses[i] = pose;
poses[num_poses++] = pose;
}
return poses;
}
+1
View File
@@ -50,6 +50,7 @@ public:
pico_body_tracker() = default;
pico_body_tracker(instance & inst, XrBodyTrackerBD h);
size_t count() const;
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> locate_spaces(XrTime time, XrSpace reference);
};
} // namespace xr
+6
View File
@@ -24,6 +24,7 @@
#include "openxr/openxr.h"
#include "utils/contains.h"
#include "xr/fb_body_tracker.h"
#include "xr/htc_body_tracker.h"
#include "xr/instance.h"
#include "xr/pico_body_tracker.h"
#include "xr/system.h"
@@ -149,6 +150,11 @@ xr::fb_body_tracker xr::session::create_fb_body_tracker()
return {*inst, *this};
}
xr::htc_body_tracker xr::session::create_htc_body_tracker()
{
return {*inst, *this};
}
xr::pico_body_tracker xr::session::create_pico_body_tracker()
{
XrBodyTrackerCreateInfoBD create_info{
+2
View File
@@ -29,6 +29,7 @@
#include "fb_body_tracker.h"
#include "fb_face_tracker2.h"
#include "hand_tracker.h"
#include "htc_body_tracker.h"
#include "htc_face_tracker.h"
#include "passthrough.h"
#include "pico_body_tracker.h"
@@ -57,6 +58,7 @@ public:
htc_face_tracker create_htc_face_tracker(XrFacialTrackingTypeHTC);
pico_face_tracker create_pico_face_tracker();
fb_body_tracker create_fb_body_tracker();
htc_body_tracker create_htc_body_tracker();
pico_body_tracker create_pico_body_tracker();
std::vector<vk::Format> get_swapchain_formats() const;
+36
View File
@@ -0,0 +1,36 @@
// clang-format off
#pragma once
#include <openxr/openxr.h>
// XR_HTC_vive_xr_tracker_interaction is a preprocessor guard. Do not pass it to API calls.
#define XR_HTC_vive_xr_tracker_interaction 1
#define XR_HTC_vive_xr_tracker_interaction_SPEC_VERSION 1
#define XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME "XR_HTC_vive_xr_tracker_interaction"
// XR_HTC_path_enumeration is a preprocessor guard. Do not pass it to API calls.
#define XR_HTC_path_enumeration 1
#define XR_HTC_path_enumeration_SPEC_VERSION 1
#define XR_HTC_PATH_ENUMERATION_EXTENSION_NAME "XR_HTC_path_enumeration"
typedef struct XrPathsForInteractionProfileEnumerateInfoHTC {
XrStructureType type;
const void* XR_MAY_ALIAS next;
XrPath interactionProfile;
XrPath userPath;
} XrPathsForInteractionProfileEnumerateInfoHTC;
typedef XrResult (XRAPI_PTR *PFN_xrEnumeratePathsForInteractionProfileHTC)(XrInstance instance, XrPathsForInteractionProfileEnumerateInfoHTC createInfo, uint32_t pathCapacityInput, uint32_t* pathCountOutput, XrPath* paths);
#ifndef XR_NO_PROTOTYPES
#ifdef XR_EXTENSION_PROTOTYPES
XRAPI_ATTR XrResult XRAPI_CALL xrEnumeratePathsForInteractionProfileHTC(
XrInstance instance,
XrPathsForInteractionProfileEnumerateInfoHTC createInfo,
uint32_t pathCapacityInput,
uint32_t* pathCountOutput,
XrPath* paths);
#endif /* XR_EXTENSION_PROTOTYPES */
#endif /* !XR_NO_PROTOTYPES */
// clang-format on
+1 -1
View File
@@ -292,7 +292,7 @@ Kirigami.ApplicationWindow {
Kirigami.Heading {
level: 1
wrapMode: Text.WordWrap
text: i18n("Steam informations")
text: i18n("Steam information")
opacity: root.server_started
Layout.maximumHeight: root.server_started ? -1 : 0
}
+1 -1
View File
@@ -37,7 +37,7 @@
# Keep in sync with CMakeLists.txt monado rev
rev = builtins.readFile ./monado-rev;
# Nix will output the correct hash when it doesn't match
hash = "sha256-Bus9GTNC4+nOSwN8pUsMaFsiXjlpHYioQfBLxbQEF+0=";
hash = "sha256-+PiWxnvMXaSFc+67r17GBRXo7kbjikSElawNMJCydrk=";
};
};
+1 -1
View File
@@ -324,7 +324,7 @@ msgstr "Aplicación"
#: dashboard/qml/Main.qml:295
#, kde-format
msgid "Steam informations"
msgid "Steam information"
msgstr "Información de Steam"
#: dashboard/qml/Main.qml:313
+1 -1
View File
@@ -323,7 +323,7 @@ msgstr "Application"
#: dashboard/qml/Main.qml:295
#, kde-format
msgid "Steam informations"
msgid "Steam information"
msgstr "Informations pour Steam"
#: dashboard/qml/Main.qml:313
+14 -14
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-22 03:31+0900\n"
"POT-Creation-Date: 2025-06-09 19:04+0900\n"
"PO-Revision-Date: 2025-04-10 07:14+0900\n"
"Last-Translator: Mitsuami Megane <hello@mitsua.me>\n"
"Language-Team: Japanese <>\n"
@@ -310,7 +310,7 @@ msgstr "アプリ"
#: dashboard/qml/Main.qml:295
#, kde-format
msgid "Steam informations"
msgid "Steam information"
msgstr "ストリーム情報"
#: dashboard/qml/Main.qml:313
@@ -517,22 +517,22 @@ msgstr "H.265"
msgid "AV1"
msgstr "AV1"
#: dashboard/qml/SettingsPage.qml:320
#: dashboard/qml/SettingsPage.qml:319
#, kde-format
msgid "Advanced options"
msgstr "詳細設定"
#: dashboard/qml/SettingsPage.qml:326
#: dashboard/qml/SettingsPage.qml:325
#, kde-format
msgid "Enable debug window"
msgstr "デバッグ・ウィンドウを表示する"
#: dashboard/qml/SettingsPage.qml:333
#: dashboard/qml/SettingsPage.qml:332
#, kde-format
msgid "Enable SteamVR tracked devices support"
msgstr "SteamVR・ライトハウス・トラッキング"
#: dashboard/qml/SettingsPage.qml:336
#: dashboard/qml/SettingsPage.qml:335
#, kde-format
msgid ""
"Allows the use of lighthouse-based controllers and trackers.\n"
@@ -545,44 +545,44 @@ msgstr ""
"すべてのデバイスの電源が入ってからHMDを接続しましょう。\n"
"キャリブレーションはmotocなどのソフトウェアで行います。"
#: dashboard/qml/SettingsPage.qml:344
#: dashboard/qml/SettingsPage.qml:343
#, kde-format
msgid "Custom adb location"
msgstr "特定なADBの場所"
#: dashboard/qml/SettingsPage.qml:355
#: dashboard/qml/SettingsPage.qml:354
#, kde-format
msgid "Adb location:"
msgstr "ADBの場所:"
#: dashboard/qml/SettingsPage.qml:364
#: dashboard/qml/SettingsPage.qml:363
#, kde-format
msgctxt "browse a file to choose the adb binary"
msgid "Browse"
msgstr "検索する"
#: dashboard/qml/SettingsPage.qml:374
#: dashboard/qml/SettingsPage.qml:373
#, kde-format
msgid "Default"
msgstr "デフォルト"
#: dashboard/qml/SettingsPage.qml:388
#: dashboard/qml/SettingsPage.qml:387
#, kde-format
msgctxt "set a custom OpenVR compatibility library"
msgid "Custom"
msgstr "カスタム"
#: dashboard/qml/SettingsPage.qml:393
#: dashboard/qml/SettingsPage.qml:392
#, kde-format
msgid "Disabled"
msgstr "無し"
#: dashboard/qml/SettingsPage.qml:401
#: dashboard/qml/SettingsPage.qml:400
#, kde-format
msgid "OpenVR compatibility library:"
msgstr "OpenVR実装ライブラリー"
#: dashboard/qml/SettingsPage.qml:427
#: dashboard/qml/SettingsPage.qml:426
#, kde-format
msgid "Library path, excluding bin/linux64/vrclient.so"
msgstr "ライブラリーの場所(bin/linux64/vrclient.so 無し)"
+99 -46
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn 0.16\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-20 17:32+0900\n"
"POT-Creation-Date: 2025-06-09 19:04+0900\n"
"PO-Revision-Date: 2024-06-20 10:33+0900\n"
"Last-Translator: Mitsuami Megane <hello@mitsua.me>\n"
"Language: Japanese\n"
@@ -171,12 +171,12 @@ msgstr "最低リフレッシュレート"
msgid "Resolution scale"
msgstr "解像度"
#: client/scenes/lobby_gui.cpp:666 client/scenes/lobby_gui.cpp:915
#: client/scenes/lobby_gui.cpp:666 client/scenes/lobby_gui.cpp:967
#, c-format, c++-format
msgid "%d%% - {}x{} per eye"
msgstr "%d%% - 目あたり{}x{}"
#: client/scenes/lobby_gui.cpp:677 client/scenes/lobby_gui.cpp:926
#: client/scenes/lobby_gui.cpp:677 client/scenes/lobby_gui.cpp:978
#, c++-format
msgid "Resolution larger than {}x{} may not be supported by the headset"
msgstr ""
@@ -199,7 +199,8 @@ msgid "Enable hand tracking"
msgstr "ハンドトラッキングを有効する"
#: client/scenes/lobby_gui.cpp:713 client/scenes/lobby_gui.cpp:726
#: client/scenes/lobby_gui.cpp:739 client/scenes/lobby_gui.cpp:751
#: client/scenes/lobby_gui.cpp:739 client/scenes/lobby_gui.cpp:756
#: client/scenes/lobby_gui.cpp:803
msgid "This feature is not supported by your headset"
msgstr "デバイスはこの機能をサポートしていません"
@@ -211,45 +212,89 @@ msgstr "アイトラッキングを有効する"
msgid "Enable face tracking"
msgstr "顔トラッキングを有効する"
#: client/scenes/lobby_gui.cpp:744
#: client/scenes/lobby_gui.cpp:746
msgid "Enable body tracking"
msgstr "ボディラッキングを有効する"
#: client/scenes/lobby_gui.cpp:761
msgid ""
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
"tracking settings,\n"
"otherwise body data will be guessed from controller and headset positions"
msgstr ""
"Quest設定・動きのトラッキング・ジェスチャーコントロールとボディトラッキング"
"を有効する必要がある。\n"
"そうでなければ、トラッキングデータはHMDとコントローラーの情報から推測されることになる。"
#: client/scenes/lobby_gui.cpp:763
msgid "Uses the Pico Motion Trackers to track body joint positions"
msgstr "Pico Motion Trackerによるフルボディトラッキング"
#: client/scenes/lobby_gui.cpp:773
msgid "Enable lower body tracking"
msgstr "下半身トラッキングを有効する"
#: client/scenes/lobby_gui.cpp:779
msgid ""
"Estimate lower body joint positions using Generative Legs\n"
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
"tracking settings"
msgstr ""
"下半身に計算された疑似トラッキングを使用する。\n"
"Quest設定・動きのトラッキング・ジェスチャーコントロールとボディトラッキング"
"を有効する必要がある。"
#: client/scenes/lobby_gui.cpp:782
msgid "Enable hip tracking"
msgstr "腰のトラッキングを有効する"
#: client/scenes/lobby_gui.cpp:788
msgid ""
"Only takes affect with lower body tracking enabled\n"
"May be desired when using another source of hip tracking"
msgstr ""
"下半身トラッキングが有効な場合に使用可能。"
"腰トラッカーを持ってる方は無効にしましょう。"
#: client/scenes/lobby_gui.cpp:796
msgid "Enable video passthrough in lobby"
msgstr "ロビーでパススルーを有効する"
#: client/scenes/lobby_gui.cpp:754
#: client/scenes/lobby_gui.cpp:806
msgid "Show performance metrics"
msgstr "パフォーマンスグラフを表示する"
#: client/scenes/lobby_gui.cpp:758
#: client/scenes/lobby_gui.cpp:810
msgid "Overlay can be toggled by pressing both thumbsticks"
msgstr "両方のサムスティックを同時に押すことで切り替え可能"
#: client/scenes/lobby_gui.cpp:788 client/scenes/lobby_gui.cpp:796
#: client/scenes/lobby_gui.cpp:840 client/scenes/lobby_gui.cpp:848
#: client/scenes/stream_stats.cpp:159
msgid "CPU time"
msgstr "CPU使用時間"
#: client/scenes/lobby_gui.cpp:792
#: client/scenes/lobby_gui.cpp:844
msgid "CPU time [ms]"
msgstr "CPU使用時間、ミリ秒"
#: client/scenes/lobby_gui.cpp:802 client/scenes/lobby_gui.cpp:810
#: client/scenes/lobby_gui.cpp:854 client/scenes/lobby_gui.cpp:862
#: client/scenes/stream_stats.cpp:161
msgid "GPU time"
msgstr "GPU使用時間"
#: client/scenes/lobby_gui.cpp:806
#: client/scenes/lobby_gui.cpp:858
msgid "GPU time [ms]"
msgstr "GPU使用時間、ミリ秒"
#: client/scenes/lobby_gui.cpp:825
#: client/scenes/lobby_gui.cpp:877
msgid "OpenXR post-processing"
msgstr "OpenXRポストエフェクト"
#: client/scenes/lobby_gui.cpp:829
#: client/scenes/lobby_gui.cpp:881
msgid "Supersampling"
msgstr "スーパーサンプリング"
#: client/scenes/lobby_gui.cpp:849
#: client/scenes/lobby_gui.cpp:901
msgid ""
"Reduce flicker for high contrast edges.\n"
"Useful when the input resolution is high compared to the headset display"
@@ -257,11 +302,11 @@ msgstr ""
"コントラストが高い部分のギザギザを低減する。\n"
"ストリームの解像度は、HMDの解像度より高い場合は有用です。"
#: client/scenes/lobby_gui.cpp:854
#: client/scenes/lobby_gui.cpp:906
msgid "Sharpening"
msgstr "シャープ"
#: client/scenes/lobby_gui.cpp:874
#: client/scenes/lobby_gui.cpp:926
msgid ""
"Improve clarity of high contrast edges and counteract blur.\n"
"Useful when the input resolution is low compared to the headset display"
@@ -269,115 +314,123 @@ msgstr ""
"ぼかしを低減し、コントラストが高い部分の鮮明度を向上する。\n"
"ストリームの解像度は、HMDの解像度より低い場合に有用です。"
#: client/scenes/lobby_gui.cpp:883
#: client/scenes/lobby_gui.cpp:935
msgid "Enable Snapdragon Game Super Resolution"
msgstr "Snapdragon Game Super Resolutionを有効する"
#: client/scenes/lobby_gui.cpp:891
#: client/scenes/lobby_gui.cpp:943
msgid ""
"On this headset, this setting has been fully superseded by the native "
"Sharpening setting above.\n"
"Only enable if you know what you're doing."
msgstr ""
"この設定は、使用中のHMDでは非推奨です。"
"OpenXRの方法を使用してください。"
"この設定は、使用中のHMDでは非推奨です。OpenXRの方法を使用してください。"
#: client/scenes/lobby_gui.cpp:893
#: client/scenes/lobby_gui.cpp:945
msgid ""
"Client-side upscaling and sharpening, adds a performance cost on the headset"
msgstr ""
"HMD側のアップスケーリングやシャープニングを使用する場合、要求性能が上がります。"
"HMD側のアップスケーリングやシャープニングを使用する場合、要求性能が上がりま"
"す。"
#: client/scenes/lobby_gui.cpp:911
#: client/scenes/lobby_gui.cpp:963
msgid "Upscaling factor"
msgstr "アップスケーリング係数"
#: client/scenes/lobby_gui.cpp:930
#: client/scenes/lobby_gui.cpp:982
msgid "Use edge direction"
msgstr "エッジ方向を使用する"
#: client/scenes/lobby_gui.cpp:936
#: client/scenes/lobby_gui.cpp:988
msgid "Adds an additional performance cost"
msgstr "HMDに対する要求性能が上がります。"
#: client/scenes/lobby_gui.cpp:941
#: client/scenes/lobby_gui.cpp:993
msgid "Edge threshold"
msgstr "エッジのしきい値"
#: client/scenes/lobby_gui.cpp:948 client/scenes/lobby_gui.cpp:957
#: client/scenes/lobby_gui.cpp:1000 client/scenes/lobby_gui.cpp:1009
#, c++-format
msgid "Recommended: {:.1f}"
msgstr "推奨値:{:.1f}"
#: client/scenes/lobby_gui.cpp:951
#: client/scenes/lobby_gui.cpp:1003
msgid "Edge sharpness"
msgstr "エッジのシャープ"
#: client/scenes/lobby_gui.cpp:1045 client/scenes/lobby_gui.cpp:1691
#: client/scenes/lobby_gui.cpp:1097 client/scenes/lobby_gui.cpp:1753
msgid "Licenses"
msgstr "ライセンス"
#: client/scenes/lobby_gui.cpp:1384
#: client/scenes/lobby_gui.cpp:1436
msgid "Microphone is enabled"
msgstr "マイクは有効です"
#: client/scenes/lobby_gui.cpp:1385
#: client/scenes/lobby_gui.cpp:1437
msgid "Microphone is disabled"
msgstr "マイクは無効です"
#: client/scenes/lobby_gui.cpp:1394
#: client/scenes/lobby_gui.cpp:1446
msgid "Hand tracking is enabled"
msgstr "ハンドトラッキングは有効です"
#: client/scenes/lobby_gui.cpp:1395
#: client/scenes/lobby_gui.cpp:1447
msgid "Hand tracking is disabled"
msgstr "ハンドラッキングは無効です"
#: client/scenes/lobby_gui.cpp:1404
#: client/scenes/lobby_gui.cpp:1456
msgid "Eye tracking is enabled"
msgstr "アイトラッキングは有効です"
#: client/scenes/lobby_gui.cpp:1405
#: client/scenes/lobby_gui.cpp:1457
msgid "Eye tracking is disabled"
msgstr "アイトラッキングは無効です"
#: client/scenes/lobby_gui.cpp:1415 client/scenes/lobby_gui.cpp:1426
#: client/scenes/lobby_gui.cpp:1467 client/scenes/lobby_gui.cpp:1478
msgid "Face tracking is enabled"
msgstr "顔トラッキングは有効です"
#: client/scenes/lobby_gui.cpp:1416 client/scenes/lobby_gui.cpp:1427
#: client/scenes/lobby_gui.cpp:1468 client/scenes/lobby_gui.cpp:1479
msgid "Face tracking is disabled"
msgstr "フェーストラッキングは無効です"
#: client/scenes/lobby_gui.cpp:1444
#: client/scenes/lobby_gui.cpp:1489
msgid "Body tracking is enabled"
msgstr "ボディトラッキングは有効です"
#: client/scenes/lobby_gui.cpp:1490
msgid "Body tracking is disabled"
msgstr "ボディトラッキングは無効です"
#: client/scenes/lobby_gui.cpp:1506
msgid "Add server"
msgstr "サーバーを追加する"
#: client/scenes/lobby_gui.cpp:1673
#: client/scenes/lobby_gui.cpp:1735
msgid "Server list"
msgstr "サーバー"
#: client/scenes/lobby_gui.cpp:1676
#: client/scenes/lobby_gui.cpp:1738
msgid "Settings"
msgstr "設定"
#: client/scenes/lobby_gui.cpp:1679
#: client/scenes/lobby_gui.cpp:1741
msgid "Post-processing"
msgstr "ポストエフェクト"
#: client/scenes/lobby_gui.cpp:1683
#: client/scenes/lobby_gui.cpp:1745
msgid "Debug"
msgstr "デバッグ"
#: client/scenes/lobby_gui.cpp:1688
#: client/scenes/lobby_gui.cpp:1750
msgid "About"
msgstr "WiVRnについて"
#: client/scenes/lobby_gui.cpp:1694
#: client/scenes/lobby_gui.cpp:1756
msgid "Exit"
msgstr "完了"
#: client/scenes/lobby_gui.cpp:1708
#: client/scenes/lobby_gui.cpp:1770
msgid ""
"Press A or X or put your palm up\n"
"to move the main window"
@@ -385,7 +438,7 @@ msgstr ""
"ウィンドウを移動するには、手のひらを上に向けるか、\n"
"AまたはBボタンを押しましょう"
#: client/scenes/lobby_gui.cpp:1710
#: client/scenes/lobby_gui.cpp:1772
msgid "Press A or X to move the main window"
msgstr "AまたはXボタンを押してウィンドウを移動"
+1 -1
View File
@@ -322,7 +322,7 @@ msgstr "Aplicação"
#: dashboard/qml/Main.qml:295
#, kde-format
msgid "Steam informations"
msgid "Steam information"
msgstr "Informações da Steam"
#: dashboard/qml/Main.qml:313
+1 -1
View File
@@ -317,7 +317,7 @@ msgstr "應用程式"
#: dashboard/qml/Main.qml:295
#, kde-format
msgid "Steam informations"
msgid "Steam information"
msgstr "Steam 資訊"
#: dashboard/qml/Main.qml:313
+1 -1
View File
@@ -1 +1 @@
2a6932d46dad9aa957205e8a47ec2baa33041076
bb9bcee2a3be75592de819d9e3fb2c8ed27bb7dc
@@ -1,4 +1,4 @@
From 75d2fe061edd2a268ea9f5fbedc90efd8ffea519 Mon Sep 17 00:00:00 2001
From 4c22024929342b69b4a1c7d30334b994ea8c78c1 Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Tue, 22 Oct 2024 15:23:19 +0200
Subject: [PATCH 01/11] c/multi: early wake of compositor
@@ -51,7 +51,7 @@ index 3351defa4..e8f0c8295 100644
{
int64_t predicted_display_time_ns;
diff --git a/src/xrt/compositor/multi/comp_multi_system.c b/src/xrt/compositor/multi/comp_multi_system.c
index b06b03a58..249e07d7d 100644
index a0bd04e08..9d7610d02 100644
--- a/src/xrt/compositor/multi/comp_multi_system.c
+++ b/src/xrt/compositor/multi/comp_multi_system.c
@@ -23,6 +23,8 @@
@@ -93,7 +93,7 @@ index b06b03a58..249e07d7d 100644
}
static void
@@ -525,10 +534,13 @@ multi_main_loop(struct multi_system_compositor *msc)
@@ -526,10 +535,13 @@ multi_main_loop(struct multi_system_compositor *msc)
broadcast_timings_to_clients(msc, predicted_display_time_ns);
// Now we can wait.
@@ -109,7 +109,7 @@ index b06b03a58..249e07d7d 100644
// Now we know the diff, broadcast to pacers.
broadcast_timings_to_pacers(msc, predicted_display_time_ns, predicted_display_period_ns, diff_ns);
@@ -705,6 +717,8 @@ system_compositor_destroy(struct xrt_system_compositor *xsc)
@@ -706,6 +718,8 @@ system_compositor_destroy(struct xrt_system_compositor *xsc)
xrt_comp_native_destroy(&msc->xcn);
os_mutex_destroy(&msc->list_and_timing_lock);
@@ -118,7 +118,7 @@ index b06b03a58..249e07d7d 100644
free(msc);
}
@@ -759,6 +773,8 @@ comp_multi_create_system_compositor(struct xrt_compositor_native *xcn,
@@ -760,6 +774,8 @@ comp_multi_create_system_compositor(struct xrt_compositor_native *xcn,
msc->sessions.state = do_warm_start ? MULTI_SYSTEM_STATE_INIT_WARM_START : MULTI_SYSTEM_STATE_STOPPED;
os_mutex_init(&msc->list_and_timing_lock);
@@ -1,4 +1,4 @@
From 3a8d64c0f569425e2f07b4c2a7803c9bfbc224df Mon Sep 17 00:00:00 2001
From dab0f39ec43bd1eb7d17d3bc32d1a2404cfa3702 Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Tue, 2 Apr 2024 17:14:42 +0200
Subject: [PATCH 02/11] ipc/server: Always listen to stdin
@@ -1,4 +1,4 @@
From 1a8f4aada945314ac852b19ce20c2ed0345f5bb2 Mon Sep 17 00:00:00 2001
From 4abefae5f0c3bfbe959368d2708384e4cb503ef5 Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Tue, 8 Oct 2024 22:13:15 +0200
Subject: [PATCH 03/11] Use extern socket fd
@@ -1,4 +1,4 @@
From 2f38475c9b51f2d2e92f2fd3d51dcef6d7a53e83 Mon Sep 17 00:00:00 2001
From da5a76a27abe3b9b44bc0dd432eb273c89cd4575 Mon Sep 17 00:00:00 2001
From: galister <3123227-galister@users.noreply.gitlab.com>
Date: Mon, 19 Aug 2024 18:51:45 +0900
Subject: [PATCH 04/11] c/render: Add storage usage to distortion mesh
@@ -1,4 +1,4 @@
From 15eec19c226eb78cb9bc7ebd0021ab226402245a Mon Sep 17 00:00:00 2001
From 322b8b36d52afe7f5b57f5785c8b07bc37d315e8 Mon Sep 17 00:00:00 2001
From: galister <85970-galister@users.noreply.gitlab.freedesktop.org>
Date: Sat, 23 Nov 2024 02:42:12 +0900
Subject: [PATCH 05/11] change environment blend mode selection logic
@@ -8,7 +8,7 @@ Subject: [PATCH 05/11] change environment blend mode selection logic
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/xrt/compositor/multi/comp_multi_system.c b/src/xrt/compositor/multi/comp_multi_system.c
index 249e07d7d..12c8fc455 100644
index 9d7610d02..f3131e810 100644
--- a/src/xrt/compositor/multi/comp_multi_system.c
+++ b/src/xrt/compositor/multi/comp_multi_system.c
@@ -232,23 +232,31 @@ find_active_blend_mode(struct multi_compositor **overlay_sorted_clients, size_t
@@ -1,4 +1,4 @@
From 06497b57fc56d48611ffc9b6f1bd431141097174 Mon Sep 17 00:00:00 2001
From 52417118d51d284ab5c0cd3d2c9a93c487b66f5f Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Wed, 11 Sep 2024 22:56:29 +0200
Subject: [PATCH 06/11] Convert to YCbCr in Monado
@@ -1,4 +1,4 @@
From 2be6264cd7091d593cfec71b7952ff2409ceae4d Mon Sep 17 00:00:00 2001
From 40c05c4cae8af77048580a83631aa51b0f48dfec Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Sun, 3 Nov 2024 13:40:00 +0100
Subject: [PATCH 07/11] store alpha channel in layer 1
@@ -1,4 +1,4 @@
From f5f2fafe497c688170e176ee4e47b9d9dce8ab7b Mon Sep 17 00:00:00 2001
From e92fb94901fc652bde712af1e90c14237ea26f8f Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Wed, 19 Feb 2025 10:13:36 +0100
Subject: [PATCH 08/11] st/oxr: bind to dynamic role's profile
@@ -8,10 +8,10 @@ Subject: [PATCH 08/11] st/oxr: bind to dynamic role's profile
1 file changed, 17 insertions(+)
diff --git a/src/xrt/state_trackers/oxr/oxr_binding.c b/src/xrt/state_trackers/oxr/oxr_binding.c
index 07378d7b3..83a7b241d 100644
index ce4c0cca1..8ba94dc55 100644
--- a/src/xrt/state_trackers/oxr/oxr_binding.c
+++ b/src/xrt/state_trackers/oxr/oxr_binding.c
@@ -380,6 +380,23 @@ oxr_find_profile_for_device(struct oxr_logger *log,
@@ -488,6 +488,23 @@ oxr_find_profile_for_device(struct oxr_logger *log,
return;
}
@@ -1,4 +1,4 @@
From a906c4d2bc48306a60cd38ceef7dda9d3c7ab0ab Mon Sep 17 00:00:00 2001
From 685e9804eb0abe3fcd6da67ffbc180db35ca4e1d Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Thu, 27 Feb 2025 22:45:36 +0100
Subject: [PATCH 09/11] c/main: allow custom pacing app factory
@@ -1,4 +1,4 @@
From aab3a63932eafc7781d6ebbcbb3e825beb0ef4de Mon Sep 17 00:00:00 2001
From cbb5662aacc68f28e6628c9fda86a156b08d63a9 Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Sat, 15 Mar 2025 22:19:48 +0100
Subject: [PATCH 10/11] st/oxr: forward 0 refresh rate
@@ -8,7 +8,7 @@ Subject: [PATCH 10/11] st/oxr: forward 0 refresh rate
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/xrt/state_trackers/oxr/oxr_api_session.c b/src/xrt/state_trackers/oxr/oxr_api_session.c
index df8ec96b7..cbc542130 100644
index b3dac8c8a..27d80be9a 100644
--- a/src/xrt/state_trackers/oxr/oxr_api_session.c
+++ b/src/xrt/state_trackers/oxr/oxr_api_session.c
@@ -645,15 +645,11 @@ oxr_xrRequestDisplayRefreshRateFB(XrSession session, float displayRefreshRate)
@@ -1,4 +1,4 @@
From e3efcbec31cfc515be3316d51d9e65bd51f4fe07 Mon Sep 17 00:00:00 2001
From b659d6c6034b8714a014fc6a5819bb2556c6f0bb Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Mon, 2 Jun 2025 14:51:11 +0200
Subject: [PATCH 11/11] Replace distortion with pixel-aligned foveation
+8 -2
View File
@@ -235,6 +235,7 @@ static VkResult create_images(struct wivrn_comp_target * cn, vk::ImageUsageFlags
.usage = VMA_MEMORY_USAGE_AUTO,
});
cn->images[i].handle = image;
cn->wivrn_bundle->name(vk::Image(image), "comp target image");
}
for (uint32_t i = 0; i < cn->image_count; i++)
@@ -269,13 +270,17 @@ static VkResult create_images(struct wivrn_comp_target * cn, vk::ImageUsageFlags
});
cn->images[i].view = VkImageView(*item.image_view_y);
cn->images[i].view_cbcr = VkImageView(*item.image_view_cbcr);
cn->wivrn_bundle->name(item.image_view_y, "comp target image view (y)");
cn->wivrn_bundle->name(item.image_view_cbcr, "comp target image view (CbCr)");
}
cn->psc.fence = vk::raii::Fence(device, vk::FenceCreateInfo{.flags = vk::FenceCreateFlagBits::eSignaled});
cn->wivrn_bundle->name(cn->psc.fence, "comp target fence");
cn->psc.command_buffer = std::move(device.allocateCommandBuffers(
{.commandPool = *cn->command_pool,
.commandBufferCount = 1})[0]);
cn->wivrn_bundle->name(cn->psc.command_buffer, "comp target command buffer");
return VK_SUCCESS;
}
@@ -300,6 +305,7 @@ static bool comp_wivrn_init_post_vulkan(struct comp_target * ct, uint32_t prefer
.flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer,
.queueFamilyIndex = vk->queue_family_index,
});
cn->wivrn_bundle->name(cn->command_pool, "comp target command pool");
}
catch (std::exception & e)
{
@@ -792,8 +798,8 @@ wivrn_comp_target::~wivrn_comp_target()
static void comp_wivrn_destroy(struct comp_target * ct)
{
auto cn = (struct wivrn_comp_target *)ct;
destroy_images(cn);
cn->self = nullptr;
cn->cnx.unset_comp_target();
delete cn;
}
static void comp_wivrn_info_gpu(struct comp_target * ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
-1
View File
@@ -78,7 +78,6 @@ struct pseudo_swapchain
struct wivrn_comp_target : public comp_target
{
std::shared_ptr<wivrn_comp_target> self;
to_headset::video_stream_description desc{};
wivrn_pacer pacer;
+8 -5
View File
@@ -540,9 +540,11 @@ wivrn_controller::wivrn_controller(int hand_id,
.binding_profile_count = std::size(wivrn_binding_profiles),
.binding_profiles = wivrn_binding_profiles,
.input_count = WIVRN_CONTROLLER_INPUT_COUNT,
.orientation_tracking_supported = true,
.position_tracking_supported = true,
.hand_tracking_supported = cnx->get_info().hand_tracking,
.supported = {
.orientation_tracking = true,
.position_tracking = true,
.hand_tracking = cnx->get_info().hand_tracking,
},
.update_inputs = method_pointer<&wivrn_controller::update_inputs>,
.get_tracked_pose = method_pointer<&wivrn_controller::get_tracked_pose>,
.get_hand_tracking = method_pointer<&wivrn_controller::get_hand_tracking>,
@@ -767,7 +769,7 @@ xrt_result_t wivrn_controller::get_tracked_pose(xrt_input_name name, int64_t at_
return XRT_SUCCESS;
}
void wivrn_controller::get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns)
xrt_result_t wivrn_controller::get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns)
{
switch (name)
{
@@ -778,12 +780,13 @@ void wivrn_controller::get_hand_tracking(xrt_input_name name, int64_t desired_ti
std::tie(extrapolation_time, *out_value) = joints.get_at(desired_timestamp_ns);
cnx->add_predict_offset(extrapolation_time);
cnx->set_enabled(joints.hand_id == 0 ? to_headset::tracking_control::id::left_hand : to_headset::tracking_control::id::right_hand, true);
return;
return XRT_SUCCESS;
}
default:
U_LOG_W("Unknown input name requested %d", int(name));
}
return XRT_ERROR_INPUT_UNSUPPORTED;
}
void wivrn_controller::set_derived_pose(const from_headset::derived_pose & derived)
+1 -1
View File
@@ -53,7 +53,7 @@ public:
xrt_result_t update_inputs();
xrt_result_t get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns, xrt_space_relation * out_relation);
void get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns);
xrt_result_t get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns);
void set_output(xrt_output_name name, const xrt_output_value * value);
+20 -21
View File
@@ -52,28 +52,27 @@ static xrt_result_t wivrn_eye_tracker_get_tracked_pose(xrt_device * xdev,
}
wivrn_eye_tracker::wivrn_eye_tracker(xrt_device * hmd) :
xrt_device{}, gaze(device_id::EYE_GAZE)
xrt_device{
.name = XRT_DEVICE_EYE_GAZE_INTERACTION,
.device_type = XRT_DEVICE_TYPE_EYE_TRACKER,
.str = "WiVRn Eye Tracker",
.serial = "WiVRn Eye Tracker",
.tracking_origin = hmd->tracking_origin,
.input_count = 1,
.inputs = &gaze_input,
.supported = {
.eye_gaze = true,
},
.update_inputs = wivrn_eye_tracker_update_inputs,
.get_tracked_pose = wivrn_eye_tracker_get_tracked_pose,
.destroy = wivrn_eye_tracker_destroy,
},
gaze_input{
.active = true,
.name = XRT_INPUT_GENERIC_EYE_GAZE_POSE,
},
gaze(device_id::EYE_GAZE)
{
xrt_device * base = this;
base->tracking_origin = hmd->tracking_origin;
base->update_inputs = wivrn_eye_tracker_update_inputs;
base->get_tracked_pose = wivrn_eye_tracker_get_tracked_pose;
base->destroy = wivrn_eye_tracker_destroy;
name = XRT_DEVICE_EYE_GAZE_INTERACTION;
device_type = XRT_DEVICE_TYPE_EYE_TRACKER;
eye_gaze_supported = true;
// Print name.
strcpy(str, "WiVRn Eye Tracker");
strcpy(serial, "WiVRn Eye Tracker");
gaze_input.active = true;
gaze_input.name = XRT_INPUT_GENERIC_EYE_GAZE_POSE;
// Setup input.
inputs = &gaze_input;
input_count = 1;
}
void wivrn_eye_tracker::update_inputs()
+9 -6
View File
@@ -45,18 +45,21 @@ wivrn_fb_face2_tracker::wivrn_fb_face2_tracker(xrt_device * hmd,
.str = "WiVRn FB v2 Face Tracker",
.serial = "WiVRn FB v2 Face Tracker",
.tracking_origin = hmd->tracking_origin,
.face_tracking_supported = true,
.input_count = 1,
.inputs = &face_input,
.supported = {
.face_tracking = true,
},
.update_inputs = method_pointer<&wivrn_fb_face2_tracker::update_inputs>,
.get_face_tracking = method_pointer<&wivrn_fb_face2_tracker::get_face_tracking>,
.destroy = [](xrt_device *) {},
},
face_input{
.active = true,
.name = XRT_INPUT_FB_FACE_TRACKING2_VISUAL,
},
cnx(cnx)
{
// Setup input.
face_input.name = XRT_INPUT_FB_FACE_TRACKING2_VISUAL;
face_input.active = true;
inputs = &face_input;
input_count = 1;
}
xrt_result_t wivrn_fb_face2_tracker::update_inputs()
+10 -6
View File
@@ -233,9 +233,7 @@ void wivrn_foveation::compute_params(
auto angle_x = convergence_angle(views[i].pose.position.x, e.x);
tan_center[i].x = angles_to_center(view.x + angle_x, views[i].fov.angleLeft, views[i].fov.angleRight);
auto offset_y = (views[i].fov.angleDown + views[i].fov.angleUp) / 2;
tan_center[i].y = angles_to_center(-view.y - e.y, views[i].fov.angleUp, views[i].fov.angleDown) + offset_y;
tan_center[i].y = angles_to_center(-view.y - e.y, views[i].fov.angleUp, views[i].fov.angleDown);
}
}
@@ -247,7 +245,10 @@ void wivrn_foveation::compute_params(
else
params[i].x = {uint16_t(src[i].extent.w)};
if (foveated_height < src[i].extent.h)
fill_param_2d(tan_center[i].y, foveated_height, src[i].extent.h, params[i].y);
{
auto offset_y = (views[i].fov.angleDown + views[i].fov.angleUp) / 2;
fill_param_2d(tan_center[i].y + offset_y, foveated_height, src[i].extent.h, params[i].y);
}
else
params[i].y = {uint16_t(src[i].extent.h)};
}
@@ -258,7 +259,7 @@ wivrn_foveation::wivrn_foveation(wivrn_vk_bundle & bundle, const xrt_hmd_parts &
foveated_height(hmd.screens[0].h_pixels),
command_pool(bundle.device, vk::CommandPoolCreateInfo{.queueFamilyIndex = bundle.queue_family_index}),
cmd(std::move(bundle.device.allocateCommandBuffers({
.commandPool = command_pool,
.commandPool = *command_pool,
.commandBufferCount = 1,
})[0])),
host_buffer(
@@ -272,6 +273,9 @@ wivrn_foveation::wivrn_foveation(wivrn_vk_bundle & bundle, const xrt_hmd_parts &
.usage = VMA_MEMORY_USAGE_AUTO,
})
{
bundle.name(command_pool, "foveation command pool");
bundle.name(cmd, "foveation command buffer");
bundle.name(vk::Buffer(host_buffer), "foveation staging buffer");
}
void wivrn_foveation::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset)
@@ -404,6 +408,6 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
fill_ubo(ubo->x + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, params[view].x, false, source[view].offset.w, source[view].extent.w, foveated_width);
fill_ubo(ubo->y + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, params[view].y, flip_y, source[view].offset.h, source[view].extent.h, foveated_height);
}
return cmd;
return *cmd;
}
} // namespace wivrn
+5 -3
View File
@@ -113,8 +113,10 @@ wivrn_generic_tracker::wivrn_generic_tracker(int index, xrt_device * hmd, wivrn_
.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER,
.hmd = nullptr,
.tracking_origin = hmd->tracking_origin,
.orientation_tracking_supported = true,
.position_tracking_supported = true,
.supported = {
.orientation_tracking = true,
.position_tracking = true,
},
.update_inputs = method_pointer<&wivrn_generic_tracker::update_inputs>,
.get_tracked_pose = method_pointer<&wivrn_generic_tracker::get_tracked_pose>,
.destroy = [](xrt_device *) {},
@@ -173,4 +175,4 @@ void wivrn_generic_tracker::update_tracking(const from_headset::body_tracking &
if (!poses.update_tracking(tracking.production_timestamp, tracking.timestamp, pose, offset))
cnx.set_tracker_enabled(index, false);
}
} // namespace wivrn
} // namespace wivrn
+12 -9
View File
@@ -73,9 +73,11 @@ wivrn_hmd::wivrn_hmd(wivrn::wivrn_session * cnx,
.tracking_origin = &tracking_origin,
.input_count = 1,
.inputs = &pose_input,
.orientation_tracking_supported = true,
.position_tracking_supported = true,
.battery_status_supported = true,
.supported = {
.orientation_tracking = true,
.position_tracking = true,
.battery_status = true,
},
.update_inputs = [](xrt_device *) { return XRT_SUCCESS; },
.get_tracked_pose = method_pointer<&wivrn_hmd::get_tracked_pose>,
.get_view_poses = method_pointer<&wivrn_hmd::get_view_poses>,
@@ -145,12 +147,12 @@ void wivrn_hmd::update_battery(const from_headset::battery & new_battery)
battery = new_battery;
}
void wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
int64_t at_timestamp_ns,
uint32_t view_count,
xrt_space_relation * out_head_relation,
xrt_fov * out_fovs,
xrt_pose * out_poses)
xrt_result_t wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
int64_t at_timestamp_ns,
uint32_t view_count,
xrt_space_relation * out_head_relation,
xrt_fov * out_fovs,
xrt_pose * out_poses)
{
auto [extrapolation_time, view] = views.get_at(at_timestamp_ns);
cnx->add_predict_offset(extrapolation_time);
@@ -178,6 +180,7 @@ void wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
out_fovs[eye] = view.fovs[eye];
out_poses[eye] = view.poses[eye];
}
return XRT_SUCCESS;
}
xrt_result_t wivrn_hmd::get_battery_status(bool * out_present,
+6 -6
View File
@@ -69,12 +69,12 @@ public:
void set_foveated_size(uint32_t width, uint32_t height);
xrt_result_t get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns, xrt_space_relation *);
void get_view_poses(const xrt_vec3 * default_eye_relation,
int64_t at_timestamp_ns,
uint32_t view_count,
xrt_space_relation * out_head_relation,
xrt_fov * out_fovs,
xrt_pose * out_poses);
xrt_result_t get_view_poses(const xrt_vec3 * default_eye_relation,
int64_t at_timestamp_ns,
uint32_t view_count,
xrt_space_relation * out_head_relation,
xrt_fov * out_fovs,
xrt_pose * out_poses);
xrt_result_t get_battery_status(bool * out_present,
bool * out_charging,
float * out_charge);
+15 -8
View File
@@ -45,20 +45,27 @@ wivrn_htc_face_tracker::wivrn_htc_face_tracker(xrt_device * hmd,
.str = "WiVRn HTC Face Tracker",
.serial = "WiVRn HTC Face Tracker",
.tracking_origin = hmd->tracking_origin,
.face_tracking_supported = true,
.supported = {
.face_tracking = true,
},
.update_inputs = method_pointer<&wivrn_htc_face_tracker::update_inputs>,
.get_face_tracking = method_pointer<&wivrn_htc_face_tracker::get_face_tracking>,
.destroy = [](xrt_device *) {},
},
inputs_array{
{
{
.active = true,
.name = XRT_INPUT_HTC_EYE_FACE_TRACKING,
},
{
.active = true,
.name = XRT_INPUT_HTC_LIP_FACE_TRACKING,
},
},
},
cnx(cnx)
{
// Setup input.
inputs_array[0].name = XRT_INPUT_HTC_EYE_FACE_TRACKING;
inputs_array[0].active = true;
inputs_array[1].name = XRT_INPUT_HTC_LIP_FACE_TRACKING;
inputs_array[1].active = true;
inputs = inputs_array.data();
input_count = inputs_array.size();
}
+46 -14
View File
@@ -89,9 +89,8 @@ struct wivrn_comp_target_factory : public comp_target_factory
static bool create_target(const struct comp_target_factory * ctf, struct comp_compositor * c, struct comp_target ** out_ct)
{
auto self = (wivrn_comp_target_factory *)ctf;
self->session.comp_target = std::make_shared<wivrn_comp_target>(self->session, c);
self->session.comp_target->self = self->session.comp_target;
*out_ct = self->session.comp_target.get();
self->session.comp_target = new wivrn_comp_target(self->session, c);
*out_ct = self->session.comp_target;
return true;
}
};
@@ -169,7 +168,7 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
static_roles.head = xdevs[xdev_count++] = &hmd;
if (hmd.face_tracking_supported)
if (hmd.supported.face_tracking)
static_roles.face = &hmd;
roles.left = xdev_count;
@@ -231,6 +230,12 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
{
U_LOG_I("Creating %d generic trackers", num_generic_trackers);
if (num_generic_trackers > generic_trackers.size())
throw std::out_of_range(
std::format("{} generic trackers is larger than maximum {}",
num_generic_trackers,
generic_trackers.size()));
for (int i = 0; i < num_generic_trackers; ++i)
{
auto dev = std::make_unique<wivrn_generic_tracker>(i, &hmd, *this);
@@ -338,6 +343,12 @@ bool wivrn_session::connected()
return connection->is_active();
}
void wivrn_session::unset_comp_target()
{
std::lock_guard lock(comp_target_mutex);
comp_target = nullptr;
}
void wivrn_session::operator()(from_headset::headset_info_packet &&)
{
U_LOG_W("unexpected headset info packet, ignoring");
@@ -431,9 +442,11 @@ void wivrn_session::operator()(const from_headset::tracking & tracking)
right_hand.update_tracking(tracking, offset);
if (eye_tracker)
eye_tracker->update_tracking(tracking, offset);
assert(comp_target);
assert(comp_target->foveation);
comp_target->foveation->update_tracking(tracking, offset);
{
std::shared_lock lock(comp_target_mutex);
if (comp_target)
comp_target->foveation->update_tracking(tracking, offset);
}
if (fb_face2_tracker)
fb_face2_tracker->update_tracking(tracking, offset);
@@ -524,11 +537,14 @@ void wivrn_session::set_tracker_enabled(int index, bool enabled)
void wivrn_session::operator()(from_headset::feedback && feedback)
{
assert(comp_target);
clock_offset o = offset_est.get_offset();
if (not o)
return;
comp_target->on_feedback(feedback, o);
{
std::shared_lock lock(comp_target_mutex);
if (comp_target)
comp_target->on_feedback(feedback, o);
}
if (feedback.received_first_packet)
dump_time("receive_begin", feedback.frame_index, o.from_headset(feedback.received_first_packet), feedback.stream_index);
@@ -563,7 +579,11 @@ void wivrn_session::operator()(from_headset::visibility_mask_changed && mask)
void wivrn_session::operator()(from_headset::refresh_rate_changed && event)
{
comp_target->set_refresh_rate(event.to);
{
std::shared_lock lock(comp_target_mutex);
if (comp_target)
comp_target->set_refresh_rate(event.to);
}
push_event(
{
.display = {
@@ -587,7 +607,9 @@ void wivrn_session::operator()(to_monado::disconnect &&)
void wivrn_session::operator()(to_monado::set_bitrate && data)
{
comp_target->set_bitrate(data.bitrate_bps);
std::shared_lock lock(comp_target_mutex);
if (comp_target)
comp_target->set_bitrate(data.bitrate_bps);
}
struct refresh_rate_adjuster
@@ -647,8 +669,14 @@ void wivrn_session::run(std::stop_token stop)
{
offset_est.request_sample(*connection);
tracking_control.send(*connection);
if (comp_target->requested_refresh_rate == 0)
refresh.adjust(*connection);
{
std::shared_lock lock(comp_target_mutex);
if (comp_target)
{
if (comp_target->requested_refresh_rate == 0)
refresh.adjust(*connection);
}
}
connection->poll(*this, 20);
}
catch (const std::exception & e)
@@ -725,7 +753,11 @@ void wivrn_session::reconnect()
// const auto & info = connection->info();
// FIXME: ensure new client is compatible
comp_target->reset_encoders();
{
std::shared_lock lock(comp_target_mutex);
if (comp_target)
comp_target->reset_encoders();
}
if (audio_handle)
send_control(audio_handle->description());
+6 -2
View File
@@ -32,8 +32,8 @@
#include <fstream>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <thread>
#include <vector>
struct u_system;
struct xrt_space_overseer;
@@ -113,7 +113,9 @@ class wivrn_session : public xrt_system_devices
uint32_t num_generic_trackers;
std::array<std::unique_ptr<wivrn_generic_tracker>, from_headset::body_tracking::max_tracked_poses> generic_trackers;
std::array<bool, from_headset::body_tracking::max_tracked_poses> enabled_trackers;
std::shared_ptr<wivrn_comp_target> comp_target;
std::shared_mutex comp_target_mutex;
wivrn_comp_target * comp_target;
clock_offset_estimator offset_est;
@@ -146,6 +148,8 @@ public:
return connection->info();
};
void unset_comp_target();
wivrn_hmd & get_hmd()
{
return hmd;
@@ -311,6 +311,7 @@ video_encoder_va::video_encoder_va(wivrn_vk_bundle & vk,
auto & image = (i == 0 ? luma : chroma);
image = vk.device.createImage(image_create_info.get());
vk.name(image, i == 0 ? "va encoder luma image" : "va encoder chroma image");
auto [req, ded_req] = vk.device.getImageMemoryRequirements2<vk::MemoryRequirements2, vk::MemoryDedicatedRequirements>({.image = *image});
@@ -336,6 +337,7 @@ video_encoder_va::video_encoder_va(wivrn_vk_bundle & vk,
try
{
mem.emplace_back(vk.device, alloc_info.get());
vk.name(mem.back(), "va encoder memory");
}
catch (...)
{
+7 -5
View File
@@ -60,7 +60,7 @@ video_encoder::sender::sender() :
}
if (d and not d->span.empty())
{
d->encoder->SendData(d->span, true);
d->encoder->SendData(d->span, true, d->prefer_control);
std::unique_lock lock(mutex);
pending.pop_front();
cv.notify_all();
@@ -314,7 +314,7 @@ void video_encoder::encode(wivrn_session & cnx,
std::rethrow_exception(ex);
}
void video_encoder::SendData(std::span<uint8_t> data, bool end_of_frame)
void video_encoder::SendData(std::span<uint8_t> data, bool end_of_frame, bool control)
{
std::lock_guard lock(mutex);
if (end_of_frame)
@@ -336,8 +336,7 @@ void video_encoder::SendData(std::span<uint8_t> data, bool end_of_frame)
auto end = data.end();
while (begin != end)
{
const size_t view_info_size = sizeof(to_headset::video_stream_data_shard::view_info_t);
const size_t max_payload_size = to_headset::video_stream_data_shard::max_payload_size - (shard.view_info ? view_info_size : 0);
const size_t max_payload_size = to_headset::video_stream_data_shard::max_payload_size - serialized_size(shard.view_info);
auto next = std::min(end, begin + max_payload_size);
if (next == end)
{
@@ -351,7 +350,10 @@ void video_encoder::SendData(std::span<uint8_t> data, bool end_of_frame)
shard.payload = {begin, next};
try
{
cnx->send_stream(to_headset::video_stream_data_shard{shard});
if (control)
cnx->send_control(to_headset::video_stream_data_shard{shard});
else
cnx->send_stream(to_headset::video_stream_data_shard{shard});
}
catch (...)
{
+3 -1
View File
@@ -53,6 +53,8 @@ protected:
video_encoder * encoder;
std::span<uint8_t> span;
std::shared_ptr<void> mem;
// true if data should be sent over reliable (TCP) socket
bool prefer_control = false;
};
private:
@@ -140,7 +142,7 @@ public:
// called when command buffer finished executing
virtual std::optional<data> encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot) = 0;
void SendData(std::span<uint8_t> data, bool end_of_frame);
void SendData(std::span<uint8_t> data, bool end_of_frame, bool control = false);
};
} // namespace wivrn
+2
View File
@@ -248,6 +248,7 @@ video_encoder_nvenc::video_encoder_nvenc(
for (auto & i: in)
{
i.yuv = vk::raii::Buffer(vk.device, buffer_create_info.get());
vk.name(i.yuv, "nvenc yuv buffer");
auto memory_req = i.yuv.getMemoryRequirements();
vk::StructureChain mem_info{
@@ -263,6 +264,7 @@ video_encoder_nvenc::video_encoder_nvenc(
},
};
i.mem = vk.device.allocateMemory(mem_info.get());
vk.name(i.mem, "nvenc memory");
i.yuv.bindMemory(*i.mem, 0);
int fd = vk.device.getMemoryFdKHR({
+44 -24
View File
@@ -55,15 +55,26 @@ vk::VideoFormatPropertiesKHR wivrn::video_encoder_vulkan::select_video_format(
wivrn::video_encoder_vulkan::video_encoder_vulkan(
wivrn_vk_bundle & vk,
vk::Rect2D rect,
vk::VideoEncodeCapabilitiesKHR in_encode_caps,
const vk::VideoCapabilitiesKHR & video_caps,
const vk::VideoEncodeCapabilitiesKHR & in_encode_caps,
float fps,
uint8_t stream_idx,
const encoder_settings & settings) :
video_encoder(stream_idx, settings.channels, settings.bitrate_multiplier, true), vk(vk), encode_caps(patch_capabilities(in_encode_caps)), rect(rect)
video_encoder(stream_idx, settings.channels, settings.bitrate_multiplier, true),
vk(vk),
encode_caps(patch_capabilities(in_encode_caps)),
rect(rect),
num_dpb_slots(std::min(video_caps.maxDpbSlots, 16u))
{
// Initialize Rate control
U_LOG_D("Supported rate control modes: %s", vk::to_string(encode_caps.rateControlModes).c_str());
U_LOG_D("video caps:\n"
"\t maxDpbSlots: %d\n"
"\t maxActiveReferencePictures: %d",
video_caps.maxDpbSlots,
video_caps.maxActiveReferencePictures);
if (encode_caps.rateControlModes & (vk::VideoEncodeRateControlModeFlagBitsKHR::eCbr | vk::VideoEncodeRateControlModeFlagBitsKHR::eVbr))
{
U_LOG_D("Maximum bitrate: %" PRIu64, encode_caps.maxBitrate / 1'000'000);
@@ -164,6 +175,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
{
.usage = VMA_MEMORY_USAGE_AUTO,
});
vk.name(vk::Image(dpb_image), "vulkan encoder DPB image");
}
// Output buffer
@@ -182,6 +194,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
});
vk.name(vk::Buffer(item.output_buffer), "vulkan encode output buffer");
if (not(item.output_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
{
@@ -194,6 +207,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
});
vk.name(vk::Buffer(item.host_buffer), "vulkan encode host buffer");
}
}
@@ -211,7 +225,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
.maxCodedExtent = rect.extent,
.referencePictureFormat = reference_picture_format.format,
.maxDpbSlots = num_dpb_slots,
.maxActiveReferencePictures = uint32_t(num_dpb_slots - 1),
.maxActiveReferencePictures = 2,
.pStdHeaderVersion = &std_header_version,
});
@@ -277,8 +291,10 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
{
.usage = VMA_MEMORY_USAGE_AUTO,
});
vk.name(vk::Image(slot_data[i].tmp_image), "vulkan encoder temporary image");
image_view_template.image = vk::Image(slot_data[i].tmp_image);
slot_data[i].view = vk.device.createImageView(image_view_template);
vk.name(slot_data[i].view, "vulkan encoder temporary image view");
}
}
@@ -316,6 +332,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
.image_view = vk.device.createImageView(img_view_create_info),
.info = dpb_info[i],
});
vk.name(dpb.back().image_view, "vulkan encoder dpb view");
}
}
@@ -343,6 +360,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
{
item.fence = vk.device.createFence({.flags = vk::FenceCreateFlagBits::eSignaled});
item.wait_sem = vk.device.createSemaphore({});
vk.name(item.fence, "vulkan encoder fence");
vk.name(item.fence, "vulkan encoder semaphore");
}
// query pool
@@ -362,6 +381,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
};
query_pool = vk.device.createQueryPool(query_pool_create.get());
vk.name(query_pool, "vulkan encoder query pool");
}
// command pools
@@ -371,13 +391,17 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
.flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer,
.queueFamilyIndex = vk.encode_queue_family_index,
});
vk.name(query_pool, "vulkan encoder video command pool");
auto command_buffers = vk.device.allocateCommandBuffers(
{.commandPool = *video_command_pool,
.commandBufferCount = num_slots});
for (size_t i = 0; i < num_slots; ++i)
{
slot_data[i].video_cmd_buf = std::move(command_buffers[i]);
vk.name(slot_data[i].video_cmd_buf, "vulkan encoder video command buffer");
}
auto properties = vk.physical_device.getQueueFamilyProperties().at(vk.encode_queue_family_index);
if (not(properties.queueFlags & vk::QueueFlagBits::eTransfer))
@@ -387,6 +411,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
.flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer,
.queueFamilyIndex = vk.queue_family_index,
});
vk.name(transfer_command_pool, "vulkan encoder transfer command pool");
auto command_buffers = vk.device.allocateCommandBuffers(
{.commandPool = *transfer_command_pool,
@@ -395,6 +420,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
{
slot_data[i].sem = vk.device.createSemaphore({});
slot_data[i].transfer_cmd_buf = std::move(command_buffers[i]);
vk.name(slot_data[i].sem, "vulkan encoder transfer semaphore");
vk.name(slot_data[i].transfer_cmd_buf, "vulkan encoder transfer command buffer");
}
}
}
@@ -415,9 +442,11 @@ std::vector<uint8_t> wivrn::video_encoder_vulkan::get_encoded_parameters(void *
std::optional<wivrn::video_encoder::data> wivrn::video_encoder_vulkan::encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t encode_slot)
{
if (idr)
send_idr_data();
// we manage idrs ourselves
(void)idr;
auto & slot_item = slot_data[encode_slot];
if (slot_item.idr)
send_idr_data();
if (auto res = vk.device.waitForFences(*slot_item.fence, true, 1'000'000'000);
res != vk::Result::eSuccess)
@@ -437,6 +466,7 @@ std::optional<wivrn::video_encoder::data> wivrn::video_encoder_vulkan::encode(bo
return data{
.encoder = this,
.span = std::span(((uint8_t *)mapped) + feedback[0], feedback[1]),
.prefer_control = slot_item.idr,
};
}
@@ -610,31 +640,15 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
auto last_ack = this->last_ack.load();
dpb_item * ref_slot = nullptr;
for (size_t i = 0; i < dpb.size(); ++i)
for (auto & i: dpb)
{
if (dpb[i].frame_index == last_ack and dpb[i].info.slotIndex != -1)
if (i.frame_index == last_ack and i.info.slotIndex != -1)
{
ref_slot = &dpb[i];
ref_slot = &i;
break;
}
}
// Avoid sending many IDR in a row
if (frame_num < 100 and not ref_slot)
{
for (size_t i = 0; i < dpb.size(); ++i)
{
if (dpb[i].info.slotIndex != -1)
{
if (not ref_slot or ref_slot->frame_index < dpb[i].frame_index)
{
ref_slot = &dpb[i];
break;
}
}
}
}
if (not ref_slot)
{
frame_num = 0;
@@ -644,6 +658,12 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
slot.info.pPictureResource = nullptr;
slot.frame_index = -1;
}
slot_item.idr = true;
last_ack = frame_index;
}
else
{
slot_item.idr = false;
}
slot->frame_index = frame_index;
slot->info.pPictureResource = &slot->resource;
+4 -2
View File
@@ -52,6 +52,7 @@ class video_encoder_vulkan : public video_encoder
vk::raii::ImageView view = nullptr;
buffer_allocation output_buffer;
buffer_allocation host_buffer;
bool idr = false;
};
std::array<slot_item, num_slots> slot_data;
@@ -82,12 +83,13 @@ class video_encoder_vulkan : public video_encoder
vk::VideoEncodeRateControlLayerInfoKHR rate_control_layer;
protected:
const uint8_t num_dpb_slots = 16;
const uint8_t num_dpb_slots;
std::optional<vk::VideoEncodeRateControlInfoKHR> rate_control;
video_encoder_vulkan(wivrn_vk_bundle & vk,
vk::Rect2D rect,
vk::VideoEncodeCapabilitiesKHR encode_caps,
const vk::VideoCapabilitiesKHR & video_caps,
const vk::VideoEncodeCapabilitiesKHR & encode_caps,
float fps,
uint8_t stream_idx,
const encoder_settings & settings);
+5 -4
View File
@@ -71,11 +71,12 @@ static StdVideoH264LevelIdc compute_level(const StdVideoH264SequenceParameterSet
wivrn::video_encoder_vulkan_h264::video_encoder_vulkan_h264(
wivrn_vk_bundle & vk,
vk::Rect2D rect,
vk::VideoEncodeCapabilitiesKHR encode_caps,
const vk::VideoCapabilitiesKHR & video_caps,
const vk::VideoEncodeCapabilitiesKHR & encode_caps,
float fps,
uint8_t stream_idx,
const encoder_settings & settings) :
video_encoder_vulkan(vk, rect, encode_caps, fps, stream_idx, settings),
video_encoder_vulkan(vk, rect, video_caps, encode_caps, fps, stream_idx, settings),
sps{
.flags =
{
@@ -191,7 +192,7 @@ std::unique_ptr<wivrn::video_encoder_vulkan_h264> wivrn::video_encoder_vulkan_h2
vk::VideoEncodeCapabilitiesKHR,
vk::VideoEncodeH264CapabilitiesKHR>(video_profile_info.get());
std::unique_ptr<video_encoder_vulkan_h264> self(new video_encoder_vulkan_h264(vk, rect, encode_caps, fps, stream_idx, settings));
std::unique_ptr<video_encoder_vulkan_h264> self(new video_encoder_vulkan_h264(vk, rect, video_caps, encode_caps, fps, stream_idx, settings));
vk::VideoEncodeH264SessionParametersAddInfoKHR h264_add_info{};
h264_add_info.setStdSPSs(self->sps);
@@ -240,7 +241,7 @@ std::vector<uint8_t> wivrn::video_encoder_vulkan_h264::get_sps_pps()
void wivrn::video_encoder_vulkan_h264::send_idr_data()
{
auto data = get_sps_pps();
SendData(data, false);
SendData(data, false, true);
}
void * wivrn::video_encoder_vulkan_h264::encode_info_next(uint32_t frame_num, size_t slot, std::optional<int32_t> ref_slot)
+2 -1
View File
@@ -49,7 +49,8 @@ class video_encoder_vulkan_h264 : public video_encoder_vulkan
video_encoder_vulkan_h264(wivrn_vk_bundle & vk,
vk::Rect2D rect,
vk::VideoEncodeCapabilitiesKHR encode_caps,
const vk::VideoCapabilitiesKHR & video_caps,
const vk::VideoEncodeCapabilitiesKHR & encode_caps,
float fps,
uint8_t stream_idx,
const encoder_settings & settings);
+2
View File
@@ -175,6 +175,8 @@ video_encoder_x264::video_encoder_x264(
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
});
vk.name(vk::Buffer(i.luma), "x264 luma buffer");
vk.name(vk::Buffer(i.chroma), "x264 chroma buffer");
auto & pic = i.pic;
x264_picture_init(&pic);
+11
View File
@@ -224,3 +224,14 @@ uint32_t wivrn::wivrn_vk_bundle::get_memory_type(uint32_t type_bits, vk::MemoryP
}
throw std::runtime_error("Failed to get memory type");
}
void wivrn::wivrn_vk_bundle::name(vk::ObjectType type, uint64_t handle, const char * value)
{
if (not vk.has_EXT_debug_utils)
return;
device.setDebugUtilsObjectNameEXT(vk::DebugUtilsObjectNameInfoEXT{
.objectType = type,
.objectHandle = handle,
.pObjectName = value,
});
}
+40
View File
@@ -22,6 +22,7 @@
#include "vk/vk_allocator.h"
#include <cstdint>
#include <span>
#include <type_traits>
#include <vector>
#include <vulkan/vulkan_raii.hpp>
@@ -53,6 +54,36 @@ struct raii_device : public vk::raii::Device
}
};
namespace details
{
template <typename T, typename U = void>
struct vk_handle
{
uint64_t operator()(const T & handle)
{
typename T::CType chandle = handle;
return uint64_t(chandle);
}
};
// vk::raii specialization
template <typename T>
struct vk_handle<T, std::void_t<typename T::CppType>>
{
uint64_t operator()(const T & handle)
{
typename T::CType chandle = *handle;
return uint64_t(chandle);
}
};
} // namespace details
template <typename T>
uint64_t vk_handle(const T & handle)
{
return details::vk_handle<T>{}(handle);
}
struct wivrn_vk_bundle
{
vk_bundle & vk;
@@ -75,5 +106,14 @@ struct wivrn_vk_bundle
wivrn_vk_bundle(vk_bundle & vk, std::span<const char *> requested_instance_extensions, std::span<const char *> requested_device_extensions);
uint32_t get_memory_type(uint32_t type_bits, vk::MemoryPropertyFlags memory_props);
template <typename T>
void name(const T & handle, const char * value)
{
return name(T::objectType, vk_handle(handle), value);
}
private:
void name(vk::ObjectType, uint64_t handle, const char * value);
};
} // namespace wivrn