Compare commits

...
Author SHA1 Message Date
Vindicus999 eed74ee35e Merge remote-tracking branch 'upstream/master' 2026-02-21 02:22:54 +00:00
Patrick Nicolas 51ee0b46ac Be less strict for quaternions norm 2026-02-20 23:38:43 +01:00
Patrick Nicolas eddda44def Don't recreate hand trackers on each frame 2026-02-20 17:34:31 +01:00
Patrick Nicolas f8a6db5834 vk/video: fix crash on iGPU 2026-02-20 15:56:34 +01:00
Vindicus999 45538f0e8d Merge remote-tracking branch 'upstream/master' 2026-02-20 02:28:47 +00:00
Patrick Nicolas 42c64a6569 vk/video: don't copy the whole buffer 2026-02-19 13:43:08 +01:00
Patrick Nicolas b4349767ce vk/video: properly lock queues 2026-02-19 13:43:04 +01:00
Patrick Nicolas b8e9c79180 vk/video: don't query offset, it is always 0 2026-02-19 13:43:04 +01:00
Patrick Nicolas df6667fd0d vk/video: unify encoded image copy code 2026-02-19 13:42:51 +01:00
Vindicus999 16994942e6 Merge remote-tracking branch 'upstream/master' 2026-02-19 02:33:20 +00:00
Patrick Nicolas 7732dc87df Add workaround for garbled image on Intel B580 2026-02-18 14:04:45 +01:00
Patrick Nicolas 1f42c0cfb8 CI: Update clang-format action 2026-02-18 12:17:50 +01:00
BlackCherryCat 01caa4e7c5 Update es locale 2026-02-18 09:52:37 +01:00
Patrick Nicolas e97618e99e Add try/catch when reading Steam VR manifest 2026-02-18 09:26:48 +01:00
Patrick Nicolas a651f1b252 Fix config reset when selecting app 2026-02-18 09:24:03 +01:00
Vindicus999 3ac943ec32 Merge remote-tracking branch 'upstream/master' 2026-02-18 02:34:17 +00:00
mitsuami-megane 31e98fceab update ja locale 2026-02-17 09:41:26 +01:00
Vindicus999 ddf93218b6 Merge remote-tracking branch 'upstream/master' 2026-02-16 22:36:44 +00:00
Cláudio 'Patola' Sampaio 07f50572ea Translated two messages to pt_BR 2026-02-16 23:28:31 +01:00
Patrick Nicolas a94edf52e2 Don't abort if Vulkan is not available 2026-02-16 21:54:48 +01:00
Patrick Nicolas 6b9e1e108c Update FR locale 2026-02-16 21:48:09 +01:00
Patrick Nicolas 749649d868 Add check for llvmpipe in dashboard 2026-02-16 21:47:13 +01:00
Patrick Nicolas 9353646b55 Support icons in ~/.local/share/icons 2026-02-16 20:32:34 +01:00
Patrick Nicolas 219146e763 Minimal fallback hicolor icon theme definition 2026-02-16 20:32:34 +01:00
Vindicus999 7fbd57b0d8 Merge remote-tracking branch 'upstream/master' 2026-02-16 02:34:21 +00:00
Patrick Nicolas 6c202db59e Update derived poses 1s after interaction profile
Also ignore it for hand interaction
2026-02-15 00:02:17 +01:00
Patrick Nicolas df76543fb7 Don't store poses if timesync is not ready 2026-02-14 23:34:14 +01:00
Vindicus999 fe5d70729f Merge remote-tracking branch 'upstream/master' 2026-02-14 17:56:46 +00:00
Patrick Nicolas b09af79edc Don't return valid data if too far from know times 2026-02-14 09:50:28 +01:00
Vindicus999 b16774188e Merge remote-tracking branch 'upstream/master' 2026-02-14 02:25:51 +00:00
Patrick Nicolas 627e87c144 Ensure pose quaternions are normalized 2026-02-13 23:25:45 +01:00
Guillaume Meunier 66a56dac82 Work around HTC bugs 2026-02-13 17:26:53 +01:00
Guillaume Meunier 1158afdad5 Clip the imgui layers to only the useful part 2026-02-13 17:26:53 +01:00
Guillaume Meunier b5d4f67860 Put the tooltips in a different layer 2026-02-13 17:26:53 +01:00
Guillaume Meunier 067d3a7679 Store the name of custom shaders in the glTF file 2026-02-13 17:15:21 +01:00
Guillaume Meunier fc5f0b9c6c Tweak pointer appearance 2026-02-13 17:15:21 +01:00
Guillaume Meunier 17bae9459a Use custom clipping to clip controller rays 2026-02-13 17:15:21 +01:00
Guillaume Meunier b80814adb5 Fix ray brightness in stream scene 2026-02-13 17:15:21 +01:00
Guillaume Meunier bb6280a9c3 Add ray trail 2026-02-13 17:15:21 +01:00
Guillaume Meunier a1dad6962c Allow passing extra data to the vertex/fragment shader 2026-02-13 17:15:21 +01:00
Guillaume Meunier ed433905c0 Add WIVRN_DEBUG_SHADERS option 2026-02-13 17:15:21 +01:00
Patrick Nicolas 2d45d53cc7 Remove check for visualid and glxFBconfig 2026-02-13 16:31:09 +01:00
Patrick Nicolas 4cd6862c1a Remove environment variables for foveation center 2026-02-13 15:42:51 +01:00
Guillaume Meunier b34aa59876 Use inplace_vector in scene.cpp 2026-02-13 15:42:51 +01:00
Patrick Nicolas 2f54a74b05 Use inplace_vectors in stream.cpp 2026-02-13 15:42:51 +01:00
Patrick Nicolas 0b7cf25a93 Use inplace_vector for body trackers 2026-02-13 15:42:51 +01:00
Guillaume Meunier 3bbaf8b8e2 Add inplace_vector from https://github.com/bemanproject/inplace_vector, commit 72e9bab7cca228be63294823a4809723a6580716 2026-02-13 15:42:51 +01:00
Patrick Nicolas fe46fc4545 Replace some unique_ptr with optionals 2026-02-13 15:42:51 +01:00
Patrick Nicolas 5d1ba50e92 Refactor Steam libraries 2026-02-13 14:37:03 +01:00
Patrick Nicolas 74946403f0 Only read shortcuts file for current Steam user 2026-02-13 14:36:47 +01:00
Patrick Nicolas 9af70baa58 Add utility to guess Steam user ID 2026-02-13 14:36:47 +01:00
Patrick Nicolas c0a061b4be Rename wlx-overlay-s -> WayVR in metainfo 2026-02-13 09:51:35 +01:00
Vindicus999 e9af61cdb9 Merge remote-tracking branch 'upstream/master' 2026-02-13 02:38:13 +00:00
Patrick Nicolas c19056498d Switch flatpak/native recommendations, add notes 2026-02-12 12:27:28 +01:00
Patrick Nicolas 6f6ccefbf3 Move foveation config out of "if post processing" 2026-02-12 10:52:05 +01:00
Vindicus999 b4cda7975f Merge remote-tracking branch 'upstream/master' 2026-02-12 02:36:36 +00:00
Patrick Nicolas 06d771b89e Fix flickering screen after disconnect
Deleting the stream object has to be delayed until all Vulkan work is
done.
2026-02-11 23:36:17 +01:00
Patrick Nicolas 50ae773fec Don't log "error: " in mic change for no error 2026-02-11 20:40:01 +01:00
Patrick Nicolas 6cf46a6b73 Initialize view flags to 0 2026-02-11 19:38:11 +01:00
Sapphire f0e3e8d4ad Re-enable microphone on reconnect 2026-02-11 18:33:11 +01:00
Patrick Nicolas 399477edf5 Skip some memory copies in vulkan encode 2026-02-11 14:34:06 +01:00
Patrick Nicolas 0ec0de4509 Update vulkan memory allocator to 3.3.0 2026-02-11 14:34:06 +01:00
Patrick Nicolas a8657f7f91 Fix manual foveation window position 2026-02-11 12:30:56 +01:00
Sapphire 87b11d6817 Don't send empty HEAD pose on failed xrLocateSpace 2026-02-11 09:08:05 +01:00
Vindicus999 9d220d34d5 Merge remote-tracking branch 'upstream/master' 2026-02-11 02:42:18 +00:00
Guillaume Meunier 6ccf6eaf26 Fix fr locale 2026-02-10 21:14:40 +01:00
Sapphire 375d06dee2 Update Monado 2026-02-10 09:07:17 +01:00
Vindicus999 54e12d7fbf Merge remote-tracking branch 'upstream/master' 2026-02-10 02:44:33 +00:00
Patrick Nicolas 6b407a2d1c re-fix eye tracked foveation on Pico 2026-02-09 15:14:48 +01:00
Patrick Nicolas a712eec83a Update xrizer 2026-02-09 09:32:45 +01:00
90 changed files with 22759 additions and 22341 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@2c659fea724e981e94741c0e7db663982cd7d3f4
uses: jidicula/clang-format-action@v4.16.0
with:
clang-format-version: '21'
check-path: ${{ matrix.path }}
+8 -3
View File
@@ -39,7 +39,12 @@ option(WIVRN_BUILD_WIVRNCTL "Build wivrnctl" ON)
option(WIVRN_BUILD_DISSECTOR "Build Wireshark dissector" OFF)
option(WIVRN_BUILD_TEST "Build test binaries" OFF)
option(WIVRN_WERROR "Treat warnings as errors" OFF)
option(WIVRN_OPTIMIZE_SHADERS "Run siprv-opt on compiled shaders" ON)
option(WIVRN_OPTIMIZE_SHADERS "Run spirv-opt on compiled shaders" ON)
option(WIVRN_DEBUG_SHADERS "Compile shaders with debug information" OFF)
if(WIVRN_OPTIMIZE_SHADERS AND WIVRN_DEBUG_SHADERS)
message(FATAL_ERROR "WIVRN_OPTIMIZE_SHADERS and WIVRN_DEBUG_SHADERS are incompatible")
endif()
option(WIVRN_USE_NVENC "Enable nvenc (Nvidia) hardware encoder" ON)
option(WIVRN_USE_VAAPI "Enable vaapi (AMD/Intel) hardware encoder" ON)
@@ -97,9 +102,9 @@ include(VulkanVersion)
if (WIVRN_USE_SYSTEM_BOOST AND NEED_COMMON)
if (WIVRN_BUILD_DISSECTOR)
find_package(Boost 1.84.0 REQUIRED COMPONENTS locale url)
find_package(Boost 1.84.0 REQUIRED COMPONENTS locale url iostreams)
else()
find_package(Boost 1.75.0 REQUIRED COMPONENTS locale url)
find_package(Boost 1.75.0 REQUIRED COMPONENTS locale url iostreams)
endif()
endif()
+10 -6
View File
@@ -38,15 +38,19 @@ WiVRn support a wide range of VR devices:
## PC Server/Dashboard
We recommend using the flatpak package from Flathub:
[![Flathub](https://flathub.org/api/badge)](https://flathub.org/apps/io.github.wivrn.wivrn)
Alternatively, packages are available from:
We recommend using native packages if available for your distribution:
- [Arch User Repositoy](https://aur.archlinux.org/packages/wivrn-dashboard)
- [Fedora](https://packages.fedoraproject.org/pkgs/wivrn/wivrn/)
- [Gentoo Guru](https://gitweb.gentoo.org/repo/proj/guru.git/tree/media-libs/wivrn)
- [NixOS](https://search.nixos.org/packages?channel=25.11&show=wivrn)
For OpenVR and Steam compatibility, you also need a [compatibility library](#openvr-and-steam-games) such as xrizer or OpenComposite.
A flatpak is available on Flathub for all distributions:
[![Flathub](https://flathub.org/api/badge)](https://flathub.org/apps/io.github.wivrn.wivrn)
Note that due to flatpak sandboxing some features may not be available such as Lighthouse tracked devices.
## Headset Client/App
@@ -97,7 +101,7 @@ The flatpak includes [OpenComposite](https://gitlab.com/znixian/OpenOVR/) and [x
If using Wine/Proton, it will probe for OpenVR at startup, This means even for OpenXR applications, OpenComposite or xrizer is required.
When you start the server through flatpak, it automatically configures the current OpenVR to use xrizer.
When a headset connects, wivrn-server sets the OpenVR runtime to xrizer unless manually configured differently.
### Steam Flatpak
If you're using the Steam Flatpak, you'll need to grant read only access to the following paths:
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -76,7 +76,7 @@ public:
std::string environment_model = "assets://ground.glb";
bool override_foveation_enable = false;
float override_foveation_pitch = 10 * M_PI / 180;
float override_foveation_pitch = -10 * M_PI / 180;
float override_foveation_distance = 3;
bool high_power_mode;
+6 -7
View File
@@ -53,9 +53,8 @@ constexpr float fingertip_distance_stick_thd = -0.02; // Max distance wher
constexpr float scroll_value_thd = 0.01;
// Pointer radius
constexpr float pointer_radius_in = 10;
constexpr float pointer_radius_out = 12;
constexpr float pointer_thickness = 4;
constexpr float pointer_thickness = 2;
constexpr float pointer_radius_in = 6;
// Pointer transparency
constexpr float pointer_alpha = 0.8;
@@ -63,8 +62,7 @@ constexpr float pointer_alpha_disabled = 0.25;
constexpr float pointer_fading_distance = 40;
// Pointer color
constexpr uint32_t pointer_color_pressed = 0xffff3300;
constexpr uint32_t pointer_color_unpressed = 0xffffffff;
constexpr uint32_t pointer_color = 0x40ffffff;
constexpr uint32_t pointer_color_border = 0xff000000;
} // namespace constants::gui
@@ -110,7 +108,8 @@ constexpr int zindex_passthrough = -2;
constexpr int zindex_lobby = -1;
constexpr int zindex_gui = 0;
constexpr int zindex_controllers = 1;
constexpr int zindex_recenter_tip = 2;
constexpr int zindex_tooltip = 2;
constexpr int zindex_recenter_tip = 3;
} // namespace constants::lobby
namespace constants::stream
@@ -131,7 +130,7 @@ constexpr float window_rounding = 10;
constexpr ImVec2 tooltip_padding = {5, 5};
constexpr float tooltip_rounding = 0;
constexpr float tooltip_distance = 10;
constexpr glm::vec3 tooltip_distance = {0, 0.004, 0.005};
constexpr ImVec2 button_size = {220, 80};
constexpr ImVec2 icon_button_size = {80, 80};
+6 -2
View File
@@ -376,10 +376,10 @@ std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::
return {{0, -0.006, -0.025}, glm::angleAxis(glm::radians(-15.f), glm::vec3{1, 0, 0})};
case xr::spaces::aim_left:
return {{-0.010, 0, 0.025}, {1, 0, 0, 0}};
return {{-0.010, 0, 0.02}, {1, 0, 0, 0}};
case xr::spaces::aim_right:
return {{0.010, 0, 0.025}, {1, 0, 0, 0}};
return {{0.010, 0, 0.02}, {1, 0, 0, 0}};
default:
break;
@@ -392,6 +392,10 @@ std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::
case xr::spaces::grip_right:
return {{0, -0.010, -0.025}, glm::angleAxis(glm::radians(-12.f), glm::vec3{1, 0, 0})};
case xr::spaces::aim_left:
case xr::spaces::aim_right:
return {{0, 0, -0.03}, {1, 0, 0, 0}};
default:
break;
}
+80 -53
View File
@@ -37,6 +37,7 @@
#include <cmath>
#include <cstddef>
#include <glm/gtc/matrix_access.hpp>
#include <glm/gtc/quaternion.hpp>
#include <imgui.h>
#include <imgui_internal.h>
#include <limits>
@@ -214,7 +215,7 @@ std::vector<std::pair<ImVec2, float>> imgui_context::ray_plane_intersection(cons
for (const auto & i: layers_)
{
if (i.space != xr::spaces::world)
if (i.space != xr::spaces::world or i.tooltip_viewport)
continue;
auto M = glm::transpose(glm::mat3_cast(i.orientation)); // world-to-plane transform
@@ -633,10 +634,6 @@ std::vector<imgui_context::controller_state> imgui_context::read_controllers_sta
auto trigger = application::read_action_float(ctrl.trigger).value_or(std::pair{0, 0});
state.trigger_value = trigger.second;
// TODO tunable
/*if (new_state.trigger_value < 0.5)
new_state.trigger_clicked = false;
else */
if (state.trigger_value > constants::gui::trigger_click_thd)
state.trigger_clicked = true;
}
@@ -920,15 +917,13 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
else
alpha *= constants::gui::pointer_alpha_disabled;
ImU32 color_pressed = ImGui::GetColorU32(constants::gui::pointer_color_pressed, alpha);
ImU32 color_unpressed = ImGui::GetColorU32(constants::gui::pointer_color_unpressed, alpha);
bool pressed = controller.second.trigger_clicked || controller.second.fingertip_touching;
float radius_in = constants::gui::pointer_radius_in;
float radius_out = radius_in + constants::gui::pointer_thickness * 0.5;
ImDrawList * draw_list = ImGui::GetForegroundDrawList();
draw_list->PushClipRect(clip_rect_min, clip_rect_max);
draw_list->AddCircleFilled(*position, constants::gui::pointer_radius_in, pressed ? color_pressed : color_unpressed);
draw_list->AddCircle(*position, constants::gui::pointer_radius_out, ImGui::GetColorU32(constants::gui::pointer_color_border, alpha), 0, constants::gui::pointer_thickness);
draw_list->AddCircleFilled(*position, radius_in, ImGui::GetColorU32(constants::gui::pointer_color, alpha));
draw_list->AddCircle(*position, radius_out, ImGui::GetColorU32(constants::gui::pointer_color_border, alpha), 0, constants::gui::pointer_thickness);
draw_list->PopClipRect();
}
}
@@ -983,15 +978,47 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
for (auto & i: layers_)
{
bool visible = false;
ImRect layer_rect(
i.vp_origin.x,
i.vp_origin.y,
i.vp_origin.x + i.vp_size.x,
i.vp_origin.y + i.vp_size.y);
ImRect all_windows_rect{
std::numeric_limits<float>::max(),
std::numeric_limits<float>::max(),
std::numeric_limits<float>::lowest(),
std::numeric_limits<float>::lowest(),
};
for (ImGuiWindow * window: context->Windows)
{
if (window->Active and not window->Hidden and window_intersects_viewport(window, i))
ImRect window_rect{
window->Pos.x,
window->Pos.y,
window->Pos.x + window->Size.x,
window->Pos.y + window->Size.y};
if (window->Active and not window->Hidden and layer_rect.Overlaps(window_rect))
{
visible = true;
break;
// Take the union of all visible windows in this layer
all_windows_rect.Add(window_rect);
}
}
// Take the intersection with the layer
all_windows_rect.ClipWithFull(layer_rect);
glm::vec2 pixel_size = i.size / glm::vec2(i.vp_size);
glm::vec2 all_windows_center(all_windows_rect.GetCenter().x, all_windows_rect.GetCenter().y);
glm::vec2 layer_center(layer_rect.GetCenter().x, layer_rect.GetCenter().y);
glm::vec3 new_position = i.position + i.orientation * glm::vec3((all_windows_center - layer_center) * pixel_size, 0);
glm::vec2 new_size = glm::vec2(all_windows_rect.GetWidth(), all_windows_rect.GetHeight()) * pixel_size;
if (not visible)
continue;
@@ -1006,12 +1033,12 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
.swapchain = swapchain,
.imageRect = {
.offset = {
.x = i.vp_origin.x,
.y = i.vp_origin.y,
.x = int(all_windows_rect.Min.x),
.y = int(all_windows_rect.Min.y),
},
.extent = {
.width = i.vp_size.x,
.height = i.vp_size.y,
.width = int(all_windows_rect.Max.x - all_windows_rect.Min.x),
.height = int(all_windows_rect.Max.y - all_windows_rect.Min.y),
}},
},
.pose = {
@@ -1022,14 +1049,14 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
.w = i.orientation.w,
},
.position = {
.x = i.position.x,
.y = i.position.y,
.z = i.position.z,
.x = new_position.x,
.y = new_position.y,
.z = new_position.z,
},
},
.size = {
.width = i.size.x,
.height = i.size.y,
.width = new_size.x,
.height = new_size.y,
},
});
}
@@ -1037,11 +1064,9 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
return quads;
}
std::vector<imgui_context::viewport> imgui_context::windows()
std::vector<imgui_context::window_viewport> imgui_context::windows()
{
std::vector<imgui_context::viewport> w;
ImGuiWindow * modal_popup = ImGui::GetTopMostAndVisiblePopupModal();
std::vector<imgui_context::window_viewport> w;
for (const imgui_context::viewport & layer: layers_)
{
@@ -1052,10 +1077,7 @@ std::vector<imgui_context::viewport> imgui_context::windows()
for (ImGuiWindow * window: context->Windows)
{
if (not window->Active or window->Hidden /*or window->ParentWindowInBeginStack != nullptr*/)
continue;
if (modal_popup != nullptr and window != modal_popup and not layer.always_show_cursor)
if (not window->Active or window->Hidden or (window->Flags & ImGuiWindowFlags_ChildWindow))
continue;
if (not window_intersects_viewport(window, layer))
@@ -1066,7 +1088,7 @@ std::vector<imgui_context::viewport> imgui_context::windows()
ImVec2 min = ImMax(v.Min, window->Pos);
ImVec2 center = (min + max) / 2;
w.push_back(viewport{
w.push_back(window_viewport{
.space = layer.space,
.position = layer.position +
glm::mat3_cast(layer.orientation) *
@@ -1079,9 +1101,6 @@ std::vector<imgui_context::viewport> imgui_context::windows()
(max.x - min.x) * layer.size.x / layer.vp_size.x,
(max.y - min.y) * layer.size.y / layer.vp_size.y,
},
.vp_origin = {min.x, min.y},
.vp_size = {max.x - min.x, max.y - min.y},
.always_show_cursor = layer.always_show_cursor,
});
}
}
@@ -1241,34 +1260,32 @@ void imgui_context::tooltip(std::string_view text)
// FIXME: this is incorrect if we use the docking branch of imgui
ImGuiViewport * viewport = ImGui::GetMainViewport();
auto & current_layer = layer(ImGui::GetMousePos());
auto pos_backup = viewport->Pos;
auto size_backup = viewport->Size;
viewport->Pos = ImVec2(current_layer.vp_origin.x, current_layer.vp_origin.y);
viewport->Size = ImVec2(current_layer.vp_size.x, current_layer.vp_size.y);
ImVec2 pos{
assert(std::ranges::contains(layers_, true, &viewport::tooltip_viewport));
auto & tooltip_layer = *std::ranges::find(layers_, true, &viewport::tooltip_viewport);
// Get the item position before drawing the tooltip (top center)
ImVec2 item_position{
(ImGui::GetItemRectMin().x + ImGui::GetItemRectMax().x) / 2,
ImGui::GetItemRectMin().y - constants::style::tooltip_distance,
ImGui::GetItemRectMin().y,
};
auto pos_backup = viewport->Pos;
auto size_backup = viewport->Size;
viewport->Pos = ImVec2(tooltip_layer.vp_origin.x, tooltip_layer.vp_origin.y);
viewport->Size = ImVec2(tooltip_layer.vp_size.x, tooltip_layer.vp_size.y);
// Draw the tooltip in the tooltip layer
// Clamp position to avoid overflowing on the left or the right
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, constants::style::tooltip_padding);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, constants::style::tooltip_rounding);
// Clamp position to avoid overflowing on the left or the right
auto & style = ImGui::GetStyle();
const ImVec2 text_size = ImGui::CalcTextSize(text.data(), text.data() + text.size(), true);
const ImVec2 size = {text_size.x + style.WindowPadding.x * 2.0f, text_size.y + style.WindowPadding.y * 2.0f};
pos.x = std::clamp<float>(pos.x, viewport->Pos.x + size.x / 2, viewport->Pos.x + viewport->Size.x - size.x / 2);
ImVec2 pivot = {0.5, 1};
const ImVec2 tooltip_size = {text_size.x + style.WindowPadding.x * 2.0f, text_size.y + style.WindowPadding.y * 2.0f};
// Move tooltip below the item if it overflows on the top
if (pos.y - size.y <= viewport->Pos.y)
{
pos.y = ImGui::GetItemRectMax().y + constants::style::tooltip_distance;
pivot.y = 0;
}
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, pivot);
ImGui::SetNextWindowPos(viewport->Pos + viewport->Size * 0.5, ImGuiCond_Always, {0.5, 0.5});
ImGui::SetNextWindowSizeConstraints({0, 0}, viewport->Size);
if (ImGui::BeginTooltip())
{
ImGui::PushStyleColor(ImGuiCol_Text, 0xffffffff);
@@ -1276,11 +1293,21 @@ void imgui_context::tooltip(std::string_view text)
ImGui::PopStyleColor();
ImGui::EndTooltip();
}
ImGui::PopStyleVar(2);
viewport->Pos = pos_backup;
viewport->Size = size_backup;
// Compute the tooltip position
glm::quat tooltip_orientation = current_layer.orientation;
auto M = glm::mat3_cast(tooltip_orientation);
float pixel_size = current_layer.size.y / current_layer.vp_size.y;
glm::vec3 tooltip_position_centre = rw_from_vp(item_position) + M * (glm::vec3(0, tooltip_size.y / 2, 0) * pixel_size + constants::style::tooltip_distance);
// Position the tooltip layer
tooltip_layer.position = tooltip_position_centre;
tooltip_layer.orientation = tooltip_orientation;
}
// https://github.com/ocornut/imgui/issues/3379#issuecomment-2943903877
+11 -1
View File
@@ -136,6 +136,7 @@ public:
glm::ivec2 vp_size;
bool always_show_cursor = false; // Show the cursor in this viewport even if there is a modal popup elsewhere (eg. this is a virtual keyboard)
bool tooltip_viewport = false; // Choose this viewport to display the tooltip, ignore mouse events
int z_index = 0;
@@ -145,6 +146,15 @@ public:
}
};
struct window_viewport
{
// Position of this window in the world
xr::spaces space;
glm::vec3 position;
glm::quat orientation;
glm::vec2 size;
};
private:
uint32_t queue_family_index;
@@ -215,7 +225,7 @@ public:
return layers_;
}
std::vector<viewport> windows();
std::vector<window_viewport> windows();
viewport & layer(ImVec2 position);
+18 -4
View File
@@ -19,6 +19,7 @@
#pragma once
#include <array>
#include <inplace_vector.hpp>
#include <memory>
#include <type_traits>
#include <utility>
@@ -100,7 +101,7 @@ struct material
size_t offset;
std::string name;
std::string fragment_shader_name = "lit.frag";
std::string fragment_shader = "lit.frag";
};
struct primitive
@@ -110,7 +111,7 @@ struct primitive
uint32_t vertex_count;
vk::IndexType index_type;
vk::DeviceSize index_offset;
std::vector<vk::DeviceSize> vertex_offset; // TODO: inplace_vector
beman::inplace_vector::inplace_vector<vk::DeviceSize, 8> vertex_offset; // See VkPhysicalDeviceLimits::maxVertexInputBindings
vertex_layout layout;
glm::vec3 obb_min;
@@ -155,11 +156,24 @@ struct node
bool visible = true;
uint32_t layer_mask = -1;
std::array<glm::vec4, 4> clipping_planes;
// TODO: separate component?
std::vector<std::pair<entt::entity, glm::mat4>> joints; // Node index, inverse bind matrix of each joint
std::vector<std::byte> extra_shader_data;
template <typename T>
void set_extra_shader_data(const T & data)
{
extra_shader_data.resize(sizeof(std::decay_t<T>));
memcpy(extra_shader_data.data(), &data, sizeof(std::decay_t<T>));
}
template <typename T>
T & get_extra_shader_data()
{
assert(extra_shader_data.size() == sizeof(std::decay_t<T>));
return *reinterpret_cast<T *>(extra_shader_data.data());
}
// For internal use by the renderer
glm::mat4 transform_to_root;
bool global_visible;
+40 -12
View File
@@ -45,6 +45,9 @@
#include <limits>
#include <ranges>
#include <simdjson/dom.h>
#include <simdjson/dom/element.h>
#include <simdjson/dom/object.h>
#include <simdjson/error.h>
#include <spdlog/spdlog.h>
#include <string>
#include <vulkan/vulkan_format_traits.hpp>
@@ -513,7 +516,7 @@ struct : std::error_category
} fastgltf_error_category;
// END
fastgltf::Asset load_gltf_asset(fastgltf::GltfDataBuffer & buffer, const std::filesystem::path & directory)
fastgltf::Asset load_gltf_asset(fastgltf::GltfDataBuffer & buffer, const std::filesystem::path & directory, std::function<void(simdjson::dom::object &, std::size_t, fastgltf::Category)> extra_callback)
{
fastgltf::Parser parser(
fastgltf::Extensions::KHR_texture_basisu |
@@ -524,6 +527,12 @@ fastgltf::Asset load_gltf_asset(fastgltf::GltfDataBuffer & buffer, const std::fi
fastgltf::Options::AllowDouble |
fastgltf::Options::DecomposeNodeMatrices;
parser.setUserPointer(&extra_callback);
parser.setExtrasParseCallback([](simdjson::dom::object * extras, std::size_t object_index, fastgltf::Category category, void * user_pointer) {
auto f = reinterpret_cast<std::function<void(simdjson::dom::object &, std::size_t, fastgltf::Category)> *>(user_pointer);
(*f)(*extras, object_index, category);
});
auto expected_asset = parser.loadGltf(buffer, directory, gltf_options);
if (auto error = expected_asset.error(); error != fastgltf::Error::None)
@@ -540,7 +549,8 @@ class loader_context
vk::raii::PhysicalDevice physical_device;
vk::raii::Device & device;
thread_safe<vk::raii::Queue> & queue;
image_loader & loader;
image_loader loader;
const std::map<std::tuple<fastgltf::Category, size_t, std::string>, std::string> & extras;
std::vector<utils::mapped_file> loaded_assets;
utils::mapped_file & load_from_asset(const std::filesystem::path & path)
@@ -563,14 +573,16 @@ public:
vk::raii::PhysicalDevice physical_device,
vk::raii::Device & device,
thread_safe<vk::raii::Queue> & queue,
image_loader & loader) :
uint32_t queue_family_index,
std::map<std::tuple<fastgltf::Category, size_t, std::string>, std::string> & extras) :
base_directory(std::move(base_directory)),
name(std::move(name)),
gltf(gltf),
physical_device(physical_device),
device(device),
queue(queue),
loader(loader)
loader(device, physical_device, queue, queue_family_index),
extras(extras)
{
}
@@ -793,6 +805,8 @@ public:
materials.reserve(gltf.materials.size());
for (const fastgltf::Material & gltf_material: gltf.materials)
{
size_t material_id = materials.size();
// Copy the default material, without references to its buffer or descriptor set
auto & material = *materials.emplace_back(std::make_shared<renderer::material>(default_material));
material.name = gltf_material.name;
@@ -803,21 +817,24 @@ public:
switch (gltf_material.alphaMode)
{
case fastgltf::AlphaMode::Opaque:
material.fragment_shader_name = "lit.frag";
material.fragment_shader = "lit.frag";
material.blend_enable = false;
break;
case fastgltf::AlphaMode::Mask:
material.fragment_shader_name = "lit_mask.frag";
material.fragment_shader = "lit_mask.frag";
material.blend_enable = false;
break;
case fastgltf::AlphaMode::Blend:
material.fragment_shader_name = "lit.frag";
material.fragment_shader = "lit.frag";
material.blend_enable = true;
break;
}
if (auto it = extras.find({fastgltf::Category::Materials, material_id, "fragment_shader"}); it != extras.end())
material.fragment_shader = it->second;
renderer::material::gpu_data & material_data = material.staging;
material_data.base_color_factor = convert(gltf_material.pbrData.baseColorFactor);
@@ -870,6 +887,7 @@ public:
meshes.reserve(gltf.meshes.size());
for (const fastgltf::Mesh & gltf_mesh: gltf.meshes)
{
size_t mesh_id = meshes.size();
std::shared_ptr<renderer::mesh> & mesh_ref = meshes.emplace_back();
mesh_ref = std::make_shared<renderer::mesh>();
@@ -892,7 +910,9 @@ public:
renderer::vertex_layout & layout = primitive_ref.layout;
if (gltf_primitive.findAttribute("JOINTS_0") == gltf_primitive.attributes.cend())
if (auto it = extras.find({fastgltf::Category::Meshes, mesh_id, "vertex_shader"}); it != extras.end())
primitive_ref.vertex_shader = it->second;
else if (gltf_primitive.findAttribute("JOINTS_0") == gltf_primitive.attributes.cend())
primitive_ref.vertex_shader = "lit.vert";
else
primitive_ref.vertex_shader = "lit_skinned.vert";
@@ -1007,7 +1027,6 @@ public:
node.orientation = glm::make_quat(TRS.rotation.data());
node.scale = glm::make_vec3(TRS.scale.data());
node.visible = true;
std::ranges::fill(node.clipping_planes, glm::vec4{0, 0, 0, 1});
}
return entities;
@@ -1148,10 +1167,19 @@ std::shared_ptr<entt::registry> scene_loader::operator()(
if (auto error = data_buffer.error(); error != fastgltf::Error::None)
throw std::system_error((int)error, fastgltf_error_category);
fastgltf::Asset asset = load_gltf_asset(data_buffer.get(), parent_path);
std::map<std::tuple<fastgltf::Category, size_t, std::string>, std::string> gltf_extras;
image_loader loader{device, physical_device, queue, queue_family_index};
loader_context ctx{parent_path, name, asset, physical_device, device, queue, loader};
fastgltf::Asset asset = load_gltf_asset(data_buffer.get(), parent_path, [&](simdjson::dom::object & extras, std::size_t object_index, fastgltf::Category category) {
std::string_view value;
for (const auto & kv: extras)
{
if (kv.value.get_string().get(value) == simdjson::SUCCESS)
gltf_extras.emplace(std::tuple{category, object_index, kv.key}, value);
}
});
loader_context ctx{parent_path, name, asset, physical_device, device, queue, queue_family_index, gltf_extras};
#ifndef NDEBUG
if (auto error = fastgltf::validate(asset); error != fastgltf::Error::None)
+12 -7
View File
@@ -29,6 +29,7 @@
#include "vk/pipeline.h"
#include "vk/shader.h"
#include "vk/specialization_constants.h"
#include <algorithm>
#include <boost/pfr/core.hpp>
#include <entt/entity/entity.hpp>
#include <entt/entt.hpp>
@@ -675,8 +676,8 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
{
spdlog::debug("Creating pipeline");
auto vertex_shader = shader_loader{device}(info.vertex_shader_name);
auto fragment_shader = shader_loader{device}(info.fragment_shader_name);
auto vertex_shader = load_shader(device, info.vertex_shader_name);
auto fragment_shader = load_shader(device, info.fragment_shader_name);
auto specialization = make_specialization_constants(
int32_t(info.nb_texcoords),
@@ -732,7 +733,7 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
.ColorBlendState = {vk::PipelineColorBlendStateCreateInfo{}},
.ColorBlendAttachments = {vk::PipelineColorBlendAttachmentState{
.blendEnable = info.blend_enable,
.srcColorBlendFactor = vk::BlendFactor::eSrcAlpha,
.srcColorBlendFactor = vk::BlendFactor::eOne,
.dstColorBlendFactor = vk::BlendFactor::eOneMinusSrcAlpha,
.colorBlendOp = vk::BlendOp::eAdd,
.srcAlphaBlendFactor = vk::BlendFactor::eOne,
@@ -1106,8 +1107,12 @@ void scene_renderer::render(
// TODO: reuse the UBO if another primitive of the same mesh has already been drawn
vk::DeviceSize instance_ubo_offset = resources.uniform_buffer_offset;
vk::DeviceSize instance_ubo_size = sizeof(instance_gpu_data) + node.extra_shader_data.size();
instance_gpu_data & object_ubo = *reinterpret_cast<instance_gpu_data *>(ubo + resources.uniform_buffer_offset);
resources.uniform_buffer_offset += utils::align_up(buffer_alignment, sizeof(instance_gpu_data));
std::span<std::byte> extra_shader_data{reinterpret_cast<std::byte *>(ubo + resources.uniform_buffer_offset + sizeof(instance_gpu_data)), node.extra_shader_data.size()};
resources.uniform_buffer_offset += utils::align_up(buffer_alignment, sizeof(instance_gpu_data) + node.extra_shader_data.size());
vk::DeviceSize joints_ubo_offset = 0;
if (!node.joints.empty())
@@ -1130,7 +1135,7 @@ void scene_renderer::render(
object_ubo.modelview[frame_index] = frame.view * transform;
object_ubo.modelviewproj[frame_index] = viewproj[frame_index] * transform;
}
object_ubo.clipping_planes = node.clipping_planes;
std::ranges::copy(node.extra_shader_data, extra_shader_data.begin());
// Get the material
std::shared_ptr<renderer::material> material = primitive.material_ ? primitive.material_ : default_material;
@@ -1139,7 +1144,7 @@ void scene_renderer::render(
pipeline_info info{
.renderpass = rp_info,
.vertex_shader_name = primitive.vertex_shader,
.fragment_shader_name = material->fragment_shader_name,
.fragment_shader_name = material->fragment_shader,
.vertex_layout = primitive.layout,
.cull_mode = primitive.cull_mode,
.front_face = primitive.front_face,
@@ -1187,7 +1192,7 @@ void scene_renderer::render(
vk::DescriptorBufferInfo buffer_info_2{
.buffer = resources.uniform_buffer,
.offset = instance_ubo_offset,
.range = sizeof(instance_gpu_data),
.range = instance_ubo_size,
};
vk::DescriptorBufferInfo buffer_info_3{
.buffer = resources.uniform_buffer,
-1
View File
@@ -199,7 +199,6 @@ class scene_renderer
glm::mat4 model;
std::array<glm::mat4, 2> modelview;
std::array<glm::mat4, 2> modelviewproj;
std::array<glm::vec4, 4> clipping_planes;
};
struct debug_draw_vertex
+10 -16
View File
@@ -158,16 +158,10 @@ void scene::render_world(
const std::optional<xr::foveation_profile> & foveation,
bool render_debug_draws)
{
std::vector<scene_renderer::frame_info> frames;
frames.reserve(views.size());
// TODO inplace vector
std::vector<XrCompositionLayerProjectionView> composition_layer_color;
std::vector<XrCompositionLayerDepthInfoKHR> composition_layer_depth;
composition_layer_color.reserve(views.size());
if (keep_depth_buffer)
composition_layer_depth.reserve(views.size());
assert(views.size() <= layer::max_views);
beman::inplace_vector::inplace_vector<scene_renderer::frame_info, layer::max_views> frames;
beman::inplace_vector::inplace_vector<XrCompositionLayerProjectionView, layer::max_views> composition_layer_color;
beman::inplace_vector::inplace_vector<XrCompositionLayerDepthInfoKHR, layer::max_views> composition_layer_depth;
auto [color_swapchain, color_image, foveation_image] = [&]() -> std::tuple<XrSwapchain, vk::Image, vk::Image> {
xr::swapchain & color_swapchain = get_swapchain(swapchain_format, width, height, 1, views.size(), foveation);
@@ -253,8 +247,8 @@ void scene::render_world(
add_projection_layer(
XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
space,
std::move(composition_layer_color),
std::move(composition_layer_depth));
composition_layer_color,
composition_layer_depth);
}
xr::swapchain & scene::get_swapchain(vk::Format format, int32_t width, int32_t height, int sample_count, uint32_t array_size, const std::optional<xr::foveation_profile> & foveation)
@@ -377,8 +371,8 @@ void scene::render_start(bool passthrough, XrTime predicted_display_time_)
void scene::add_projection_layer(
XrCompositionLayerFlags flags,
XrSpace space,
std::vector<XrCompositionLayerProjectionView> && color_views,
std::vector<XrCompositionLayerDepthInfoKHR> && depth_views)
std::span<XrCompositionLayerProjectionView> color_views,
std::span<XrCompositionLayerDepthInfoKHR> depth_views)
{
layers.push_back(layer{
.composition_layer = XrCompositionLayerProjection{
@@ -389,8 +383,8 @@ void scene::add_projection_layer(
.viewCount = (uint32_t)color_views.size(),
.views = nullptr,
},
.color_views = std::move(color_views),
.depth_views = std::move(depth_views),
.color_views{color_views.begin(), color_views.end()},
.depth_views{depth_views.begin(), depth_views.end()},
});
}
+7 -5
View File
@@ -29,6 +29,7 @@
#include "xr/session.h"
#include "xr/swapchain.h"
#include "xr/system.h"
#include <inplace_vector.hpp>
#include <cstdint>
#include <entt/entity/registry.hpp>
@@ -132,11 +133,12 @@ protected:
struct layer
{
static const int max_views = 2;
std::variant<XrCompositionLayerProjection, XrCompositionLayerQuad, XrCompositionLayerBaseHeader *> composition_layer;
// TODO in place vectors
std::vector<XrCompositionLayerProjectionView> color_views; // Used by XrCompositionLayerProjection
std::vector<XrCompositionLayerDepthInfoKHR> depth_views; // Used by XrCompositionLayerProjection
beman::inplace_vector::inplace_vector<XrCompositionLayerProjectionView, max_views> color_views; // Used by XrCompositionLayerProjection
beman::inplace_vector::inplace_vector<XrCompositionLayerDepthInfoKHR, max_views> depth_views; // Used by XrCompositionLayerProjection
std::optional<XrCompositionLayerColorScaleBiasKHR> color_scale_bias;
std::optional<XrCompositionLayerDepthTestFB> depth_test;
@@ -172,8 +174,8 @@ protected:
void add_projection_layer(
XrCompositionLayerFlags flags,
XrSpace space,
std::vector<XrCompositionLayerProjectionView> && color_views,
std::vector<XrCompositionLayerDepthInfoKHR> && depth_views = {});
std::span<XrCompositionLayerProjectionView> color_views,
std::span<XrCompositionLayerDepthInfoKHR> depth_views = {});
void add_quad_layer(
XrCompositionLayerFlags flags,
+86 -54
View File
@@ -23,6 +23,8 @@
#include "render/scene_components.h"
#include "utils/mapped_file.h"
#include "xr/space.h"
#include <array>
#include <entt/entity/fwd.hpp>
#include <entt/entt.hpp>
#include <glm/gtc/matrix_access.hpp>
#include <glm/gtc/quaternion.hpp>
@@ -33,6 +35,7 @@
#include <string>
#include <unordered_map>
#include <variant>
#include <openxr/openxr.h>
namespace components
{
@@ -62,17 +65,27 @@ struct visual_response
details::node_state state;
};
} // namespace components
namespace
{
// Component added to nodes bound to an action space
struct bound_space
{
xr::spaces space;
XrDuration Δt;
};
// Component added to node clipped by the GUI
struct clipped_by_gui
{
};
struct emissive_trigger
{
XrAction action;
};
} // namespace components
namespace
{
// clang-format off
const std::unordered_map<std::string, std::string> input_mappings = {
{"xr-standard-squeeze" , "/input/squeeze/value" },
@@ -171,9 +184,21 @@ struct json_visual_response
// OpenXR component path
std::string component_subpath;
};
struct ray_extra_shader_data
{
std::array<glm::mat4, 4> window_to_world;
float emissive_factor;
};
void setup_ray_shader(entt::registry & scene, entt::entity entity, const ray_extra_shader_data & initial_data = {})
{
auto & node = scene.get<components::node>(entity);
node.set_extra_shader_data(initial_data);
}
} // namespace
input_profile::input_profile(scene & scene, const std::filesystem::path & json_profile, uint32_t layer_mask_controller, uint32_t layer_mask_ray)
input_profile::input_profile(scene & scene, const std::filesystem::path & json_profile, uint32_t layer_mask_controller, uint32_t layer_mask_ray, XrAction left_trigger, XrAction right_trigger)
{
utils::mapped_file json{json_profile};
@@ -266,7 +291,7 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
auto [e, node] = scene.add_gltf(model, layer_mask_controller);
node.name = layout;
entity = e;
scene.world.emplace<bound_space>(e, space);
scene.world.emplace<components::bound_space>(e, space, 0);
spdlog::debug("Created entity {}", layout);
}
@@ -281,16 +306,32 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
else
continue;
auto && [entity, node] = scene.add_gltf(controller_ray_model_name(), layer_mask_ray);
node.name = (std::string)layout.key + "_ray";
spdlog::debug("Created entity {}", node.name);
auto && [ray_entity, ray_node] = scene.add_gltf(controller_ray_model_name(), layer_mask_ray);
scene.world.emplace<bound_space>(entity, space);
ray_node.name = (std::string)layout.key + "_ray";
spdlog::debug("Created entity {}", ray_node.name);
if (layout.key == "left")
left_ray = entity;
else if (layout.key == "right")
right_ray = entity;
scene.world.emplace<components::bound_space>(find_node_by_name(scene.world, "Ray", ray_entity), space, 0);
scene.world.emplace<components::clipped_by_gui>(find_node_by_name(scene.world, "Ray", ray_entity));
scene.world.emplace<components::emissive_trigger>(find_node_by_name(scene.world, "Ray", ray_entity), layout.key == "left" ? left_trigger : right_trigger);
setup_ray_shader(scene.world, find_node_by_name(scene.world, "Ray", ray_entity));
try
{
// These nodes don't exist in the HTC version
scene.world.emplace<components::bound_space>(find_node_by_name(scene.world, "Trail", ray_entity), space, 0);
scene.world.emplace<components::bound_space>(find_node_by_name(scene.world, "Trail now", ray_entity), space, 0);
scene.world.emplace<components::bound_space>(find_node_by_name(scene.world, "Trail -10ms", ray_entity), space, -10'000'000);
scene.world.emplace<components::bound_space>(find_node_by_name(scene.world, "Trail -20ms", ray_entity), space, -20'000'000);
scene.world.emplace<components::bound_space>(find_node_by_name(scene.world, "Trail -30ms", ray_entity), space, -30'000'000);
scene.world.emplace<components::bound_space>(find_node_by_name(scene.world, "Trail -40ms", ray_entity), space, -40'000'000);
scene.world.emplace<components::clipped_by_gui>(find_node_by_name(scene.world, "Trail", ray_entity));
scene.world.emplace<components::emissive_trigger>(find_node_by_name(scene.world, "Trail", ray_entity), layout.key == "left" ? left_trigger : right_trigger);
setup_ray_shader(scene.world, find_node_by_name(scene.world, "Trail", ray_entity));
}
catch (...)
{
}
}
for (auto & json_response: json_responses)
@@ -362,41 +403,6 @@ static void apply_visual_response(components::node & node, components::details::
node.visible = value > 0.5;
}
static void set_clipping_planes(entt::registry & scene, entt::entity entity, std::span<glm::vec4> clipping_planes)
{
// If the ray starts on the wrong side of the GUI, hide it entirely
// This assumes the node is a child of the root node
components::node & node = scene.get<components::node>(entity);
for (glm::vec4 & plane: clipping_planes)
{
if (glm::dot(plane, glm::vec4(node.position, 1)) < 0)
{
scene.get<components::node>(entity).visible = false;
return;
}
}
// Apply the clipping planes on direct children of the target entity
for (auto && [child_entity, child_node]: scene.view<components::node>().each())
{
if (child_node.parent == entity)
{
size_t nb_clipping_planes = std::min(child_node.clipping_planes.size(), clipping_planes.size());
auto copy_results = std::ranges::copy_n(
clipping_planes.begin(),
nb_clipping_planes,
child_node.clipping_planes.begin());
// Disable the remaining clipping planes
std::ranges::fill_n(
copy_results.out,
child_node.clipping_planes.size() - nb_clipping_planes,
glm::vec4(0, 0, 0, 1));
}
}
}
void input_profile::apply(
entt::registry & scene,
XrSpace world_space,
@@ -405,9 +411,9 @@ void input_profile::apply(
bool hide_left_ray,
bool hide_right_controller,
bool hide_right_ray,
std::span<glm::vec4> pointer_limits)
std::span<glm::mat4> world_to_window)
{
for (auto && [entity, node, space]: scene.view<components::node, bound_space>().each())
for (auto && [entity, node, space]: scene.view<components::node, components::bound_space>().each())
{
if ((space.space == xr::spaces::grip_left and hide_left_controller) or
(space.space == xr::spaces::aim_left and hide_left_ray) or
@@ -416,7 +422,7 @@ void input_profile::apply(
{
node.visible = false;
}
else if (auto location = application::locate_controller(application::space(space.space), world_space, predicted_display_time); location)
else if (auto location = application::locate_controller(application::space(space.space), world_space, predicted_display_time + space.Δt); location)
{
node.visible = true;
@@ -495,6 +501,32 @@ void input_profile::apply(
}
}
set_clipping_planes(scene, left_ray, pointer_limits);
set_clipping_planes(scene, right_ray, pointer_limits);
for (auto && [entity, node, response]: scene.view<components::node, components::emissive_trigger>().each())
{
if (not response.action)
continue;
if (auto opt_value = application::read_action_float(response.action))
{
float value = opt_value->second * 0.9 + 0.1;
node.set_extra_shader_data(ray_extra_shader_data{{}, value});
}
}
for (auto && [entity, node]: scene.view<components::node, components::clipped_by_gui>().each())
{
auto & data = node.get_extra_shader_data<ray_extra_shader_data>();
size_t nb_windows = std::min(data.window_to_world.size(), world_to_window.size());
auto copy_results = std::ranges::copy_n(
world_to_window.begin(),
nb_windows,
data.window_to_world.begin());
// Disable the remaining clipping planes
std::ranges::fill_n(
copy_results.out,
data.window_to_world.size() - nb_windows,
glm::mat4{/* TODO */});
}
}
+2 -2
View File
@@ -37,7 +37,7 @@ struct input_profile
magic_enum::containers::array<xr::spaces, std::pair<glm::vec3, glm::quat>> offset;
input_profile(scene & scene, const std::filesystem::path & json_profile, uint32_t layer_mask_controller, uint32_t layer_mask_ray);
input_profile(scene & scene, const std::filesystem::path & json_profile, uint32_t layer_mask_controller, uint32_t layer_mask_ray, XrAction left_trigger = XR_NULL_HANDLE, XrAction right_trigger = XR_NULL_HANDLE);
// application::poll_actions() must have been called before
void apply(
@@ -48,5 +48,5 @@ struct input_profile
bool hide_left_ray,
bool hide_right_controller,
bool hide_right_ray,
std::span<glm::vec4> pointer_limits);
std::span<glm::mat4> world_to_window);
};
+21 -30
View File
@@ -626,28 +626,7 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_gui(glm::vec3 head_positi
return std::nullopt;
}
// Return the vector v such that dot(v, x) > 0 iff x is on the side where the composition layer is visible
static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0)
{
glm::quat q{
pose.orientation.w,
pose.orientation.x,
pose.orientation.y,
pose.orientation.z,
};
glm::vec3 p{
pose.position.x,
pose.position.y,
pose.position.z,
};
glm::vec3 normal = glm::column(glm::mat3_cast(q), 2);
return glm::vec4(normal, -glm::dot(p, normal) - margin);
}
static void stick_finger_to_gui(std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT> & hand, const std::vector<imgui_context::viewport> & layers)
static void stick_finger_to_gui(std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT> & hand, const std::vector<imgui_context::window_viewport> & layers)
{
// Move XR_HAND_JOINT_INDEX_{TIP,DISTAL,INTERMEDIATE,PROXIMAL}_EXT so that:
// - Only the X rotation changes for distal and intermediate (relative to the parent bone)
@@ -667,7 +646,7 @@ static void stick_finger_to_gui(std::array<xr::hand_tracker::joint, XR_HAND_JOIN
// Compute the target position of the tip
std::vector<std::pair<glm::vec3, float>> intersections; // Target position of the finger tip, distance to the GUI plane
for (const imgui_context::viewport & layer: layers)
for (const imgui_context::window_viewport & layer: layers)
{
// Ignore layers that are not absolutely positionned
if (layer.space != xr::spaces::world)
@@ -1054,11 +1033,11 @@ void scenes::lobby::render(const XrFrameState & frame_state)
#endif
// Get the planes that limit the ray size from the composition layers
std::vector<glm::vec4> ray_limits;
for (auto & [z_index, layer]: imgui_layers)
std::vector<glm::mat4> world_to_window;
for (auto & window: imgui_ctx->windows())
{
if (z_index != constants::lobby::zindex_recenter_tip)
ray_limits.push_back(compute_ray_limits(layer.pose));
if (window.space == xr::spaces::world)
world_to_window.push_back(glm::inverse(glm::translate(window.position) * glm::mat4(glm::mat3_cast(window.orientation)) * glm::scale(glm::vec3(window.size, 1))));
}
input->apply(world,
@@ -1068,7 +1047,7 @@ void scenes::lobby::render(const XrFrameState & frame_state)
not imgui_ctx->is_aim_interaction()[0],
hide_right_controller,
not imgui_ctx->is_aim_interaction()[1],
ray_limits);
world_to_window);
renderer::animate(world, frame_state.predictedDisplayPeriod * 1.0e-9);
@@ -1168,7 +1147,9 @@ void scenes::lobby::on_focused()
*this,
"assets://controllers/" + profile + "/profile.json",
layer_controllers,
layer_rays);
layer_rays,
get_action("left_trigger").first,
get_action("right_trigger").first);
spdlog::info("Loaded input profile {}", input->id);
@@ -1264,7 +1245,17 @@ void scenes::lobby::on_focused()
.vp_origin = {0, 1000},
.vp_size = {1500, 300},
.z_index = constants::lobby::zindex_recenter_tip,
}};
},
{
// Tooltip
.space = xr::spaces::world,
.size = {0.6, 0.08},
.vp_origin = {0, 1300},
.vp_size = {1500, 200},
.tooltip_viewport = true,
.z_index = constants::lobby::zindex_tooltip,
},
};
xr::swapchain swapchain_imgui(instance, session, device, swapchain_format, 3000, 1500);
+2 -2
View File
@@ -257,7 +257,7 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time)
if (next_scene->apps.draw_gui(*imgui_ctx, _("Disconnect")) == app_launcher::Cancel)
{
next_scene.reset();
next_scene->exit();
current_tab = tab::server_list;
}
}
@@ -1034,7 +1034,7 @@ void scenes::lobby::gui_debug_node_hierarchy(entt::entity root)
primitive.vertex_count,
primitive.material_->name,
primitive.vertex_shader,
primitive.material_->fragment_shader_name);
primitive.material_->fragment_shader);
imgui_ctx->tooltip(tooltip);
}
+33 -22
View File
@@ -34,6 +34,7 @@
#include "boost/pfr/core.hpp"
#include "decoder/shard_accumulator.h"
#include "hardware.h"
#include "inplace_vector.hpp"
#include "spdlog/spdlog.h"
#include "utils/contains.h"
#include "utils/named_thread.h"
@@ -51,6 +52,7 @@
#endif
using namespace wivrn;
using namespace beman::inplace_vector;
// clang-format off
static const std::unordered_map<std::string, device_id> device_ids = {
@@ -428,7 +430,9 @@ void scenes::stream::on_focused()
*this,
"assets://controllers/" + profile + "/profile.json",
layer_controllers,
layer_rays);
layer_rays,
get_action("left_trigger").first,
get_action("right_trigger").first);
spdlog::info("Loaded input profile {}", input->id);
@@ -472,14 +476,23 @@ void scenes::stream::on_focused()
device,
swapchain_format,
1800,
1000);
1200);
imgui_context::viewport vp{
.space = xr::spaces::world,
// Position and orientation are set at each frame
.size = {1.2, 0.6666},
.vp_origin = {0, 0},
.vp_size = {1800, 1000},
std::vector<imgui_context::viewport> vps{
{
.space = xr::spaces::world,
// Position and orientation are set at each frame
.size = {1.2, 0.6666},
.vp_origin = {0, 0},
.vp_size = {1800, 1000},
},
{
.space = xr::spaces::world,
.size = {1.2, 0.1333},
.vp_origin = {0, 1000},
.vp_size = {1800, 200},
.tooltip_viewport = true,
},
};
imgui_ctx.emplace(physical_device,
@@ -488,7 +501,7 @@ void scenes::stream::on_focused()
queue,
imgui_inputs,
std::move(swapchain_imgui),
std::vector{vp},
std::move(vps),
image_cache);
if (application::get_config().enable_stream_gui)
@@ -588,8 +601,7 @@ std::array<std::shared_ptr<shard_accumulator::blit_handle>, 3> scenes::stream::c
if (decoders.empty())
return {};
std::unique_lock lock(frames_mutex);
thread_local std::vector<shard_accumulator::blit_handle *> common_frames;
common_frames.clear();
inplace_vector<shard_accumulator::blit_handle *, decoder_count> common_frames;
const bool alpha = decoders[0].latest_frames[0] and decoders[0].latest_frames[0]->view_info.alpha;
for (size_t i = 0; i < view_count + alpha; ++i)
{
@@ -602,7 +614,7 @@ std::array<std::shared_ptr<shard_accumulator::blit_handle>, 3> scenes::stream::c
else
{
// clang-format off
std::erase_if(common_frames,
erase_if(common_frames,
[this, i](auto & left)
{
return std::ranges::none_of(
@@ -615,7 +627,7 @@ std::array<std::shared_ptr<shard_accumulator::blit_handle>, 3> scenes::stream::c
// clang-format on
}
}
std::array<std::shared_ptr<shard_accumulator::blit_handle>, view_count + 1> result;
std::array<std::shared_ptr<shard_accumulator::blit_handle>, decoder_count> result;
if (not common_frames.empty())
{
auto min = std::ranges::min_element(common_frames,
@@ -769,7 +781,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
last_display_time = frame_state.predictedDisplayTime;
std::shared_lock lock(decoder_mutex);
if (not frame_state.shouldRender or (decoders[0].empty() and decoders[1].empty()))
if (not frame_state.shouldRender or (decoders[0].empty() and decoders[1].empty()) or exiting)
{
// TODO: stop/restart video stream
session.begin_frame();
@@ -958,9 +970,9 @@ void scenes::stream::render(const XrFrameState & frame_state)
vk::SubmitInfo submit_info;
submit_info.setCommandBuffers(*command_buffer);
std::vector<vk::Semaphore> semaphores;
std::vector<uint64_t> semaphore_vals;
std::vector<vk::PipelineStageFlags> wait_stages;
inplace_vector<vk::Semaphore, decoder_count> semaphores;
inplace_vector<uint64_t, decoder_count> semaphore_vals;
inplace_vector<vk::PipelineStageFlags, decoder_count> wait_stages;
for (auto b: current_blit_handles)
{
if (b and b->semaphore)
@@ -985,8 +997,6 @@ void scenes::stream::render(const XrFrameState & frame_state)
#endif
swapchain.release();
std::vector<XrCompositionLayerProjectionView> layer_view(view_count);
if (use_alpha)
session.enable_passthrough(system);
else
@@ -995,6 +1005,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
render_start(use_alpha, frame_state.predictedDisplayTime);
// Add the layer with the streamed content
std::array<XrCompositionLayerProjectionView, view_count> layer_view;
for (uint32_t view = 0; view < view_count; view++)
{
layer_view[view] =
@@ -1016,7 +1027,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
add_projection_layer(
XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
application::space(xr::spaces::world),
std::move(layer_view));
layer_view);
if (composition_layer_color_scale_bias_supported)
{
@@ -1069,8 +1080,8 @@ void scenes::stream::render(const XrFrameState & frame_state)
// Network operations may be blocking, do them once everything was submitted
{
// Keep a copy of the feedback packets as they can be modified if they're encrypted
std::vector<from_headset::feedback> feedbacks;
std::vector<serialization_packet> packets;
inplace_vector<from_headset::feedback, decoder_count> feedbacks;
inplace_vector<serialization_packet, decoder_count> packets;
feedbacks.reserve(current_blit_handles.size());
packets.reserve(current_blit_handles.size());
+8 -5
View File
@@ -53,6 +53,7 @@ public:
private:
static const size_t view_count = 2;
static const size_t decoder_count = view_count + 1;
struct accumulator_images
{
@@ -68,7 +69,7 @@ private:
// for frames inside accumulator images
std::mutex frames_mutex;
std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, view_count + 1> common_frame(XrTime display_time);
std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, decoder_count> common_frame(XrTime display_time);
std::unique_ptr<wivrn_session> network_session;
std::atomic<bool> exiting = false;
@@ -76,6 +77,7 @@ private:
thread_safe<to_headset::tracking_control> tracking_control{};
std::array<std::atomic<interaction_profile>, 2> interaction_profiles; // left and right hand
std::atomic<bool> interaction_profile_changed = false;
std::atomic<XrTime> scheduled_derived_pose = 0; // Tracking thread will compute derived pose when time is reached
std::atomic<bool> recenter_requested = false;
std::atomic<bool> hid_forwarding = false;
std::atomic<XrDuration> display_time_phase = 0;
@@ -86,7 +88,7 @@ private:
std::shared_mutex decoder_mutex;
std::optional<to_headset::video_stream_description> video_stream_description;
std::array<accumulator_images, view_count + 1> decoders; // Locked by decoder_mutex
std::array<accumulator_images, decoder_count> decoders; // Locked by decoder_mutex
std::optional<stream_defoveator> defoveator;
@@ -162,7 +164,7 @@ private:
void update_gui_position(xr::spaces controller);
// Keep a reference to the resources needed to blit the images until vkWaitForFences
std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, view_count + 1> current_blit_handles;
std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, decoder_count> current_blit_handles;
XrTime running_application_req = 0;
thread_safe<to_headset::running_applications> running_applications;
@@ -218,6 +220,7 @@ public:
return state_;
}
void exit();
bool alive() const
{
return !exiting;
@@ -233,10 +236,10 @@ private:
void read_actions();
void on_interaction_profile_changed(const XrEventDataInteractionProfileChanged &);
void send_derived_pose();
void setup(const to_headset::video_stream_description &);
void setup_reprojection_swapchain(uint32_t width, uint32_t height);
void exit();
vk::raii::QueryPool query_pool = nullptr;
bool query_pool_filled = false;
@@ -302,7 +305,7 @@ private:
float compact_cpu_time = 0;
float compact_gpu_time = 0;
void accumulate_metrics(XrTime predicted_display_time, const std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, view_count + 1> & blit_handles, const gpu_timestamps & timestamps);
void accumulate_metrics(XrTime predicted_display_time, const std::array<std::shared_ptr<wivrn::shard_accumulator::blit_handle>, decoder_count> & blit_handles, const gpu_timestamps & timestamps);
void gui_performance_metrics();
void gui_compact_view();
void gui_settings(float predicted_display_period);
+64 -78
View File
@@ -32,6 +32,8 @@
#include <IconsFontAwesome6.h>
#include <chrono>
#include <cmath>
#include <glm/ext.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/gtc/matrix_access.hpp>
#include <limits>
#include <ranges>
@@ -525,58 +527,58 @@ void scenes::stream::gui_settings(float predicted_display_period)
}
}
ImGui::Unindent();
}
bool send_packet = false;
bool save_config = false;
ImGui::Text("%s", _S("Foveation center override"));
ImGui::Indent();
bool send_packet = false;
bool save_config = false;
ImGui::Text("%s", _S("Foveation center override"));
ImGui::Indent();
{
if (ImGui::Checkbox(_S("Enable"), &override_foveation_enable))
{
if (ImGui::Checkbox(_S("Enable"), &override_foveation_enable))
{
send_packet = true;
save_config = true;
}
imgui_ctx->vibrate_on_hover();
ImGui::BeginDisabled(!override_foveation_enable);
ImGui::Text("%s", fmt::format(_F("Height {:.1f} deg"), -override_foveation_pitch * 180 / M_PI).c_str());
ImGui::Text("%s", fmt::format(_F("Distance {:.2f} m"), override_foveation_distance).c_str());
if (ImGui::Button(_S("Default")))
{
override_foveation_distance = configuration{}.override_foveation_distance;
override_foveation_pitch = configuration{}.override_foveation_pitch;
send_packet = true;
save_config = true;
}
imgui_ctx->vibrate_on_hover();
ImGui::SameLine();
if (ImGui::Button(_S("Change")))
gui_status = gui_status::foveation_settings;
imgui_ctx->vibrate_on_hover();
ImGui::EndDisabled();
send_packet = true;
save_config = true;
}
ImGui::Unindent();
imgui_ctx->vibrate_on_hover();
if (send_packet)
ImGui::BeginDisabled(!override_foveation_enable);
ImGui::Text("%s", fmt::format(_F("Height {:.1f} deg"), -override_foveation_pitch * 180 / M_PI).c_str());
ImGui::Text("%s", fmt::format(_F("Distance {:.2f} m"), override_foveation_distance).c_str());
if (ImGui::Button(_S("Default")))
{
network_session->send_control(from_headset::override_foveation_center{
.enabled = override_foveation_enable,
.pitch = override_foveation_pitch,
.distance = override_foveation_distance,
});
override_foveation_distance = configuration{}.override_foveation_distance;
override_foveation_pitch = configuration{}.override_foveation_pitch;
send_packet = true;
save_config = true;
}
imgui_ctx->vibrate_on_hover();
if (save_config)
{
auto & config = application::get_config();
config.override_foveation_enable = override_foveation_enable;
config.override_foveation_pitch = override_foveation_pitch;
config.override_foveation_distance = override_foveation_distance;
config.save();
}
ImGui::SameLine();
if (ImGui::Button(_S("Change")))
gui_status = gui_status::foveation_settings;
imgui_ctx->vibrate_on_hover();
ImGui::EndDisabled();
}
ImGui::Unindent();
if (send_packet)
{
network_session->send_control(from_headset::override_foveation_center{
.enabled = override_foveation_enable,
.pitch = override_foveation_pitch,
.distance = override_foveation_distance,
});
}
if (save_config)
{
auto & config = application::get_config();
config.override_foveation_enable = override_foveation_enable;
config.override_foveation_pitch = override_foveation_pitch;
config.override_foveation_distance = override_foveation_distance;
config.save();
}
ImGui::PopStyleVar();
}
@@ -729,27 +731,6 @@ void scenes::stream::gui_applications()
ImGui::PopStyleVar(3);
}
// Return the vector v such that dot(v, x) > 0 iff x is on the side where the composition layer is visible
static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0)
{
glm::quat q{
pose.orientation.w,
pose.orientation.x,
pose.orientation.y,
pose.orientation.z,
};
glm::vec3 p{
pose.position.x,
pose.position.y,
pose.position.z,
};
glm::vec3 normal = glm::column(glm::mat3_cast(q), 2);
return glm::vec4(normal, -glm::dot(p, normal) - margin);
}
void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicted_display_period)
{
if (not(plots_toggle_1 and plots_toggle_2))
@@ -778,8 +759,10 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
{
if (system.hand_tracking_supported())
{
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
if (not left_hand)
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
if (not right_hand)
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
}
}
else
@@ -827,7 +810,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
case gui_status::bitrate_settings:
case gui_status::foveation_settings:
imgui_ctx->layers()[0].orientation = head_position->second;
imgui_ctx->layers()[0].position = head_position->first + M * glm::vec3{0, -override_foveation_distance * sin(override_foveation_pitch), -override_foveation_distance};
imgui_ctx->layers()[0].position = head_position->first + M * glm::vec3{0, override_foveation_distance * sin(override_foveation_pitch), -override_foveation_distance};
break;
case gui_status::hidden:
@@ -854,7 +837,8 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
const ImGuiStyle & style = ImGui::GetStyle();
imgui_ctx->new_frame(predicted_display_time);
ImVec2 content_size{ImGui::GetMainViewport()->Size - ImVec2{tab_width, 0} - margin_around_window * 2};
ImVec2 viewport_size(imgui_ctx->layers()[0].vp_size.x, imgui_ctx->layers()[0].vp_size.y);
ImVec2 content_size{viewport_size - ImVec2{tab_width, 0} - margin_around_window * 2};
ImVec2 content_center = margin_around_window + content_size / 2 + ImVec2{tab_width, 0};
bool display_tabs, always_auto_resize;
@@ -870,7 +854,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
case gui_status::hidden:
case gui_status::bitrate_settings:
case gui_status::foveation_settings:
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->Size / 2, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
ImGui::SetNextWindowPos(viewport_size / 2, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
always_auto_resize = true;
display_tabs = false;
break;
@@ -885,13 +869,13 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
case gui_status::settings:
case gui_status::applications:
ImGui::SetNextWindowPos(margin_around_window);
ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size - margin_around_window * 2);
ImGui::SetNextWindowSize(viewport_size - margin_around_window * 2);
always_auto_resize = false;
display_tabs = true;
break;
case gui_status::application_launcher:
ImGui::SetNextWindowPos(margin_around_window);
ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size - margin_around_window * 2);
ImGui::SetNextWindowSize(viewport_size - margin_around_window * 2);
always_auto_resize = false;
display_tabs = false;
break;
@@ -1053,10 +1037,12 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
else
recentering_context.reset();
std::vector<glm::vec4> ray_limits;
for (auto [_, layer]: layers)
ray_limits.push_back(compute_ray_limits(layer.pose));
std::vector<glm::mat4> world_to_window;
for (auto & window: imgui_ctx->windows())
{
if (window.space == xr::spaces::world)
world_to_window.push_back(glm::inverse(glm::translate(window.position) * glm::mat4(glm::mat3_cast(window.orientation)) * glm::scale(glm::vec3(window.size, 1))));
}
bool hide_left_controller = false;
bool hide_right_controller = false;
@@ -1080,7 +1066,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
hide_left_controller,
hide_right_controller,
hide_right_controller,
ray_limits);
world_to_window);
// Add the layer with the controllers
if (composition_layer_depth_test_supported)
+16 -8
View File
@@ -84,7 +84,7 @@ from_headset::tracking::pose locate_space(device_id device, XrSpace space, XrSpa
.flags = cast_flags(location.locationFlags, velocity.velocityFlags),
};
spdlog::warn("xrLocateSpace failed for {}: {}", magic_enum::enum_name(device), xr::to_string(res));
return {};
return {.device = device};
}
class locate_spaces_functor
@@ -515,6 +515,7 @@ void scenes::stream::tracking()
.w = gaze_quat.w,
},
},
.device = item.device,
.flags = uint8_t(gaze.flags & view_pose.flags & ~(flags::linear_velocity_valid | flags::angular_velocity_valid)),
});
}
@@ -621,6 +622,13 @@ void scenes::stream::tracking()
}
network_session->send_stream(std::span(packets.data(), packet_count));
XrTime old = scheduled_derived_pose;
if (old and now > old)
{
send_derived_pose();
scheduled_derived_pose.compare_exchange_strong(old, 0);
}
}
catch (std::exception & e)
{
@@ -720,6 +728,12 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction
interaction_profiles[i] = interaction_profile::none;
}
// Wait for runtime to know about the controllers before sending data
scheduled_derived_pose = instance.now() + 1'000'000'000;
}
void scenes::stream::send_derived_pose()
{
auto now = instance.now();
for (device_id target: {
device_id::LEFT_AIM,
@@ -734,14 +748,8 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction
{
// don't do derived poses for hand interaction
const bool right = (target >= device_id::RIGHT_GRIP && target <= device_id::RIGHT_PALM) || target == device_id::RIGHT_PINCH_POSE || target == device_id::RIGHT_POKE;
if (interaction_profiles[right].load() == interaction_profile::ext_hand_interaction_ext)
{
network_session->send_control(from_headset::derived_pose{
.source = target,
.target = target,
});
if (interaction_profiles[right] == interaction_profile::ext_hand_interaction_ext)
continue;
}
auto source = derived_from(target);
auto source_space = application::space(device_to_space(source));
-2
View File
@@ -1,7 +1,6 @@
// kate: hl glsl
const int nb_views = 2;
const int nb_clipping = 4;
const int nb_texcoords = 2;
const bool use_pbr = false;
@@ -20,7 +19,6 @@ layout(set = 0, binding = 1) uniform mesh_ubo
mat4 model;
mat4 modelview[nb_views];
mat4 modelviewproj[nb_views];
vec4 clipping_plane[nb_clipping];
} mesh;
layout(set = 0, binding = 2) uniform joints_ubo
-2
View File
@@ -27,7 +27,6 @@ layout (constant_id = 2) const bool alpha_cutout = false;
layout (constant_id = 3) const bool skinning = false;
const int nb_views = 2;
const int nb_clipping = 4;
layout(set = 0, binding = 0) uniform scene_ubo
{
@@ -42,7 +41,6 @@ layout(set = 0, binding = 1) uniform mesh_ubo
mat4 model;
mat4 modelview[nb_views];
mat4 modelviewproj[nb_views];
vec4 clipping_plane[nb_clipping];
} mesh;
layout(set = 0, binding = 2) uniform joints_ubo
-6
View File
@@ -34,7 +34,6 @@ layout(location = 5) in vec4 in_color;
out gl_PerVertex
{
vec4 gl_Position;
float gl_ClipDistance[nb_clipping];
};
void main()
@@ -59,9 +58,4 @@ void main()
frag_pos = mesh.modelview[gl_ViewIndex] * vec4(in_position, 1.0);
light_pos = scene.view[gl_ViewIndex] * scene.light_position;
vertex_color = in_color;
for (int i = 0; i < nb_clipping; i++)
{
gl_ClipDistance[i] = dot(mesh.clipping_plane[i], mesh.model * vec4(in_position, 1.0));
}
}
+3 -10
View File
@@ -36,7 +36,6 @@ layout(location = 7) in vec4 in_weights;
out gl_PerVertex
{
vec4 gl_Position;
float gl_ClipDistance[nb_clipping];
};
void main()
@@ -53,8 +52,8 @@ void main()
in_weights.z * joints.joint_matrices[int(in_joints.z)] +
in_weights.w * joints.joint_matrices[int(in_joints.w)];
// TODO on CPU?
mat3 mv = inverse(transpose(mat3(mesh.modelview[gl_ViewIndex])));
mat3 mv = inverse(transpose(mat3(mesh.modelview[gl_ViewIndex] * skinMatrix)));
tangent = vec4(normalize(mv * in_tangent.xyz), in_tangent.w);
if (any(isnan(tangent))) // avoid NaNs if no tangent data is provided
@@ -62,15 +61,9 @@ void main()
normal = normalize(mv * in_normal);
normal = vec3(mesh.modelview[gl_ViewIndex] * skinMatrix * vec4(in_normal, 0.0));
gl_Position = mesh.modelviewproj[gl_ViewIndex] * skinMatrix * vec4(in_position, 1.0);
frag_pos = mesh.modelview[gl_ViewIndex] * vec4(in_position, 1.0);
frag_pos = mesh.modelview[gl_ViewIndex] * skinMatrix * vec4(in_position, 1.0);
light_pos = scene.view[gl_ViewIndex] * scene.light_position;
vertex_color = in_color;
for(int i = 0; i < nb_clipping; i++)
{
gl_ClipDistance[i] = dot(mesh.clipping_plane[i], mesh.model * vec4(in_position, 1.0));
}
}
+23
View File
@@ -0,0 +1,23 @@
/*
* WiVRn VR streaming
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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/>.
*/
#version 450
#extension GL_GOOGLE_include_directive : require
#include "ray_common.glsl.inc"
+25
View File
@@ -0,0 +1,25 @@
/*
* WiVRn VR streaming
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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/>.
*/
#version 450
#extension GL_EXT_multiview : require
#extension GL_GOOGLE_include_directive : require
#define SKINNED 0
#include "ray_common.glsl.inc"
+140
View File
@@ -0,0 +1,140 @@
// kate: hl glsl
/*
* WiVRn VR streaming
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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/>.
*/
const int nb_views = 2;
const int nb_windows = 4;
layout(set = 0, binding = 1) uniform mesh_ubo
{
mat4 model;
mat4 modelview[nb_views];
mat4 modelviewproj[nb_views];
// Extra data
mat4 world_to_window[nb_windows];
float emissive_factor;
} mesh;
layout(set = 0, binding = 2) uniform joints_ubo
{
mat4 joint_matrices[32];
} joints;
layout(set = 0, binding = 6) uniform sampler2D emissive_texture;
#ifdef VERT_SHADER
// Vertex input
layout(location = 0) in vec3 in_position;
layout(location = 1) in vec2 in_texcoord;
#if SKINNED
layout(location = 2) in vec4 in_joints;
layout(location = 3) in vec4 in_weights;
#endif
#endif
#ifdef FRAG_SHADER
#define VS_TO_FS in
#else
#define VS_TO_FS out
#endif
// Vertex-to-fragment
layout(location = 0) VS_TO_FS vec2 texcoord;
#ifndef HTC_WORKAROUND
layout(location = 1) VS_TO_FS vec4 position_wrt_window[nb_windows];
layout(location = 1 + nb_windows) VS_TO_FS vec4 base_wrt_window[nb_windows];
#endif // HTC_WORKAROUND
#ifdef VERT_SHADER
out gl_PerVertex
{
vec4 gl_Position;
#ifdef HTC_WORKAROUND
float gl_ClipDistance[nb_windows];
#endif
};
void main()
{
texcoord = in_texcoord;
#if SKINNED
mat4 skinMatrix =
in_weights.x * joints.joint_matrices[int(in_joints.x)] +
in_weights.y * joints.joint_matrices[int(in_joints.y)] +
in_weights.z * joints.joint_matrices[int(in_joints.z)] +
in_weights.w * joints.joint_matrices[int(in_joints.w)];
gl_Position = mesh.modelviewproj[gl_ViewIndex] * skinMatrix * vec4(in_position, 1.0);
vec4 world_position = mesh.model * skinMatrix * vec4(in_position, 1.0);
vec4 base_position = mesh.model * skinMatrix * vec4(in_position.xy, 0.0, 1.0);
#else // SKINNED
gl_Position = mesh.modelviewproj[gl_ViewIndex] * vec4(in_position, 1.0);
vec4 world_position = mesh.model * vec4(in_position, 1.0);
vec4 base_position = mesh.model * vec4(in_position.xy, 0.0, 1.0);
#endif // SKINNED
for(uint i = 0; i < nb_windows; i++)
{
#ifdef HTC_WORKAROUND
vec4 tmp = mesh.world_to_window[i] * world_position;
gl_ClipDistance[i] = tmp.z;
#else // HTC_WORKAROUND
position_wrt_window[i] = mesh.world_to_window[i] * world_position;
base_wrt_window[i] = mesh.world_to_window[i] * base_position;
#endif // HTC_WORKAROUND
}
}
#endif // VERT_SHADER
#ifdef FRAG_SHADER
// Fragment output
layout(location = 0) out vec4 out_color;
void main()
{
#ifdef HTC_WORKAROUND
out_color = vec4(mesh.emissive_factor * texture(emissive_texture, texcoord).rgb, 1.0 / 255.0);
#else // HTC_WORKAROUND
for (uint i = 0; i < nb_windows; i++)
{
if (position_wrt_window[i].w < 0.5)
continue;
// TODO check NaN
float lambda = -base_wrt_window[i].z / (position_wrt_window[i].z - base_wrt_window[i].z);
if (lambda < 0 || lambda > 1)
continue;
vec2 intersection = base_wrt_window[i].xy + lambda * (position_wrt_window[i].xy - base_wrt_window[i].xy);
if (abs(intersection.x) < 0.5 && abs(intersection.y) < 0.5)
discard;
}
out_color = vec4(mesh.emissive_factor * texture(emissive_texture, texcoord).rgb, 0);
#endif // HTC_WORKAROUND
}
#endif // FRAG_SHADER
+25
View File
@@ -0,0 +1,25 @@
/*
* WiVRn VR streaming
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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/>.
*/
#version 450
#extension GL_GOOGLE_include_directive : require
#define HTC_WORKAROUND
#include "ray_common.glsl.inc"
+26
View File
@@ -0,0 +1,26 @@
/*
* WiVRn VR streaming
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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/>.
*/
#version 450
#extension GL_EXT_multiview : require
#extension GL_GOOGLE_include_directive : require
#define SKINNED 0
#define HTC_WORKAROUND
#include "ray_common.glsl.inc"
+25
View File
@@ -0,0 +1,25 @@
/*
* WiVRn VR streaming
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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/>.
*/
#version 450
#extension GL_EXT_multiview : require
#extension GL_GOOGLE_include_directive : require
#define SKINNED 1
#include "ray_common.glsl.inc"
+26
View File
@@ -0,0 +1,26 @@
/*
* WiVRn VR streaming
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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/>.
*/
#version 450
#extension GL_EXT_multiview : require
#extension GL_GOOGLE_include_directive : require
#define SKINNED 1
#define HTC_WORKAROUND
#include "ray_common.glsl.inc"
-6
View File
@@ -18,7 +18,6 @@
*/
#include "shader.h"
#include "utils/cache.h"
#include "wivrn_shaders.h"
#include <magic_enum.hpp>
#include <spdlog/spdlog.h>
@@ -104,8 +103,3 @@ std::shared_ptr<shader> shader_loader::operator()(const std::string & name)
return (*this)(shaders.at(name));
}
std::shared_ptr<shader> load_shader(vk::raii::Device & device, const std::string & name)
{
return shader_loader{device}(name);
}
+4 -1
View File
@@ -64,4 +64,7 @@ struct shader_loader
std::shared_ptr<shader> operator()(const std::string & name);
};
std::shared_ptr<shader> load_shader(vk::raii::Device & device, const std::string & name);
inline std::shared_ptr<shader> load_shader(vk::raii::Device & device, const std::string & name)
{
return shader_loader{device}(name);
}
+8 -1
View File
@@ -13,13 +13,20 @@ function(compile_glsl_aux shader_stage shader_name glsl_filename output target_e
}},
")
if (WIVRN_DEBUG_SHADERS)
set(SHADER_FLAGS -gVS)
else()
set(SHADER_FLAGS )
endif()
add_custom_command(
OUTPUT "${SPV_FILE}-nopt"
COMMAND Vulkan::glslangValidator -V --target-env ${target_env} -S ${shader_stage} -D${shader_stage_upper}_SHADER ${in_file} -o "${SPV_FILE}-nopt" --depfile "${SPV_FILE}.d"
COMMAND Vulkan::glslangValidator -V --target-env ${target_env} -S ${shader_stage} -D${shader_stage_upper}_SHADER ${in_file} ${SHADER_FLAGS} -o "${SPV_FILE}-nopt" --depfile "${SPV_FILE}.d"
DEPENDS "${glsl_filename}"
DEPFILE "${SPV_FILE}.d"
VERBATIM
)
if (WIVRN_OPTIMIZE_SHADERS)
add_custom_command(
OUTPUT "${SPV_FILE}-opt"
+12 -5
View File
@@ -1,7 +1,7 @@
if (WIVRN_USE_SYSTEM_BOOST)
add_library(Boost::pfr ALIAS Boost::headers)
else()
set(BOOST_INCLUDE_LIBRARIES locale url pfr)
set(BOOST_INCLUDE_LIBRARIES locale url pfr iostreams)
FetchContent_MakeAvailable(boost)
endif()
@@ -40,14 +40,17 @@ add_library(wivrn-common STATIC EXCLUDE_FROM_ALL
if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER)
add_library(wivrn-common-server STATIC EXCLUDE_FROM_ALL
application.cpp
utils/flatpak.cpp
utils/xdg_icon_lookup.cpp
utils/steam_app_info.cpp
utils/load_icon.cpp
utils/ini.cpp
application.cpp
utils/steam_info.cpp
utils/vdf.cpp
utils/xdg_icon_lookup.cpp
)
target_link_libraries(wivrn-common-server PRIVATE nlohmann_json::nlohmann_json PNG::PNG PkgConfig::librsvg-2.0 LibArchive::LibArchive PUBLIC wivrn-common-base)
target_link_libraries(wivrn-common-server
PRIVATE nlohmann_json::nlohmann_json PNG::PNG PkgConfig::librsvg-2.0 LibArchive::LibArchive Boost::iostreams
PUBLIC wivrn-common-base)
if (WIVRN_BUILD_TEST)
add_executable(list-apps
@@ -55,6 +58,10 @@ if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER)
)
target_link_libraries(list-apps wivrn-common-server)
add_executable(vdf utils/vdf.cpp)
target_compile_definitions(vdf PRIVATE WIVRN_BUILD_TEST)
target_link_libraries(vdf Boost::iostreams)
endif()
endif()
+14 -167
View File
@@ -20,13 +20,12 @@
#include "application.h"
#include "utils/flatpak.h"
#include "utils/steam_app_info.h"
#include "utils/steam_info.h"
#include "utils/xdg_base_directory.h"
#include "utils/xdg_icon_lookup.h"
#include <filesystem>
#include <fstream>
#include <iostream>
#include <nlohmann/json.hpp>
namespace wivrn
@@ -42,168 +41,6 @@ std::string read_file(const std::filesystem::path & path)
return {begin, end};
}
std::filesystem::path home()
{
auto home = std::getenv("HOME");
return home ? home : "";
}
std::pair<std::string, std::optional<std::filesystem::path>> find_steam()
{
auto h = home();
// Flatpak Steam
if (std::filesystem::exists(h / ".var/app/com.valvesoftware.Steam/.steam/steam"))
return {"flatpak run com.valvesoftware.Steam", h / ".var/app/com.valvesoftware.Steam/.steam/steam"};
// Debian Steam (accessed from flatpak)
if (std::filesystem::exists(h / ".steam/debian-installation"))
return {"steam", h / ".steam/debian-installation"};
// system Steam
if (std::filesystem::exists(xdg_data_home() / "Steam"))
return {"steam", xdg_data_home() / "Steam"};
// system Steam (accessed from flatpak)
if (std::filesystem::exists(h / ".local/share/Steam"))
return {"steam", h / ".local/share/Steam"};
return {};
}
std::string read_vr_manifest(const std::filesystem::path & root)
{
return read_file(root / "config/steamapps.vrmanifest");
}
std::unordered_map<uint32_t, wivrn::steam_icon> safe_read_steam_icons(const std::filesystem::path & root)
{
try
{
return read_steam_icons(root / "appcache/appinfo.vdf");
}
catch (...)
{}
return {};
}
std::optional<std::filesystem::path> find_steam_icon(const std::filesystem::path & root, int app_id, const std::unordered_map<uint32_t, wivrn::steam_icon> & info)
{
auto icon = info.find(app_id);
if (icon == info.end())
return std::nullopt;
try
{
auto icon_path = root / "steam/games" / (icon->second.clienticon + ".ico");
if (std::filesystem::exists(icon_path))
return icon_path;
}
catch (...)
{
}
try
{
auto icon_path = root / "steam/games" / (icon->second.linuxclienticon + ".zip");
if (std::filesystem::exists(icon_path))
return icon_path;
}
catch (...)
{
}
return std::nullopt;
}
void read_steam_vr_apps(std::unordered_map<std::string, application> & res)
{
auto [command, root] = find_steam();
if (not root)
return;
auto manifest = read_vr_manifest(*root);
auto info = safe_read_steam_icons(*root);
if (manifest.empty())
return;
nlohmann::json json = nlohmann::json::parse(manifest);
for (auto & i: json["applications"])
{
try
{
application app;
if (i["launch_type"] == "url")
app.exec = command + " " + (std::string)i["url"];
else
continue;
std::string app_key = i["app_key"];
for (auto [locale, items]: i["strings"].items())
{
if (auto it = items.find("name"); it != items.end())
app.name[locale] = *it;
}
if (not app.name.contains(""))
{
auto it = app.name.find("en_us");
if (it == app.name.end())
it = app.name.begin();
if (it != app.name.end())
app.name[""] = it->second;
}
try
{
const char prefix[] = "steam.app.";
if (app_key.starts_with(prefix))
{
uint32_t app_id = stoll(app_key.substr(strlen(prefix)));
app.icon_path = find_steam_icon(*root, app_id, info);
}
}
catch (...)
{
}
if (not app.exec.empty())
res[app_key] = std::move(app);
}
catch (std::exception & e)
{
std::cerr << "Failed to parse Steam VR manifest: " << e.what() << std::endl;
}
}
for (auto const & entry: std::filesystem::directory_iterator{*root / "userdata"})
{
auto shortcuts_vdf = entry.path() / "config/shortcuts.vdf";
if (std::filesystem::exists(shortcuts_vdf))
{
try
{
for (auto && item: read_steam_shortcuts(shortcuts_vdf))
{
res[std::to_string(item.appid)] = {
.name = {{"", std::move(item.name)}},
// ¯\_(ツ)_/¯
.exec = command + " steam://rungameid/" + std::to_string((uint64_t(item.appid) << 32) + 0x2000000),
.icon_path = std::move(item.icon),
};
}
}
catch (std::exception & e)
{
std::cerr << "Failed to parse Steam shortcuts file " << shortcuts_vdf << ": " << e.what() << std::endl;
}
}
}
}
std::string unescape(std::string_view in)
{
std::string out;
@@ -391,9 +228,19 @@ std::unordered_map<std::string, application> list_applications()
{
std::unordered_map<std::string, application> res;
read_steam_vr_apps(res);
do_data_dir(xdg_data_home(), res);
for (auto & steam: steam::find_installations())
{
auto cmd = steam.get_steam_command() + " ";
for (auto && app: steam.list_applications())
{
res.emplace(std::to_string(app.appid),
application{
.name = std::move(app.name),
.exec = cmd + app.url,
.icon_path = steam.get_icon(app.appid),
});
}
}
for (auto && dir: xdg_data_dirs())
do_data_dir(std::move(dir), res);
-274
View File
@@ -1,274 +0,0 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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 "steam_app_info.h"
#include <bit>
#include <cstring>
#include <fstream>
#include <iostream>
namespace
{
class binary_reader
{
std::ifstream in;
public:
binary_reader(std::ifstream && in) : in{std::move(in)} {}
void discard(size_t bytes)
{
in.seekg(bytes, std::ios_base::cur);
}
template <typename T>
T read();
template <typename T>
requires std::is_integral_v<T>
T read()
{
T res;
in.read((char *)&res, sizeof(T));
if (not in)
throw std::runtime_error{"File truncated"};
static_assert(std::endian::native == std::endian::big or std::endian::native == std::endian::little);
if constexpr (std::endian::native == std::endian::big)
return std::byteswap(res);
else
return res;
}
std::vector<std::string> string_table();
auto tellg()
{
return in.tellg();
}
void seekg(size_t pos)
{
in.seekg(pos);
}
};
template <>
std::string binary_reader::read()
{
std::string res;
std::getline(in, res, '\0');
if (not in)
throw std::runtime_error{"File truncated"};
return res;
}
std::vector<std::string> binary_reader::string_table()
{
std::vector<std::string> res;
size_t string_offset = read<uint64_t>();
auto pos = in.tellg();
in.seekg(string_offset);
auto count = read<uint32_t>();
res.reserve(count);
for (size_t i = 0; i < count; ++i)
res.emplace_back(read<std::string>());
in.seekg(pos);
return res;
}
template <typename T>
void read_dict(binary_reader & in, T & visitor, const std::vector<std::string> * string_table = nullptr)
{
while (true)
{
auto type = in.read<uint8_t>();
if (type == 8)
{
visitor.end_dict();
return;
}
// Key
const std::string & key = string_table ? string_table->at(in.read<uint32_t>()) : in.read<std::string>();
// Value
switch (type)
{
case 0: // Dictionary
visitor.begin_dict(key);
read_dict(in, visitor, string_table);
break;
case 1: // UTF-8 string
visitor.on_string(key, in.read<std::string>());
break;
case 2: // uint32_t
visitor.on_uint32_t(key, in.read<uint32_t>());
break;
// case 3: // float
default:
throw std::runtime_error{"Unknown object type " + std::to_string(type)};
}
}
}
} // namespace
std::unordered_map<uint32_t, wivrn::steam_icon> wivrn::read_steam_icons(std::filesystem::path path)
{
binary_reader in{std::ifstream{path}};
uint32_t magic = in.read<uint32_t>();
if ((magic & 0xff'ff'ff'00) != 0x07'56'44'00)
throw std::runtime_error{"Wrong magic number"};
auto universe = in.read<uint32_t>();
int version = magic & 0xff;
std::vector<std::string> string_table;
std::vector<std::string> * string_table_ptr = nullptr;
if (version >= 41)
{
string_table = in.string_table();
string_table_ptr = &string_table;
}
std::unordered_map<uint32_t, wivrn::steam_icon> res;
struct V
{
wivrn::steam_icon current{};
void begin_dict(const std::string & key)
{
}
void end_dict()
{
}
void on_string(const std::string & key, std::string && val)
{
if (strcasecmp(key.c_str(), "clienticon") == 0)
current.clienticon = std::move(val);
else if (strcasecmp(key.c_str(), "linuxclienticon") == 0)
current.linuxclienticon = std::move(val);
}
void on_uint32_t(const std::string & key, uint32_t val)
{
}
};
while (true)
{
// See https://github.com/SteamDatabase/SteamAppInfo/blob/master/README.md#app-entry-repeated
auto app_id = in.read<uint32_t>();
if (app_id == 0)
break;
size_t size_data = in.read<uint32_t>();
size_t pos = in.tellg();
in.discard(
4 // info_state
+ 4 // last_updated
+ 8 // pics_token
+ 20 // SHA1 of the app info
+ 4 // change number
+ 20 // SHA1 of the bin data
+ 4 // checksum
+ 1 // type
);
try
{
V v;
read_dict(in, v, string_table_ptr);
if (not(v.current.clienticon.empty() and v.current.linuxclienticon.empty()))
res.emplace(app_id, std::move(v.current));
}
catch (...)
{
// Ignore errors
}
in.seekg(pos + size_data);
}
return res;
}
std::vector<wivrn::steam_shortcut> wivrn::read_steam_shortcuts(std::filesystem::path path)
{
binary_reader in{std::ifstream{path}};
auto type = in.read<uint8_t>();
auto name = in.read<std::string>();
if (type != 0 or name != "shortcuts")
throw std::runtime_error{"Invalid type for shortcuts file"};
std::vector<wivrn::steam_shortcut> res;
struct V
{
std::vector<wivrn::steam_shortcut> & items;
int depth = 0;
wivrn::steam_shortcut current{};
bool VR = false;
void begin_dict(const std::string & key)
{
++depth;
if (depth == 1)
{
current = decltype(current){};
VR = false;
}
}
void end_dict()
{
--depth;
if (depth == 0)
{
if (VR)
items.push_back(std::move(current));
}
}
void on_string(const std::string & key, std::string && val)
{
if (depth == 1)
{
if (strcasecmp(key.c_str(), "AppName") == 0)
current.name = std::move(val);
else if (strcasecmp(key.c_str(), "icon") == 0 and not val.empty())
current.icon = std::move(val);
}
}
void on_uint32_t(const std::string & key, uint32_t val)
{
if (depth == 1)
{
if (strcasecmp(key.c_str(), "appid") == 0)
current.appid = val;
else if (strcasecmp(key.c_str(), "OpenVR") == 0)
VR = val;
}
}
} v{res};
read_dict(in, v);
return res;
}
+495
View File
@@ -0,0 +1,495 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
*
* 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 "steam_info.h"
#include "vdf.h"
#include "xdg_base_directory.h"
#include <bit>
#include <charconv>
#include <cstring>
#include <format>
#include <fstream>
#include <iostream>
#include <nlohmann/json.hpp>
namespace
{
class binary_reader
{
std::ifstream in;
public:
binary_reader(std::ifstream && in) : in{std::move(in)} {}
void discard(size_t bytes)
{
in.seekg(bytes, std::ios_base::cur);
}
template <typename T>
T read();
template <typename T>
requires std::is_integral_v<T>
T read()
{
T res;
in.read((char *)&res, sizeof(T));
if (not in)
throw std::runtime_error{"File truncated"};
static_assert(std::endian::native == std::endian::big or std::endian::native == std::endian::little);
if constexpr (std::endian::native == std::endian::big)
return std::byteswap(res);
else
return res;
}
std::vector<std::string> string_table();
auto tellg()
{
return in.tellg();
}
void seekg(size_t pos)
{
in.seekg(pos);
}
};
template <>
std::string binary_reader::read()
{
std::string res;
std::getline(in, res, '\0');
if (not in)
throw std::runtime_error{"File truncated"};
return res;
}
std::vector<std::string> binary_reader::string_table()
{
std::vector<std::string> res;
size_t string_offset = read<uint64_t>();
auto pos = in.tellg();
in.seekg(string_offset);
auto count = read<uint32_t>();
res.reserve(count);
for (size_t i = 0; i < count; ++i)
res.emplace_back(read<std::string>());
in.seekg(pos);
return res;
}
template <typename T>
void read_dict(binary_reader & in, T & visitor, const std::vector<std::string> * string_table = nullptr)
{
while (true)
{
auto type = in.read<uint8_t>();
if (type == 8)
{
visitor.end_dict();
return;
}
// Key
const std::string & key = string_table ? string_table->at(in.read<uint32_t>()) : in.read<std::string>();
// Value
switch (type)
{
case 0: // Dictionary
visitor.begin_dict(key);
read_dict(in, visitor, string_table);
break;
case 1: // UTF-8 string
visitor.on_string(key, in.read<std::string>());
break;
case 2: // uint32_t
visitor.on_uint32_t(key, in.read<uint32_t>());
break;
// case 3: // float
default:
throw std::runtime_error{"Unknown object type " + std::to_string(type)};
}
}
}
std::filesystem::path home()
{
auto home = std::getenv("HOME");
return home ? home : "";
}
std::optional<uint32_t> guess_steam_userid(const std::filesystem::path & root)
{
auto localconfig = root / "config/loginusers.vdf";
if (not std::filesystem::exists(localconfig))
return {};
try
{
wivrn::vdf::root loginusers(localconfig);
if (loginusers.key != "users")
return {};
std::optional<uint32_t> res;
for (const auto & [userid, entries]: std::get<std::vector<wivrn::vdf::keyvalue>>(loginusers.value))
{
uint64_t v;
if (std::from_chars(userid.data.begin(), userid.data.end(), v).ec != std::errc{})
continue;
res = v; // truncate to 32 bits
for (const auto & [key, value]: std::get<std::vector<wivrn::vdf::keyvalue>>(entries))
{
if (key == "MostRecent" and std::get<wivrn::vdf::string>(value) == "1")
return res;
}
}
return res;
}
catch (std::exception & e)
{
return {};
}
}
} // namespace
void read_steam_icons(std::filesystem::path path, std::unordered_map<uint32_t, wivrn::steam::icon> & icons)
{
binary_reader in{std::ifstream{path}};
uint32_t magic = in.read<uint32_t>();
if ((magic & 0xff'ff'ff'00) != 0x07'56'44'00)
throw std::runtime_error{"Wrong magic number"};
auto universe = in.read<uint32_t>();
int version = magic & 0xff;
std::vector<std::string> string_table;
std::vector<std::string> * string_table_ptr = nullptr;
if (version >= 41)
{
string_table = in.string_table();
string_table_ptr = &string_table;
}
struct V
{
wivrn::steam::icon current{};
void begin_dict(const std::string & key)
{
}
void end_dict()
{
}
void on_string(const std::string & key, std::string && val)
{
if (strcasecmp(key.c_str(), "clienticon") == 0)
current.clienticon = std::move(val);
else if (strcasecmp(key.c_str(), "linuxclienticon") == 0)
current.linuxclienticon = std::move(val);
}
void on_uint32_t(const std::string & key, uint32_t val)
{
}
};
while (true)
{
// See https://github.com/SteamDatabase/SteamAppInfo/blob/master/README.md#app-entry-repeated
auto app_id = in.read<uint32_t>();
if (app_id == 0)
break;
size_t size_data = in.read<uint32_t>();
size_t pos = in.tellg();
in.discard(
4 // info_state
+ 4 // last_updated
+ 8 // pics_token
+ 20 // SHA1 of the app info
+ 4 // change number
+ 20 // SHA1 of the bin data
+ 4 // checksum
+ 1 // type
);
try
{
V v;
read_dict(in, v, string_table_ptr);
if (not(v.current.clienticon.empty() and v.current.linuxclienticon.empty()))
icons.emplace(app_id, std::move(v.current));
}
catch (...)
{
// Ignore errors
}
in.seekg(pos + size_data);
}
}
void read_steam_shortcuts(
const std::filesystem::path & path,
std::vector<wivrn::steam::application> & apps,
std::unordered_map<uint32_t, std::filesystem::path> & icons)
{
if (not std::filesystem::exists(path))
return;
binary_reader in{std::ifstream{path}};
auto type = in.read<uint8_t>();
auto name = in.read<std::string>();
if (type != 0 or name != "shortcuts")
throw std::runtime_error{"Invalid type for shortcuts file"};
std::vector<wivrn::steam_shortcut> res;
struct V
{
std::vector<wivrn::steam::application> & apps;
std::unordered_map<uint32_t, std::filesystem::path> & icons;
int depth = 0;
wivrn::steam::application current{};
std::filesystem::path icon;
bool VR = false;
void begin_dict(const std::string & key)
{
++depth;
if (depth == 1)
{
current = decltype(current){};
icon.clear();
VR = false;
}
}
void end_dict()
{
--depth;
if (depth == 0)
{
if (VR)
{
if (not icon.empty())
icons[current.appid] = std::move(icon);
// ¯\_(ツ)_/¯
current.appid = (current.appid << 32) | 0x02000000;
current.url = std::format("steam://rungameid/{}", current.appid);
apps.push_back(std::move(current));
}
}
}
void on_string(const std::string & key, std::string && val)
{
if (depth == 1)
{
if (strcasecmp(key.c_str(), "AppName") == 0)
current.name[""] = std::move(val);
else if (strcasecmp(key.c_str(), "icon") == 0 and not val.empty())
icon = std::move(val);
}
}
void on_uint32_t(const std::string & key, uint32_t val)
{
if (depth == 1)
{
if (strcasecmp(key.c_str(), "appid") == 0)
current.appid = val;
else if (strcasecmp(key.c_str(), "OpenVR") == 0)
VR = val;
}
}
} v{apps, icons};
read_dict(in, v);
}
wivrn::steam::steam(std::filesystem::path root, bool flatpak) :
root(std::move(root)),
flatpak(flatpak),
default_userid(guess_steam_userid(this->root))
{
}
std::vector<wivrn::steam> wivrn::steam::find_installations()
{
std::vector<wivrn::steam> res;
auto h = home();
auto try_construct = [&res](std::filesystem::path root, bool flatpak = false) {
try
{
if (std::filesystem::exists(root))
{
res.push_back(wivrn::steam(std::move(root), flatpak));
return true;
}
}
catch (std::exception &)
{
}
return false;
};
// Flatpak Steam
try_construct(h / ".var/app/com.valvesoftware.Steam/.steam/steam", true);
// Debian Steam (accessed from flatpak)
try_construct(h / ".steam/debian-installation")
// system Steam
or try_construct(xdg_data_home() / "Steam")
// system Steam (accessed from flatpak)
or try_construct(h / ".local/share/Steam");
return res;
}
std::vector<wivrn::steam::application> wivrn::steam::list_applications()
{
std::vector<wivrn::steam::application> res;
// Steam games, from VR manifest
try
{
std::ifstream manifest(root / "config/steamapps.vrmanifest");
nlohmann::json json = nlohmann::json::parse(manifest);
for (auto & i: json["applications"])
{
try
{
// Steam games have an url launch
// shortcuts may be in this file, or may not...
if (i["launch_type"] != "url")
continue;
std::string app_key = i["app_key"];
const char prefix[] = "steam.app.";
if (not app_key.starts_with(prefix))
continue;
application app{
.appid = stoul(app_key.substr(strlen(prefix))),
.url = i["url"],
};
for (auto [locale, items]: i["strings"].items())
{
if (auto it = items.find("name"); it != items.end())
app.name[locale] = *it;
}
if (not app.name.contains(""))
{
auto it = app.name.find("en_us");
if (it == app.name.end())
it = app.name.begin();
if (it != app.name.end())
app.name[""] = it->second;
else
continue; // skip unnamed app
}
res.push_back(std::move(app));
}
catch (std::exception & e)
{
std::cerr << "Failed to parse Steam VR manifest: " << e.what() << std::endl;
}
}
}
catch (std::exception & e)
{
}
// Shortcuts
if (default_userid)
{
try
{
read_steam_shortcuts(root / "userdata" / std::to_string(*default_userid) / "config/shortcuts.vdf", res, shortcut_icons);
}
catch (std::exception & e)
{
}
}
else
{
// Is it a good idea to just iterate over all users?
for (auto const & entry: std::filesystem::directory_iterator{root / "userdata"})
try
{
read_steam_shortcuts(entry.path() / "config/shortcuts.vdf", res, shortcut_icons);
}
catch (std::exception & e)
{
}
}
return res;
}
std::optional<std::filesystem::path> wivrn::steam::get_icon(uint64_t appid)
{
if (appid & 0x02000000)
{
// Shortcut
auto it = shortcut_icons.find(appid >> 32);
if (it != shortcut_icons.end())
return it->second;
return {};
}
if (not icons)
{
icons.emplace();
try
{
read_steam_icons(root / "appcache/appinfo.vdf", *icons);
}
catch (...)
{}
}
auto it = icons->find(appid);
if (it == icons->end())
return {};
auto icon_path = root / "steam/games" / (it->second.clienticon + ".ico");
if (std::filesystem::exists(icon_path))
return icon_path;
icon_path = root / "steam/games" / (it->second.linuxclienticon + ".zip");
if (std::filesystem::exists(icon_path))
return icon_path;
return {};
}
std::string wivrn::steam::get_steam_command() const
{
if (flatpak)
return "flatpak run com.valvesoftware.Steam";
return "steam";
}
+69
View File
@@ -0,0 +1,69 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
*
* 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 <filesystem>
#include <optional>
#include <unordered_map>
#include <vector>
namespace wivrn
{
class steam
{
public:
struct application
{
uint64_t appid;
// localised names, with empty locale for default
std::unordered_map<std::string, std::string> name;
std::string url;
};
struct icon
{
std::string clienticon;
std::string linuxclienticon;
};
private:
std::filesystem::path root;
bool flatpak;
std::optional<uint32_t> default_userid;
std::optional<std::unordered_map<uint32_t, icon>> icons;
std::unordered_map<uint32_t, std::filesystem::path> shortcut_icons;
steam(std::filesystem::path root, bool flatpak);
public:
static std::vector<steam> find_installations();
std::vector<application> list_applications();
std::optional<std::filesystem::path> get_icon(uint64_t app_id);
std::string get_steam_command() const;
};
struct steam_shortcut
{
uint32_t appid;
std::string name;
std::optional<std::filesystem::path> icon;
};
} // namespace wivrn
+191
View File
@@ -0,0 +1,191 @@
/*
* WiVRn VR streaming
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
*
* 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 "vdf.h"
#include <boost/iostreams/device/mapped_file.hpp>
#include <iostream>
namespace
{
void consume_whitespace(const char *& pos, const char * end)
{
for (; pos != end; ++pos)
{
if (not std::isspace(*pos))
return;
}
throw std::runtime_error("malformed VDF file");
}
wivrn::vdf::string read_string(const char *& pos, const char * end)
{
consume_whitespace(pos, end);
const bool quoted = *pos == '"';
if (quoted)
++pos;
const char * begin = pos;
for (; pos != end; ++pos)
{
if (*pos == '\\')
{
++pos;
if (pos == end)
break;
continue;
}
if (quoted)
{
if (*pos == '"')
return {std::string_view(begin, pos++)};
}
else
{
if (std::isspace(*pos) or *pos == '{' or *pos == '}')
return {std::string_view(begin, pos)};
}
}
throw std::runtime_error("malformed string in VDF file");
}
std::variant<wivrn::vdf::string, std::vector<wivrn::vdf::keyvalue>> read_value(const char *& pos, const char * end);
wivrn::vdf::keyvalue read_key_value(const char *& pos, const char * end)
{
return wivrn::vdf::keyvalue{
.key = read_string(pos, end),
.value = read_value(pos, end),
};
}
std::vector<wivrn::vdf::keyvalue> read_dict(const char *& pos, const char * end)
{
consume_whitespace(pos, end);
if (*pos != '{')
throw std::runtime_error("malformed VDF file");
++pos;
std::vector<wivrn::vdf::keyvalue> res;
while (true)
{
consume_whitespace(pos, end);
if (*pos == '}')
{
++pos;
return res;
}
res.push_back(read_key_value(pos, end));
}
throw std::runtime_error("malformed dict in VDF file");
}
std::variant<wivrn::vdf::string, std::vector<wivrn::vdf::keyvalue>> read_value(const char *& pos, const char * end)
{
consume_whitespace(pos, end);
if (*pos == '{')
return read_dict(pos, end);
else
return read_string(pos, end);
}
} // namespace
bool wivrn::vdf::string::operator==(const char * b) const
{
const char * a = data.begin();
for (; a != data.end(); ++a, ++b)
{
if (*b == '\0')
return false;
if (*a == '\\')
{
++a;
// This should be taken care of by the parser
assert(a != data.end());
}
if (std::tolower(*b) != std::tolower(*a))
return false;
}
return *b == '\0';
}
wivrn::vdf::root::root(const std::filesystem::path & file)
{
boost::iostreams::mapped_file in{file};
opaque = in;
const char * pos = in.begin();
key = read_string(pos, in.end());
value = read_value(pos, in.end());
}
void dump(const wivrn::vdf::keyvalue & kv, int depth)
{
for (int i = 0; i < depth; ++i)
std::cout << '\t';
std::cout << '"' << kv.key.data << "\": ";
struct V
{
int depth;
void operator()(const wivrn::vdf::string & s)
{
std::cout << '"' << s.data << '"';
}
void operator()(const std::vector<wivrn::vdf::keyvalue> & kv)
{
std::cout << '{' << std::endl;
for (const auto & i: kv)
{
dump(i, depth + 1);
if (&i != &kv.back())
std::cout << ',';
std::cout << std::endl;
}
for (int i = 0; i < depth; ++i)
std::cout << '\t';
std::cout << "}";
}
};
std::visit(V{depth}, kv.value);
}
#ifdef WIVRN_BUILD_TEST
void dump(const wivrn::vdf::root & kv)
{
std::cout << '{';
dump(kv, 0);
std::cout << '}';
}
int main(int argc, char ** argv)
{
for (int i = 1; i < argc; ++i)
{
wivrn::vdf::root doc{argv[i]};
dump(doc);
}
}
#endif
@@ -1,6 +1,6 @@
/*
* WiVRn VR streaming
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
*
* 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
@@ -18,28 +18,37 @@
#pragma once
#include <any>
#include <filesystem>
#include <optional>
#include <unordered_map>
#include <string_view>
#include <variant>
#include <vector>
namespace wivrn
{
struct steam_icon
namespace vdf
{
std::string clienticon;
std::string linuxclienticon;
struct string
{
std::string_view data;
bool operator==(const char *) const;
};
struct steam_shortcut
struct keyvalue
{
uint32_t appid;
std::string name;
std::optional<std::filesystem::path> icon;
string key;
std::variant<string, std::vector<keyvalue>> value;
};
std::unordered_map<uint32_t, steam_icon> read_steam_icons(std::filesystem::path path);
std::vector<steam_shortcut> read_steam_shortcuts(std::filesystem::path path);
struct root : public keyvalue
{
root(const std::filesystem::path &);
private:
std::any opaque;
};
} // namespace vdf
} // namespace wivrn
+4 -2
View File
@@ -45,7 +45,7 @@ std::filesystem::path xdg_cache_home()
std::filesystem::path xdg_data_home()
{
if (const char * xdg_data_home = std::getenv("XDG_DATA_HOME"))
if (const char * xdg_data_home = std::getenv("XDG_DATA_HOME"); xdg_data_home and *xdg_data_home)
return xdg_data_home;
if (const char * home = std::getenv("HOME"))
@@ -71,9 +71,11 @@ std::vector<std::filesystem::path> xdg_config_dirs()
return paths;
}
std::vector<std::filesystem::path> xdg_data_dirs()
std::vector<std::filesystem::path> xdg_data_dirs(bool include_data_home)
{
std::vector<std::filesystem::path> paths;
if (include_data_home)
paths.push_back(xdg_data_home());
if (const char * xdg_config_dirs = std::getenv("XDG_DATA_DIRS"))
{
+1 -1
View File
@@ -26,4 +26,4 @@ std::filesystem::path xdg_config_home();
std::filesystem::path xdg_cache_home();
std::filesystem::path xdg_data_home();
std::vector<std::filesystem::path> xdg_config_dirs();
std::vector<std::filesystem::path> xdg_data_dirs();
std::vector<std::filesystem::path> xdg_data_dirs(bool include_data_home = true);
+63 -38
View File
@@ -25,6 +25,7 @@
#include <algorithm>
#include <filesystem>
#include <format>
#include <fstream>
#include <limits>
#include <optional>
@@ -107,51 +108,75 @@ void find_icon_theme_dirs_helper(const std::vector<std::filesystem::path> & base
const auto theme_dir = base_dir / "icons" / theme;
const auto index_theme = theme_dir / "index.theme";
if (not std::filesystem::exists(index_theme))
continue;
try
if (std::filesystem::exists(index_theme))
{
std::ifstream file{index_theme};
wivrn::ini index{file};
for (const auto & inherited_theme: utils::split(index.get<std::string>("Icon Theme", "Inherits", ""), ","))
try
{
if (inherited_theme != "" and not std::ranges::contains(themes, inherited_theme))
themes.push_back(inherited_theme);
std::ifstream file{index_theme};
wivrn::ini index{file};
for (const auto & inherited_theme: utils::split(index.get<std::string>("Icon Theme", "Inherits", ""), ","))
{
if (inherited_theme != "" and not std::ranges::contains(themes, inherited_theme))
themes.push_back(inherited_theme);
}
for (auto directory: utils::split(index.get<std::string>("Icon Theme", "Directories", ""), ","))
{
int size = index.get<int>(directory, "Size");
int scale = index.get<int>(directory, "Scale", 1);
int min_size = index.get<int>(directory, "MinSize", size);
int max_size = index.get<int>(directory, "MaxSize", size);
int threshold = index.get<int>(directory, "Threshold", 2);
std::string type_str = index.get<std::string>(directory, "Type", "Threshold");
icon_theme_type type = icon_theme_type::threshold;
if (type_str == "Fixed")
type = icon_theme_type::fixed;
else if (type_str == "Scalable")
type = icon_theme_type::scalable;
else if (type_str == "Threshold")
type = icon_theme_type::threshold;
dirs.push_back(icon_theme_dir{
.path = theme_dir / directory,
.size = size,
.scale = scale,
.type = type,
.min_size = min_size,
.max_size = max_size,
.threshold = threshold,
});
}
}
for (auto directory: utils::split(index.get<std::string>("Icon Theme", "Directories", ""), ","))
catch (std::exception & e)
{
int size = index.get<int>(directory, "Size");
int scale = index.get<int>(directory, "Scale", 1);
int min_size = index.get<int>(directory, "MinSize", size);
int max_size = index.get<int>(directory, "MaxSize", size);
int threshold = index.get<int>(directory, "Threshold", 2);
std::string type_str = index.get<std::string>(directory, "Type", "Threshold");
icon_theme_type type = icon_theme_type::threshold;
if (type_str == "Fixed")
type = icon_theme_type::fixed;
else if (type_str == "Scalable")
type = icon_theme_type::scalable;
else if (type_str == "Threshold")
type = icon_theme_type::threshold;
dirs.push_back(icon_theme_dir{
.path = theme_dir / directory,
.size = size,
.scale = scale,
.type = type,
.min_size = min_size,
.max_size = max_size,
.threshold = threshold,
});
}
}
catch (std::exception & e)
else if (theme == "hicolor")
{
// FIXME: full theme support
for (int size: {256})
dirs.push_back(icon_theme_dir{
.path = theme_dir / std::format("{}x{}/apps", size, size),
.size = size,
.scale = 1,
.type = icon_theme_type::threshold,
.min_size = size,
.max_size = size,
.threshold = 2,
});
dirs.push_back(icon_theme_dir{
.path = theme_dir / "scalable/apps",
.size = 128,
.scale = 1,
.type = icon_theme_type::scalable,
.min_size = 1,
.max_size = 256,
.threshold = 2,
});
}
}
}
+1 -1
View File
@@ -28,7 +28,7 @@
<li>Samsung Galaxy XR</li>
</ul>
<p>For desktop streaming, check out wlx-overlay-s.</p>
<p>For desktop streaming, check out WayVR.</p>
</description>
<developer id="io.github.wivrn.wivrn">
<name>Guillaume Meunier, Patrick Nicolas et al</name>
+8
View File
@@ -188,6 +188,14 @@ Kirigami.ApplicationWindow {
]
}
Kirigami.InlineMessage {
Layout.fillWidth: true
text: Settings.flatpak ? i18n("Vulkan drivers cannot be found, you may need to run \"flatpak update\"") : i18n("Vulkan drivers cannot be found")
type: Kirigami.MessageType.Warning
showCloseButton: true
visible: DashboardSettings.show_system_checks && (VulkanInfo.type == VulkanInfo.SoftGPU || VulkanInfo.type == VulkanInfo.NoGPU)
}
Kirigami.InlineMessage {
Layout.fillWidth: true
text: i18n("Use the Mesa (radv) driver for AMD GPUs\nHardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO")
+3 -20
View File
@@ -7,8 +7,6 @@ import io.github.wivrn.wivrn
ColumnLayout {
id: select_game
property bool json_loaded: false
Component.onCompleted: {
apps.append({
"name": i18nc("don't start an application automatically", "None"),
@@ -75,13 +73,8 @@ ColumnLayout {
}
}
function reload() {
select_game.json_loaded = false;
load();
}
function load() {
if (select_game.json_loaded || WivrnServer.serverStatus != WivrnServer.Started || WivrnServer.jsonConfiguration == "")
if (WivrnServer.jsonConfiguration == "")
return;
Settings.load(WivrnServer);
@@ -103,22 +96,12 @@ ColumnLayout {
app_text.text = Settings.application;
app_combobox.currentIndex = custom_idx;
}
select_game.json_loaded = true;
}
function save() {
var new_application;
if (apps.get(app_combobox.currentIndex).is_custom)
new_application = app_text.text;
Settings.application = app_text.text;
else
new_application = apps.get(app_combobox.currentIndex).command;
Settings.load(WivrnServer);
if (Settings.application != new_application) {
Settings.application = new_application;
Settings.save(WivrnServer);
}
Settings.application = apps.get(app_combobox.currentIndex).command;
}
}
+34 -6
View File
@@ -24,14 +24,40 @@
vulkan_info::vulkan_info()
{
vk::raii::Context context;
try
{
vk::raii::Context context;
vk::ApplicationInfo app_info{"WiVRn dashboard", 1, "No engine", 1, VK_API_VERSION_1_1};
vk::InstanceCreateInfo instance_info{vk::InstanceCreateFlags{0}, &app_info};
vk::raii::Instance vulkan{context, instance_info};
vk::ApplicationInfo app_info{"WiVRn dashboard", 1, "No engine", 1, VK_API_VERSION_1_1};
vk::InstanceCreateInfo instance_info{vk::InstanceCreateFlags{0}, &app_info};
vk::raii::Instance vulkan{context, instance_info};
auto devices = vulkan.enumeratePhysicalDevices();
set_info(choose_device(devices));
auto devices = vulkan.enumeratePhysicalDevices();
set_info(choose_device(devices));
}
catch (std::runtime_error & e)
{
qCritical() << "Failed to get vulkan info: " << e.what();
}
}
static vulkan_info::gpu_type cast_type(vk::PhysicalDeviceType type)
{
switch (type)
{
case vk::PhysicalDeviceType::eOther:
return vulkan_info::OtherGPU;
case vk::PhysicalDeviceType::eIntegratedGpu:
return vulkan_info::IGPU;
case vk::PhysicalDeviceType::eDiscreteGpu:
return vulkan_info::DGPU;
case vk::PhysicalDeviceType::eVirtualGpu:
return vulkan_info::VirtGPU;
case vk::PhysicalDeviceType::eCpu:
return vulkan_info::SoftGPU;
}
qCritical() << "invalid GPU type enum " << int(type);
return vulkan_info::OtherGPU;
}
vk::raii::PhysicalDevice & vulkan_info::choose_device(std::vector<vk::raii::PhysicalDevice> & devices)
@@ -70,5 +96,7 @@ void vulkan_info::set_info(vk::raii::PhysicalDevice & device)
break;
}
m_type = cast_type(prop.properties.deviceType);
qDebug() << "Driver" << m_driverId << m_driverVersion;
}
+19 -1
View File
@@ -33,14 +33,27 @@ class vulkan_info : public QObject
Q_OBJECT
QML_NAMED_ELEMENT(VulkanInfo)
QML_SINGLETON
public:
enum gpu_type
{
DGPU,
IGPU,
SoftGPU,
VirtGPU,
OtherGPU,
NoGPU,
};
Q_ENUM(gpu_type)
Q_PROPERTY(QString driverId READ driverId CONSTANT)
Q_PROPERTY(QString driverVersion READ driverVersion CONSTANT)
Q_PROPERTY(uint32_t driverVersionCode READ driverVersionCode CONSTANT)
Q_PROPERTY(gpu_type type READ type CONSTANT)
QString m_driverId;
QString m_driverVersion;
uint32_t m_driverVersionCode;
uint32_t m_driverVersionCode{};
gpu_type m_type = NoGPU;
vk::raii::PhysicalDevice & choose_device(std::vector<vk::raii::PhysicalDevice> & devices);
void set_info(vk::raii::PhysicalDevice & device);
@@ -62,4 +75,9 @@ public:
{
return m_driverVersionCode;
}
gpu_type type() const
{
return m_type;
}
};
+956
View File
@@ -0,0 +1,956 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP
#define BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP
#if !defined(__has_include) || __has_include(<beman/inplace_vector/config.hpp>)
#include <beman/inplace_vector/config.hpp>
#endif
#include <algorithm> // for rotate...
#include <array>
#include <compare>
#include <concepts> // for lots...
#include <cstddef> // for size_t
#include <cstdint> // for fixed-width integer types
#include <iterator> // for reverse_iterator and iterator traits
#include <limits> // for numeric_limits
#include <memory> // for destroy
#include <ranges>
#include <type_traits> // for aligned_storage and all meta-functions
// Artifact from previous implementation, can be used as hints for optimizer
#define IV_EXPECT(EXPR)
#ifndef BEMAN_IV_THROW_OR_ABORT
#ifndef BEMAN_INPLACE_VECTOR_NO_EXCEPTIONS
#define BEMAN_INPLACE_VECTOR_NO_EXCEPTIONS() 0
#endif
#if BEMAN_INPLACE_VECTOR_NO_EXCEPTIONS()
#include <cstdlib> // for abort
#define BEMAN_IV_THROW_OR_ABORT(x) abort()
#else
#include <stdexcept> // for length_error
#define BEMAN_IV_THROW_OR_ABORT(x) throw x
#endif
#endif
// Private utilities
namespace beman::inplace_vector::details {
struct from_range_t {};
inline constexpr from_range_t from_range;
// clang-format off
// Smallest unsigned integer that can represent values in [0, N].
template <size_t N>
using smallest_size_t
= std::conditional_t<(N < std::numeric_limits<uint8_t>::max()), uint8_t,
std::conditional_t<(N < std::numeric_limits<uint16_t>::max()), uint16_t,
std::conditional_t<(N < std::numeric_limits<uint32_t>::max()), uint32_t,
std::conditional_t<(N < std::numeric_limits<uint64_t>::max()), uint64_t,
size_t>>>>;
// clang-format on
// Index a random-access and sized range doing bound checks in debug builds
template <std::ranges::random_access_range Rng, std::integral Index>
static constexpr decltype(auto) index(Rng &&rng, Index i) noexcept
requires(std::ranges::sized_range<Rng>)
{
IV_EXPECT(static_cast<ptrdiff_t>(i) < std::ranges::size(rng));
return std::begin(std::forward<Rng>(rng))[std::forward<Index>(i)];
}
// http://eel.is/c++draft/container.requirements.general#container.intro.reqmts-2
template <class Rng, class T>
concept container_compatible_range =
std::ranges::input_range<Rng> &&
std::convertible_to<std::ranges::range_reference_t<Rng>, T>;
template <typename T>
concept satisfy_triviality = std::is_trivially_copyable_v<T> &&
std::is_trivially_default_constructible_v<T> &&
std::is_trivially_destructible_v<T>;
template <typename T, std::size_t N>
concept satisfy_constexpr = N == 0 || satisfy_triviality<T>;
template <typename T>
concept lessthan_comparable = requires(const T &a, const T &b) {
{ a < b } -> std::convertible_to<bool>;
};
// Types implementing the `inplace_vector`'s storage
namespace storage {
// Storage for zero elements.
template <class T> struct zero_sized {
protected:
using size_type = uint8_t;
static constexpr T *storage_data() noexcept { return nullptr; }
static constexpr size_type storage_size() noexcept { return 0; }
static constexpr void
unsafe_set_size([[maybe_unused]] size_t new_size) noexcept {
IV_EXPECT(new_size == 0 &&
"tried to change size of empty storage to non-zero value");
}
public:
constexpr zero_sized() = default;
constexpr zero_sized(zero_sized const &) = default;
constexpr zero_sized &operator=(zero_sized const &) = default;
constexpr zero_sized(zero_sized &&) = default;
constexpr zero_sized &operator=(zero_sized &&) = default;
constexpr ~zero_sized() = default;
};
// Storage for trivial types.
template <class T, size_t N> struct trivial {
static_assert(satisfy_triviality<T>,
"storage::trivial<T, C> requires Trivial<T>");
static_assert(N != size_t{0}, "N == 0, use zero_sized");
protected:
using size_type = smallest_size_t<N>;
private:
using array_based_storage = std::array<std::remove_const_t<T>, N>;
alignas(alignof(T)) array_based_storage storage_data_{};
size_type storage_size_ = 0;
protected:
constexpr const T *storage_data() const noexcept {
return storage_data_.data();
}
constexpr auto storage_data() noexcept { return storage_data_.data(); }
constexpr size_type storage_size() const noexcept { return storage_size_; }
constexpr void unsafe_set_size(size_t new_size) noexcept {
IV_EXPECT(size_type(new_size) <= N && "new_size out-of-bounds [0, N]");
storage_size_ = size_type(new_size);
}
public:
constexpr trivial() noexcept = default;
constexpr trivial(trivial const &) noexcept = default;
constexpr trivial &operator=(trivial const &) noexcept = default;
constexpr trivial(trivial &&) noexcept = default;
constexpr trivial &operator=(trivial &&) noexcept = default;
constexpr ~trivial() = default;
};
// This is the base storage for non-trivial types.
// In this storage solution, elements are stored in type-erased byte storage,
// thus, reinterpret_cast must be used,
// which makes inplace_vector of non-trivial types non-constexpr-friendly.
//
// Note: This is not used if trivial union is supported.
template <class T, size_t N> struct raw_byte_based_storage {
alignas(T) std::byte _d[sizeof(T) * N];
T *storage_data(size_t i) noexcept {
IV_EXPECT(i < N);
return reinterpret_cast<T *>(_d) + i;
}
const T *storage_data(size_t i) const noexcept {
IV_EXPECT(i < N);
return reinterpret_cast<const T *>(_d) + i;
}
};
/// Storage for non-trivial elements.
template <class T, size_t N> struct non_trivial {
static_assert(!satisfy_triviality<T>,
"use storage::trivial for Trivial<T> elements");
static_assert(N != size_t{0}, "use storage::zero for N==0");
protected:
using size_type = smallest_size_t<N>;
private:
using byte_based_storage = raw_byte_based_storage<std::remove_const_t<T>, N>;
byte_based_storage storage_data_{}; // BUGBUG: test SIMD types
size_type storage_size_ = 0;
protected:
constexpr const T *storage_data() const noexcept {
return storage_data_.storage_data(0);
}
constexpr auto storage_data() noexcept {
return storage_data_.storage_data(0);
}
constexpr size_type storage_size() const noexcept { return storage_size_; }
constexpr void unsafe_set_size(size_t new_size) noexcept {
IV_EXPECT(size_type(new_size) <= N && "new_size out-of-bounds [0, N)");
storage_size_ = size_type(new_size);
}
public:
constexpr non_trivial() noexcept = default;
constexpr non_trivial(non_trivial const &) noexcept = default;
constexpr non_trivial &operator=(non_trivial const &) noexcept = default;
constexpr non_trivial(non_trivial &&) noexcept = default;
constexpr non_trivial &operator=(non_trivial &&) noexcept = default;
constexpr ~non_trivial()
requires(std::is_trivially_destructible_v<T>)
= default;
constexpr ~non_trivial() {
std::destroy(storage_data(), storage_data() + storage_size());
}
};
// Selects the vector storage.
template <class T, size_t N>
using storage_for = std::conditional_t<
!satisfy_constexpr<T, N>, non_trivial<T, N>,
std::conditional_t<N == 0, zero_sized<T>, trivial<T, N>>>;
} // namespace storage
template <class T, size_t N>
struct inplace_vector_base : private storage::storage_for<T, N> {
protected:
static_assert(std::is_nothrow_destructible_v<T>,
"T must be nothrow destructible");
using base_t = storage::storage_for<T, N>;
using base_t::storage_data;
using base_t::storage_size;
using base_t::unsafe_set_size;
public:
using value_type = T;
using pointer = T *;
using const_pointer = const T *;
using reference = value_type &;
using const_reference = const value_type &;
using size_type = size_t;
using difference_type = std::ptrdiff_t;
using iterator = pointer;
using const_iterator = const_pointer;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
// iterators
constexpr iterator begin() noexcept { return storage_data(); }
constexpr const_iterator begin() const noexcept { return storage_data(); }
constexpr iterator end() noexcept { return begin() + size(); }
constexpr const_iterator end() const noexcept { return begin() + size(); }
constexpr reverse_iterator rbegin() noexcept {
return reverse_iterator(end());
}
constexpr const_reverse_iterator rbegin() const noexcept {
return const_reverse_iterator(end());
}
constexpr reverse_iterator rend() noexcept {
return reverse_iterator(begin());
}
constexpr const_reverse_iterator rend() const noexcept {
return const_reverse_iterator(begin());
}
constexpr const_iterator cbegin() const noexcept { return storage_data(); }
constexpr const_iterator cend() const noexcept { return cbegin() + size(); }
constexpr const_reverse_iterator crbegin() const noexcept {
return const_reverse_iterator(cend());
}
constexpr const_reverse_iterator crend() const noexcept {
return const_reverse_iterator(cbegin());
}
// [inplace.vector.capacity], size/capacity
[[nodiscard]] constexpr bool empty() const noexcept {
return storage_size() == 0;
};
constexpr size_type size() const noexcept { return storage_size(); }
constexpr void shrink_to_fit() {}
static constexpr size_type max_size() noexcept { return N; }
static constexpr size_type capacity() noexcept { return N; }
// element access
constexpr reference operator[](size_type n) {
return details::index(*this, n);
}
constexpr const_reference operator[](size_type n) const {
return details::index(*this, n);
}
constexpr reference front() { return details::index(*this, size_type(0)); }
constexpr const_reference front() const {
return details::index(*this, size_type(0));
}
constexpr reference back() {
return details::index(*this, size() - size_type(1));
}
constexpr const_reference back() const {
return details::index(*this, size() - size_type(1));
}
// [containers.sequences.inplace_vector.data], data access
constexpr T *data() noexcept { return storage_data(); }
constexpr const T *data() const noexcept { return storage_data(); }
protected: // Utilities
constexpr void
assert_iterator_in_range([[maybe_unused]] const_iterator it) noexcept {
IV_EXPECT(begin() <= it && "iterator not in range");
IV_EXPECT(it <= end() && "iterator not in range");
}
constexpr void
assert_valid_iterator_pair([[maybe_unused]] const_iterator first,
[[maybe_unused]] const_iterator last) noexcept {
IV_EXPECT(first <= last && "invalid iterator pair");
}
constexpr void assert_iterator_pair_in_range(const_iterator first,
const_iterator last) noexcept {
assert_iterator_in_range(first);
assert_iterator_in_range(last);
assert_valid_iterator_pair(first, last);
}
constexpr void
unsafe_destroy(T *first,
T *last) noexcept(std::is_nothrow_destructible_v<T>) {
assert_iterator_pair_in_range(first, last);
if constexpr (N > 0 && !std::is_trivially_destructible_v<T>) {
for (; first != last; ++first)
first->~T();
}
}
public:
// [inplace.vector.modifiers], modifiers
template <class... Args>
constexpr T &unchecked_emplace_back(Args &&...args)
requires(std::constructible_from<T, Args...>)
{
IV_EXPECT(size() < capacity() && "inplace_vector out-of-memory");
std::construct_at(storage_data() + size(), std::forward<Args>(args)...);
unsafe_set_size(size() + size_type(1));
return this->back();
}
template <class... Args> constexpr T *try_emplace_back(Args &&...args) {
if (size() == capacity()) [[unlikely]]
return nullptr;
return &unchecked_emplace_back(std::forward<Args>(args)...);
}
constexpr T *try_push_back(const T &x)
requires(std::constructible_from<T, const T &>)
{
return try_emplace_back(x);
}
constexpr T *try_push_back(T &&x)
requires(std::constructible_from<T, T &&>)
{
return try_emplace_back(std::forward<T &&>(x));
}
constexpr T &unchecked_push_back(const T &x)
requires(std::constructible_from<T, const T &>)
{
return unchecked_emplace_back(x);
}
constexpr T &unchecked_push_back(T &&x)
requires(std::constructible_from<T, T &&>)
{
return unchecked_emplace_back(std::forward<T &&>(x));
}
template <details::container_compatible_range<T> R>
constexpr std::ranges::borrowed_iterator_t<R> try_append_range(R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>>)
{
auto it = std::ranges::begin(rg);
const auto end = std::ranges::end(rg);
for (; size() != capacity() && it != end; ++it) {
unchecked_emplace_back(*it);
}
return it;
}
constexpr iterator erase(const_iterator first, const_iterator last)
requires(std::movable<T>)
{
assert_iterator_pair_in_range(first, last);
iterator f = begin() + (first - begin());
if (first != last) {
unsafe_destroy(std::move(f + (last - first), end(), f), end());
unsafe_set_size(size() - static_cast<size_type>(last - first));
}
return f;
}
constexpr iterator erase(const_iterator position)
requires(std::movable<T>)
{
return erase(position, position + 1);
}
constexpr void clear() noexcept {
unsafe_destroy(begin(), end());
unsafe_set_size(0);
}
constexpr void pop_back() {
IV_EXPECT(size() > 0 && "pop_back from empty inplace_vector!");
if (size() > 0) { // UB fail-safe
unsafe_destroy(end() - 1, end());
unsafe_set_size(size() - 1);
}
}
constexpr friend bool operator==(const inplace_vector_base &x,
const inplace_vector_base &y) {
return x.size() == y.size() && std::ranges::equal(x, y);
}
constexpr void swap(inplace_vector_base &x) noexcept(
N == 0 || (std::is_nothrow_swappable_v<T> &&
std::is_nothrow_move_constructible_v<T>))
requires(std::movable<T>)
{
auto tmp = std::move(x);
x = std::move(*this);
(*this) = std::move(tmp);
}
constexpr friend void
swap(inplace_vector_base &x, inplace_vector_base &y) noexcept(
N == 0 || (std::is_nothrow_swappable_v<T> &&
std::is_nothrow_move_constructible_v<T>)) {
x.swap(y);
}
constexpr friend auto operator<=>(const inplace_vector_base &x,
const inplace_vector_base &y)
requires(details::lessthan_comparable<T>)
{
if constexpr (std::three_way_comparable<T>) {
return std::lexicographical_compare_three_way(x.begin(), x.end(),
y.begin(), y.end());
} else {
const auto sz = std::min(x.size(), y.size());
for (std::size_t i = 0; i < sz; ++i) {
if (x[i] < y[i])
return std::strong_ordering::less;
if (y[i] < x[i])
return std::strong_ordering::greater;
// [container.opt.reqmts] < must be total ordering relationship
}
return x.size() <=> y.size();
}
}
// [containers.sequences.inplace_vector.cons], construct/copy/destroy
constexpr inplace_vector_base() noexcept = default;
constexpr inplace_vector_base(const inplace_vector_base &x)
requires(N == 0 || std::is_trivially_copy_constructible_v<T>)
= default;
constexpr inplace_vector_base(const inplace_vector_base &x)
requires(N != 0 && !std::is_trivially_copy_constructible_v<T> &&
std::copyable<T>)
{
for (auto &&e : x)
unchecked_emplace_back(e);
}
constexpr inplace_vector_base(inplace_vector_base &&x)
requires(N == 0 || std::is_trivially_move_constructible_v<T>)
= default;
constexpr inplace_vector_base(inplace_vector_base &&x)
requires(N != 0 && !std::is_trivially_move_constructible_v<T> &&
std::movable<T>)
{
for (auto &&e : x)
unchecked_emplace_back(std::move(e));
}
constexpr inplace_vector_base &operator=(const inplace_vector_base &x)
requires(N == 0 || (std::is_trivially_destructible_v<T> &&
std::is_trivially_copy_constructible_v<T> &&
std::is_trivially_copy_assignable_v<T>))
= default;
constexpr inplace_vector_base &operator=(const inplace_vector_base &x)
requires(N != 0 &&
!(std::is_trivially_destructible_v<T> &&
std::is_trivially_copy_constructible_v<T> &&
std::is_trivially_copy_assignable_v<T>) &&
std::copyable<T>)
{
clear();
for (auto &&e : x)
unchecked_emplace_back(e);
return *this;
}
constexpr inplace_vector_base &operator=(inplace_vector_base &&x)
requires(N == 0 || (std::is_trivially_destructible_v<T> &&
std::is_trivially_move_constructible_v<T> &&
std::is_trivially_move_assignable_v<T>))
= default;
constexpr inplace_vector_base &operator=(inplace_vector_base &&x)
requires(N != 0 &&
!(std::is_trivially_destructible_v<T> &&
std::is_trivially_move_constructible_v<T> &&
std::is_trivially_move_assignable_v<T>) &&
std::movable<T>)
{
clear();
for (auto &&e : x)
unchecked_emplace_back(std::move(e));
return *this;
}
};
} // namespace beman::inplace_vector::details
namespace beman::inplace_vector {
template <typename IV>
concept has_constexpr_support =
details::satisfy_constexpr<typename IV::value_type, IV::capacity()>;
/// Dynamically-resizable fixed-N vector with inplace storage.
template <class T, size_t N>
struct inplace_vector : public details::inplace_vector_base<T, N> {
using value_type = T;
using pointer = T *;
using const_pointer = const T *;
using reference = value_type &;
using const_reference = const value_type &;
using size_type = size_t;
using difference_type = std::ptrdiff_t;
using iterator = pointer;
using const_iterator = const_pointer;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
// [containers.sequences.inplace_vector.modifiers], modifiers
template <class... Args>
constexpr T &emplace_back(Args &&...args)
requires(std::constructible_from<T, Args...>)
{
if (!this->try_emplace_back(std::forward<Args>(args)...)) [[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::bad_alloc());
}
return this->back();
}
constexpr T &push_back(const T &x)
requires(std::constructible_from<T, const T &>)
{
emplace_back(x);
return this->back();
}
constexpr T &push_back(T &&x)
requires(std::constructible_from<T, T &&>)
{
emplace_back(std::forward<T &&>(x));
return this->back();
}
template <details::container_compatible_range<T> R>
constexpr void append_range(R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>>)
{
if constexpr (std::ranges::sized_range<R>) {
if (this->size() + std::ranges::size(rg) > this->capacity())
[[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::bad_alloc());
}
}
for (auto &&e : rg) {
if (this->size() == this->capacity()) [[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::bad_alloc());
}
emplace_back(std::forward<decltype(e)>(e));
}
}
template <class... Args>
constexpr iterator emplace(const_iterator position, Args &&...args)
requires(std::constructible_from<T, Args...> && std::movable<T>)
{
this->assert_iterator_in_range(position);
auto b = this->end();
emplace_back(std::forward<Args>(args)...);
auto pos = this->begin() + (position - this->begin());
std::rotate(pos, b, this->end());
return pos;
}
template <class InputIterator>
constexpr iterator insert(const_iterator position, InputIterator first,
InputIterator last)
requires(std::constructible_from<T, std::iter_reference_t<InputIterator>> &&
std::movable<T>)
{
this->assert_iterator_in_range(position);
if constexpr (std::random_access_iterator<InputIterator>) {
if (this->size() + static_cast<size_type>(std::distance(first, last)) >
this->capacity()) [[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::bad_alloc());
}
}
auto b = this->end();
for (; first != last; ++first)
emplace_back(*first);
auto pos = this->begin() + (position - this->begin());
std::rotate(pos, b, this->end());
return pos;
}
template <details::container_compatible_range<T> R>
constexpr iterator insert_range(const_iterator position, R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>> &&
std::movable<T>)
{
return insert(position, std::begin(rg), std::end(rg));
}
constexpr iterator insert(const_iterator position,
std::initializer_list<T> il)
requires(std::constructible_from<
T, std::ranges::range_reference_t<std::initializer_list<T>>> &&
std::movable<T>)
{
return insert_range(position, il);
}
constexpr iterator insert(const_iterator position, size_type n, const T &x)
requires(std::constructible_from<T, const T &> && std::copyable<T>)
{
this->assert_iterator_in_range(position);
auto b = this->end();
for (size_type i = 0; i < n; ++i)
emplace_back(x);
auto pos = this->begin() + (position - this->begin());
std::rotate(pos, b, this->end());
return pos;
}
constexpr iterator insert(const_iterator position, const T &x)
requires(std::constructible_from<T, const T &> && std::copyable<T>)
{
return insert(position, 1, x);
}
constexpr iterator insert(const_iterator position, T &&x)
requires(std::constructible_from<T, T &&> && std::movable<T>)
{
return emplace(position, std::move(x));
}
constexpr inplace_vector &operator=(std::initializer_list<T> il)
requires(std::constructible_from<
T, std::ranges::range_reference_t<std::initializer_list<T>>> &&
std::movable<T>)
{
assign_range(il);
return *this;
}
template <class InputIterator>
constexpr void assign(InputIterator first, InputIterator last)
requires(std::constructible_from<T, std::iter_reference_t<InputIterator>> &&
std::movable<T>)
{
this->clear();
insert(this->begin(), first, last);
}
template <details::container_compatible_range<T> R>
constexpr void assign_range(R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>> &&
std::movable<T>)
{
assign(std::begin(rg), std::end(rg));
}
constexpr void assign(size_type n, const T &u)
requires(std::constructible_from<T, const T &> && std::movable<T>)
{
this->clear();
insert(this->begin(), n, u);
}
constexpr void assign(std::initializer_list<T> il)
requires(std::constructible_from<
T, std::ranges::range_reference_t<std::initializer_list<T>>> &&
std::movable<T>)
{
this->clear();
insert_range(this->begin(), il);
}
// [inplace.vector.capacity], size/capacity
constexpr void reserve(size_type n) {
if (n > N) [[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::bad_alloc());
}
}
constexpr void resize(size_type sz, const T &c)
requires(std::constructible_from<T, const T &> && std::copyable<T>)
{
if (sz == this->size())
return;
else if (sz > N) [[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::bad_alloc());
} else if (sz > this->size())
insert(this->end(), sz - this->size(), c);
else {
this->unsafe_destroy(this->begin() + sz, this->end());
this->unsafe_set_size(sz);
}
}
constexpr void resize(size_type sz)
requires(std::constructible_from<T, T &&> && std::default_initializable<T>)
{
if (sz == this->size())
return;
else if (sz > N) [[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::bad_alloc());
} else if (sz > this->size()) {
while (this->size() != sz)
emplace_back(T{});
} else {
this->unsafe_destroy(this->begin() + sz, this->end());
this->unsafe_set_size(sz);
}
}
// element access
constexpr reference at(size_type pos) {
if (pos >= this->size()) [[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::out_of_range("inplace_vector::at"));
}
return details::index(*this, pos);
}
constexpr const_reference at(size_type pos) const {
if (pos >= this->size()) [[unlikely]] {
BEMAN_IV_THROW_OR_ABORT(std::out_of_range("inplace_vector::at"));
}
return details::index(*this, pos);
}
// [containers.sequences.inplace_vector.cons], construct/copy/destroy
constexpr inplace_vector() noexcept = default;
constexpr inplace_vector(std::initializer_list<T> il)
requires(std::constructible_from<
T, std::ranges::range_reference_t<std::initializer_list<T>>> &&
std::movable<T>)
{
insert(this->begin(), il);
}
constexpr inplace_vector(size_type n, const T &value)
requires(std::constructible_from<T, const T &> && std::copyable<T>)
{
insert(this->begin(), n, value);
}
constexpr explicit inplace_vector(size_type n)
requires(std::constructible_from<T, T &&> && std::default_initializable<T>)
{
for (size_type i = 0; i < n; ++i)
emplace_back(T{});
}
template <class InputIterator> // BUGBUG: why not std::ranges::input_iterator?
constexpr inplace_vector(InputIterator first, InputIterator last)
requires(std::constructible_from<T, std::iter_reference_t<InputIterator>> &&
std::movable<T>)
{
insert(this->begin(), first, last);
}
template <details::container_compatible_range<T> R>
constexpr inplace_vector(details::from_range_t, R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>> &&
std::movable<T>)
{
insert_range(this->begin(), std::forward<R &&>(rg));
}
};
namespace freestanding {
template <class T, size_t N>
struct inplace_vector : public details::inplace_vector_base<T, N> {
using value_type = T;
using pointer = T *;
using const_pointer = const T *;
using reference = value_type &;
using const_reference = const value_type &;
using size_type = size_t;
using difference_type = std::ptrdiff_t;
using iterator = pointer;
using const_iterator = const_pointer;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
// [containers.sequences.inplace_vector.modifiers], modifiers
template <class... Args>
constexpr T &emplace_back(Args &&...args)
requires(std::constructible_from<T, Args...>)
= delete;
constexpr T &push_back(const T &x)
requires(std::constructible_from<T, const T &>)
= delete;
constexpr T &push_back(T &&x)
requires(std::constructible_from<T, T &&>)
= delete;
template <details::container_compatible_range<T> R>
constexpr void append_range(R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>>)
= delete;
template <class... Args>
constexpr iterator emplace(const_iterator position, Args &&...args)
requires(std::constructible_from<T, Args...> && std::movable<T>)
= delete;
template <class InputIterator>
constexpr iterator insert(const_iterator position, InputIterator first,
InputIterator last)
requires(std::constructible_from<T, std::iter_reference_t<InputIterator>> &&
std::movable<T>)
= delete;
template <details::container_compatible_range<T> R>
constexpr iterator insert_range(const_iterator position, R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>> &&
std::movable<T>)
= delete;
constexpr iterator insert(const_iterator position,
std::initializer_list<T> il)
requires(std::constructible_from<
T, std::ranges::range_reference_t<std::initializer_list<T>>> &&
std::movable<T>)
= delete;
constexpr iterator insert(const_iterator position, size_type n, const T &x)
requires(std::constructible_from<T, const T &> && std::copyable<T>)
= delete;
constexpr iterator insert(const_iterator position, const T &x)
requires(std::constructible_from<T, const T &> && std::copyable<T>)
= delete;
constexpr iterator insert(const_iterator position, T &&x)
requires(std::constructible_from<T, T &&> && std::movable<T>)
= delete;
constexpr inplace_vector &operator=(std::initializer_list<T> il)
requires(std::constructible_from<
T, std::ranges::range_reference_t<std::initializer_list<T>>> &&
std::movable<T>)
= delete;
template <class InputIterator>
constexpr void assign(InputIterator first, InputIterator last)
requires(std::constructible_from<T, std::iter_reference_t<InputIterator>> &&
std::movable<T>)
= delete;
template <details::container_compatible_range<T> R>
constexpr void assign_range(R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>> &&
std::movable<T>)
= delete;
constexpr void assign(size_type n, const T &u)
requires(std::constructible_from<T, const T &> && std::movable<T>)
= delete;
constexpr void assign(std::initializer_list<T> il)
requires(std::constructible_from<
T, std::ranges::range_reference_t<std::initializer_list<T>>> &&
std::movable<T>)
= delete;
// [inplace.vector.capacity], size/capacity
constexpr void reserve(size_type n) = delete;
constexpr void resize(size_type sz, const T &c)
requires(std::constructible_from<T, const T &> && std::copyable<T>)
= delete;
constexpr void resize(size_type sz)
requires(std::constructible_from<T, T &&> && std::default_initializable<T>)
= delete;
// element access
constexpr reference at(size_type pos) = delete;
constexpr const_reference at(size_type pos) const = delete;
// [containers.sequences.inplace_vector.cons], construct/copy/destroy
constexpr inplace_vector() noexcept = default;
constexpr inplace_vector(std::initializer_list<T> il)
requires(std::constructible_from<
T, std::ranges::range_reference_t<std::initializer_list<T>>> &&
std::movable<T>)
= delete;
constexpr inplace_vector(size_type n, const T &value)
requires(std::constructible_from<T, const T &> && std::copyable<T>)
= delete;
constexpr explicit inplace_vector(size_type n)
requires(std::constructible_from<T, T &&> && std::default_initializable<T>)
= delete;
template <class InputIterator> // BUGBUG: why not std::ranges::input_iterator?
constexpr inplace_vector(InputIterator first, InputIterator last)
requires(std::constructible_from<T, std::iter_reference_t<InputIterator>> &&
std::movable<T>)
= delete;
template <details::container_compatible_range<T> R>
constexpr inplace_vector(beman::inplace_vector::details::from_range_t, R &&rg)
requires(std::constructible_from<T, std::ranges::range_reference_t<R>> &&
std::movable<T>)
= delete;
};
} // namespace freestanding
template <typename T, std::size_t N, typename U = T>
constexpr std::size_t erase(details::inplace_vector_base<T, N> &c,
const U &value) {
auto it = std::remove(c.begin(), c.end(), value);
auto r = std::distance(it, c.end());
c.erase(it, c.end());
return r;
}
template <typename T, std::size_t N, typename Predicate>
constexpr std::size_t erase_if(details::inplace_vector_base<T, N> &c,
Predicate pred) {
auto it = std::remove_if(c.begin(), c.end(), pred);
auto r = std::distance(it, c.end());
c.erase(it, c.end());
return r;
}
} // namespace beman::inplace_vector
#undef IV_EXPECT
#endif // BEMAN_INPLACE_VECTOR_INPLACE_VECTOR_HPP
+19530 -19558
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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-ueg/GDnKP4nRVepdNE3sgK8sYckZc0aaC0CQc3tuxik=";
hash = "sha256-wGqvTI/X22apc8XCN3GCGQClHfBW5xk73mZnwWvHtyI=";
};
};
+1 -1
View File
@@ -319,7 +319,7 @@ modules:
sources:
- type: git
url: https://github.com/Supreeeme/xrizer.git
tag: 01ab72809f2bd5c6494fa77fb08e4229c886da7a
tag: be664bb93eebdd82336d00230154bacc6f8b9765
- xrizer-gen-src.json
- name: wivrn-library
+42 -30
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-02 14:05+0100\n"
"POT-Creation-Date: 2026-02-16 21:54+0100\n"
"PO-Revision-Date: 2025-11-19 20:20+0100\n"
"Last-Translator: Álvaro De Quinta <blackcherry@danwin1210.de>\n"
"Language-Team: Spanish <>\n"
@@ -119,8 +119,8 @@ msgstr "Comprobando la última versión..."
msgid "No APK is available for this version"
msgstr "No hay ningún APK disponible para esta versión"
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:368
#: dashboard/qml/Main.qml:426 dashboard/qml/WizardPage.qml:211
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:376
#: dashboard/qml/Main.qml:434 dashboard/qml/WizardPage.qml:211
#: dashboard/qml/WizardPage.qml:337
#, kde-format
msgid "ADB is not installed"
@@ -163,7 +163,7 @@ msgstr "Reinstalar WiVRn"
msgid "Install WiVRn"
msgstr "Instalar WiVRn"
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:431
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:439
#, kde-format
msgid "Headsets"
msgstr "Visores"
@@ -290,7 +290,7 @@ msgid "Avahi daemon is not started"
msgstr "El servicio Avahi no está iniciado"
#: dashboard/qml/Main.qml:157 dashboard/qml/Main.qml:171
#: dashboard/qml/Main.qml:223
#: dashboard/qml/Main.qml:231
#, kde-format
msgid "Fix it"
msgstr "Arreglarlo"
@@ -315,6 +315,18 @@ msgstr "Más información"
#: dashboard/qml/Main.qml:193
#, kde-format
msgid "Vulkan drivers cannot be found, you may need to run \"flatpak update\""
msgstr ""
"Los drivers Vulkan no se han encontrado, puede ser que necesite ejecutar "
"\"flatpak update\""
#: dashboard/qml/Main.qml:193
#, kde-format
msgid "Vulkan drivers cannot be found"
msgstr "Los drivers Vulkan no se han encontrado"
#: dashboard/qml/Main.qml:201
#, kde-format
msgid ""
"Use the Mesa (radv) driver for AMD GPUs\n"
"Hardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO"
@@ -322,7 +334,7 @@ msgstr ""
"Usa el controlador Mesa (radv) para las GPU AMD\n"
"La codificación por hardware con vaapi no funciona con AMDVLK y AMDGPU-PRO"
#: dashboard/qml/Main.qml:201
#: dashboard/qml/Main.qml:209
#, kde-format
msgid ""
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
@@ -332,127 +344,127 @@ msgstr ""
"en VR.\n"
"Instala xrizer o OpenComposite."
#: dashboard/qml/Main.qml:209
#: dashboard/qml/Main.qml:217
#, kde-format
msgid "Steam is installed as a snap. Snaps are not compatible with WiVRn."
msgstr ""
"Steam está instalado mediante snap. Los Snaps no son compatibles con WiVRn."
#: dashboard/qml/Main.qml:217
#: dashboard/qml/Main.qml:225
#, kde-format
msgid ""
"Steam is installed as a flatpak but does not have sufficient permissions."
msgstr ""
"Steam está instalado con flatpak, pero no tiene los suficientes permisos."
#: dashboard/qml/Main.qml:232
#: dashboard/qml/Main.qml:240
#, kde-format
msgid "Restart the server for configuration changes to take effect"
msgstr "Reinicia el servidor para que los cambios surtan efecto"
#: dashboard/qml/Main.qml:238
#: dashboard/qml/Main.qml:246
#, kde-format
msgctxt "restart the server"
msgid "Restart now"
msgstr "Reiniciar ahora"
#: dashboard/qml/Main.qml:263
#: dashboard/qml/Main.qml:271
#, kde-format
msgid "Server failed to start"
msgstr "El servidor no pudo iniciar"
#: dashboard/qml/Main.qml:269 dashboard/qml/TroubleshootPage.qml:89
#: dashboard/qml/Main.qml:277 dashboard/qml/TroubleshootPage.qml:89
#, kde-format
msgid "Open server logs"
msgstr "Abrir registros del servidor"
#: dashboard/qml/Main.qml:295
#: dashboard/qml/Main.qml:303
#, kde-format
msgid "Server status"
msgstr "Estado del servidor"
#: dashboard/qml/Main.qml:301
#: dashboard/qml/Main.qml:309
#, kde-format
msgctxt "whether the server is running, displayed in front of a checkbox"
msgid "Running"
msgstr "En ejecución"
#: dashboard/qml/Main.qml:314
#: dashboard/qml/Main.qml:322
#, kde-format
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
msgid "Pairing"
msgstr "Emparejando"
#: dashboard/qml/Main.qml:334
#: dashboard/qml/Main.qml:342
#, kde-format
msgid "Headset status"
msgstr "Estado del visor"
#: dashboard/qml/Main.qml:341
#: dashboard/qml/Main.qml:349
#, kde-format
msgctxt "label for headset name/status under server running switch"
msgid "Headset"
msgstr "Visor"
#: dashboard/qml/Main.qml:344
#: dashboard/qml/Main.qml:352
#, kde-format
msgid "Not connected"
msgstr "No conectado"
#: dashboard/qml/Main.qml:348
#: dashboard/qml/Main.qml:356
#, kde-format
msgid "Disconnect"
msgstr "Desconectar"
#: dashboard/qml/Main.qml:357 dashboard/qml/Main.qml:365
#: dashboard/qml/Main.qml:372
#: dashboard/qml/Main.qml:365 dashboard/qml/Main.qml:373
#: dashboard/qml/Main.qml:380
#, kde-format
msgctxt "label for USB status or connect button"
msgid "USB"
msgstr "USB"
#: dashboard/qml/Main.qml:358
#: dashboard/qml/Main.qml:366
#, kde-format
msgctxt "usb connect button"
msgid "Connect (wired)"
msgstr "Conectar (cableado)"
#: dashboard/qml/Main.qml:375 dashboard/qml/WizardPage.qml:339
#: dashboard/qml/Main.qml:383 dashboard/qml/WizardPage.qml:339
#, kde-format
msgid "No headset is connected or your headset is not in developer mode"
msgstr "No hay ningún visor conectado o tu visor no está en modo desarrollador"
#: dashboard/qml/Main.qml:396
#: dashboard/qml/Main.qml:404
#, kde-format
msgid "Steam information"
msgstr "Información de Steam"
#: dashboard/qml/Main.qml:412
#: dashboard/qml/Main.qml:420
#, kde-format
msgid "Wizard"
msgstr "Asistente"
#: dashboard/qml/Main.qml:418
#: dashboard/qml/Main.qml:426
#, kde-format
msgid "Install the app"
msgstr "Instalar aplicación"
#: dashboard/qml/Main.qml:437 dashboard/qml/SettingsPage.qml:14
#: dashboard/qml/Main.qml:445 dashboard/qml/SettingsPage.qml:14
#, kde-format
msgid "Settings"
msgstr "Ajustes"
#: dashboard/qml/Main.qml:443
#: dashboard/qml/Main.qml:451
#, kde-format
msgid "About"
msgstr "Acerca de"
#: dashboard/qml/Main.qml:448 dashboard/qml/TroubleshootPage.qml:10
#: dashboard/qml/Main.qml:456 dashboard/qml/TroubleshootPage.qml:10
#, kde-format
msgid "Troubleshoot"
msgstr "Solucionar problemas"
#: dashboard/qml/Main.qml:455
#: dashboard/qml/Main.qml:463
#, kde-format
msgid "Version %1"
msgstr "Versión %1"
+56 -56
View File
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn 0.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-06 23:11+0100\n"
"POT-Creation-Date: 2026-02-15 00:02+0100\n"
"PO-Revision-Date: 2025-11-19 20:23+0100\n"
"Last-Translator: Álvaro De Quinta <blackcherry@danwin1210.de>\n"
"Language-Team: Spanish <>\n"
@@ -70,11 +70,11 @@ msgstr "No se puede conectar a {} ({}): {}"
msgid "Waiting for connection"
msgstr "Esperando conexión"
#: client/scenes/lobby.cpp:1316
#: client/scenes/lobby.cpp:1307
msgid "Passthrough"
msgstr "Exterior"
#: client/scenes/lobby.cpp:1328
#: client/scenes/lobby.cpp:1319
msgid "Default environment"
msgstr "Entorno por defecto"
@@ -94,13 +94,13 @@ msgid "Disabled"
msgstr "Deshabilitado"
#: client/scenes/lobby_gui.cpp:114 client/scenes/lobby_gui.cpp:258
#: client/scenes/stream_gui.cpp:1010
#: client/scenes/stream_gui.cpp:992
msgid "Disconnect"
msgstr "Desconectar"
#: client/scenes/lobby_gui.cpp:134 client/scenes/lobby_gui_customize.cpp:753
#: client/scenes/lobby_gui_customize.cpp:844
#: client/scenes/lobby_gui_customize.cpp:900 client/scenes/stream_gui.cpp:1006
#: client/scenes/lobby_gui_customize.cpp:900 client/scenes/stream_gui.cpp:988
msgid "Close"
msgstr "Cerrar"
@@ -138,7 +138,7 @@ msgid "TCP only"
msgstr "Solo TCP"
#: client/scenes/lobby_gui.cpp:319 client/scenes/lobby_gui_customize.cpp:655
#: client/scenes/stream_gui.cpp:962
#: client/scenes/stream_gui.cpp:944
msgid "Cancel"
msgstr "Cancelar"
@@ -183,17 +183,17 @@ msgstr "Idioma"
msgid "System language"
msgstr "Idioma del sistema"
#: client/scenes/lobby_gui.cpp:580 client/scenes/stream_gui.cpp:411
#: client/scenes/lobby_gui.cpp:580 client/scenes/stream_gui.cpp:413
msgid "Refresh rate"
msgstr "Frecuencia de actualización"
#: client/scenes/lobby_gui.cpp:580 client/scenes/lobby_gui.cpp:582
#: client/scenes/stream_gui.cpp:411 client/scenes/stream_gui.cpp:413
#: client/scenes/stream_gui.cpp:413 client/scenes/stream_gui.cpp:415
msgctxt "automatic refresh rate"
msgid "Automatic"
msgstr "Automática"
#: client/scenes/lobby_gui.cpp:589 client/scenes/stream_gui.cpp:421
#: client/scenes/lobby_gui.cpp:589 client/scenes/stream_gui.cpp:423
msgid ""
"Select refresh rate based on measured application performance.\n"
"May cause flicker when a change happens."
@@ -202,7 +202,7 @@ msgstr ""
"aplicación.\n"
"Puede causar parpadeos cuando ocurre un cambio."
#: client/scenes/lobby_gui.cpp:606 client/scenes/stream_gui.cpp:439
#: client/scenes/lobby_gui.cpp:606 client/scenes/stream_gui.cpp:441
msgid "Minimum refresh rate"
msgstr "Tasa mínima de refresco"
@@ -392,15 +392,15 @@ msgstr ""
"Permitir valores de configuración inseguros, usar bajo propia "
"responsabilidad."
#: client/scenes/lobby_gui.cpp:920 client/scenes/stream_gui.cpp:473
#: client/scenes/lobby_gui.cpp:920 client/scenes/stream_gui.cpp:475
msgid "OpenXR post-processing"
msgstr "Post-procesamiento de OpenXR"
#: client/scenes/lobby_gui.cpp:924 client/scenes/stream_gui.cpp:477
#: client/scenes/lobby_gui.cpp:924 client/scenes/stream_gui.cpp:479
msgid "Supersampling"
msgstr "Sobremuestreo"
#: client/scenes/lobby_gui.cpp:944 client/scenes/stream_gui.cpp:498
#: client/scenes/lobby_gui.cpp:944 client/scenes/stream_gui.cpp:500
msgid ""
"Reduce flicker for high contrast edges.\n"
"Useful when the input resolution is high compared to the headset display"
@@ -409,11 +409,11 @@ msgstr ""
"Útil cuando la resolución de entrada es alta comparada con la pantalla del "
"visor"
#: client/scenes/lobby_gui.cpp:949 client/scenes/stream_gui.cpp:503
#: client/scenes/lobby_gui.cpp:949 client/scenes/stream_gui.cpp:505
msgid "Sharpening"
msgstr "Nitidez"
#: client/scenes/lobby_gui.cpp:969 client/scenes/stream_gui.cpp:524
#: client/scenes/lobby_gui.cpp:969 client/scenes/stream_gui.cpp:526
msgid ""
"Improve clarity of high contrast edges and counteract blur.\n"
"Useful when the input resolution is low compared to the headset display"
@@ -423,7 +423,7 @@ msgstr ""
"visor"
#: client/scenes/lobby_gui.cpp:1153 client/scenes/lobby_gui.cpp:1161
#: client/scenes/stream_gui.cpp:172 client/scenes/stream_gui.cpp:370
#: client/scenes/stream_gui.cpp:174 client/scenes/stream_gui.cpp:372
msgid "CPU time"
msgstr "Tiempo de CPU"
@@ -432,7 +432,7 @@ msgid "CPU time [ms]"
msgstr "Tiempo de CPU [ms]"
#: client/scenes/lobby_gui.cpp:1167 client/scenes/lobby_gui.cpp:1175
#: client/scenes/stream_gui.cpp:174 client/scenes/stream_gui.cpp:371
#: client/scenes/stream_gui.cpp:176 client/scenes/stream_gui.cpp:373
msgid "GPU time"
msgstr "Tiempo de GPU"
@@ -520,7 +520,7 @@ msgstr "Agregar servidor"
msgid "Server list"
msgstr "Lista de servidores"
#: client/scenes/lobby_gui.cpp:1940 client/scenes/stream_gui.cpp:991
#: client/scenes/lobby_gui.cpp:1940 client/scenes/stream_gui.cpp:973
msgid "Settings"
msgstr "Configuración"
@@ -631,160 +631,160 @@ msgstr "Descargar más entornos"
msgid "Open local glTF model"
msgstr "Abrir modelo glTF local"
#: client/scenes/stream_gui.cpp:174
#: client/scenes/stream_gui.cpp:176
msgid "Defoveate"
msgstr "Desfovear"
#: client/scenes/stream_gui.cpp:176
#: client/scenes/stream_gui.cpp:178
msgid "Network"
msgstr "Red"
#: client/scenes/stream_gui.cpp:176 client/scenes/stream_gui.cpp:368
#: client/scenes/stream_gui.cpp:178 client/scenes/stream_gui.cpp:370
msgid "Download"
msgstr "Descargar"
#: client/scenes/stream_gui.cpp:177 client/scenes/stream_gui.cpp:369
#: client/scenes/stream_gui.cpp:179 client/scenes/stream_gui.cpp:371
msgid "Upload"
msgstr "Subir"
#: client/scenes/stream_gui.cpp:246
#: client/scenes/stream_gui.cpp:248
#, c++-format
msgid "Decoder {}"
msgstr "Decodificador {}"
#: client/scenes/stream_gui.cpp:258
#: client/scenes/stream_gui.cpp:260
msgid "Timings [ms]"
msgstr "Tiempos [ms]"
#: client/scenes/stream_gui.cpp:318
#: client/scenes/stream_gui.cpp:320
msgid "Encode"
msgstr "Codificar"
#: client/scenes/stream_gui.cpp:319
#: client/scenes/stream_gui.cpp:321
msgid "Send"
msgstr "Enviar"
#: client/scenes/stream_gui.cpp:320
#: client/scenes/stream_gui.cpp:322
msgid "Receive"
msgstr "Recibir"
#: client/scenes/stream_gui.cpp:321
#: client/scenes/stream_gui.cpp:323
msgid "Decode"
msgstr "Decodificar"
#: client/scenes/stream_gui.cpp:322
#: client/scenes/stream_gui.cpp:324
msgid "Blitted"
msgstr "Copiado"
#: client/scenes/stream_gui.cpp:323
#: client/scenes/stream_gui.cpp:325
msgid "Displayed"
msgstr "Mostrado"
#: client/scenes/stream_gui.cpp:324
#: client/scenes/stream_gui.cpp:326
msgid "Predicted"
msgstr "Previsto"
#: client/scenes/stream_gui.cpp:343
#: client/scenes/stream_gui.cpp:345
#, c++-format
msgid "Estimated motion to photons latency: {}ms"
msgstr "Latencia estimada de movimiento a fotones: {}ms"
#: client/scenes/stream_gui.cpp:348
#: client/scenes/stream_gui.cpp:350
msgid "Press the grip button to move the window"
msgstr "Pulsa el botón de agarre para mover la ventana"
#: client/scenes/stream_gui.cpp:350 client/scenes/stream_gui.cpp:918
#: client/scenes/stream_gui.cpp:352 client/scenes/stream_gui.cpp:900
msgid "Press both thumbsticks to display the WiVRn window"
msgstr "Pulsa ambos joysticks para mostrar la ventana de WiVRn"
#: client/scenes/stream_gui.cpp:372
#: client/scenes/stream_gui.cpp:374
msgid "Motion to photon latency"
msgstr "Latencia entre el movimiento y la imagen mostrada"
#: client/scenes/stream_gui.cpp:458
#: client/scenes/stream_gui.cpp:460
msgid "Bitrate:"
msgstr "Bitrate:"
#: client/scenes/stream_gui.cpp:468
#: client/scenes/stream_gui.cpp:470
msgid "Click to adjust bitrate"
msgstr "Haga click para ajustar el bitrate"
#: client/scenes/stream_gui.cpp:531
#: client/scenes/stream_gui.cpp:534
msgid "Foveation center override"
msgstr "Reajustar el centro de la fóvea"
#: client/scenes/stream_gui.cpp:534
#: client/scenes/stream_gui.cpp:537
msgid "Enable"
msgstr "Habilitar"
#: client/scenes/stream_gui.cpp:542 client/scenes/stream_gui.cpp:614
#: client/scenes/stream_gui.cpp:545 client/scenes/stream_gui.cpp:616
#, c++-format
msgid "Height {:.1f} deg"
msgstr "Altura {:.1f} °"
#: client/scenes/stream_gui.cpp:543 client/scenes/stream_gui.cpp:615
#: client/scenes/stream_gui.cpp:546 client/scenes/stream_gui.cpp:617
#, c++-format
msgid "Distance {:.2f} m"
msgstr "Distancia {:.2f} m"
#: client/scenes/stream_gui.cpp:544
#: client/scenes/stream_gui.cpp:547
msgid "Default"
msgstr "Por defecto"
#: client/scenes/stream_gui.cpp:555
#: client/scenes/stream_gui.cpp:558
msgid "Change"
msgstr "Cambiar"
#: client/scenes/stream_gui.cpp:588
#: client/scenes/stream_gui.cpp:590
msgid "Use the right thumbstick to adjust the bitrate"
msgstr "Use el stick derecho para ajustar el bitrate"
#: client/scenes/stream_gui.cpp:589
#: client/scenes/stream_gui.cpp:591
msgid "Press A to go back"
msgstr "Pulse A para volver"
#: client/scenes/stream_gui.cpp:590
#: client/scenes/stream_gui.cpp:592
#, c++-format
msgid "Bitrate: {}Mbit/s"
msgstr "Bitrate: {}Mbit/s"
#: client/scenes/stream_gui.cpp:612
#: client/scenes/stream_gui.cpp:614
msgid "Use the thumbsticks to move the foveation center"
msgstr "Usa los joysticks para mover el centro de la fóvea"
#: client/scenes/stream_gui.cpp:613
#: client/scenes/stream_gui.cpp:615
msgid "Press A to save or B to cancel"
msgstr "Pulsa A para guardar o B para cancelar"
#: client/scenes/stream_gui.cpp:671
#: client/scenes/stream_gui.cpp:673
msgid "Running XR applications:"
msgstr "Aplicaciones XR ejecutandose:"
#: client/scenes/stream_gui.cpp:688
#: client/scenes/stream_gui.cpp:690
msgid "Overlays"
msgstr "Superposiciones"
#: client/scenes/stream_gui.cpp:727
#: client/scenes/stream_gui.cpp:729
msgid "Request to quit, may be ignored by the application"
msgstr "Pedir salir, puede ser ignorado por la aplicación"
#: client/scenes/stream_gui.cpp:977
#: client/scenes/stream_gui.cpp:959
msgid "Applications"
msgstr "Aplicaciones"
#: client/scenes/stream_gui.cpp:980
#: client/scenes/stream_gui.cpp:962
msgid "Start"
msgstr "Iniciar"
#: client/scenes/stream_gui.cpp:994
#: client/scenes/stream_gui.cpp:976
msgid "Stats"
msgstr "Estadísticas"
#: client/scenes/stream_gui.cpp:1000
#: client/scenes/stream_gui.cpp:982
msgid "Statistics overlay"
msgstr "Superponer stats"
#: client/scenes/stream_gui.cpp:1003
#: client/scenes/stream_gui.cpp:985
msgid "Compact view"
msgstr "Vista compacta"
+43 -31
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-02 10:52+0100\n"
"PO-Revision-Date: 2026-02-02 10:53+0100\n"
"POT-Creation-Date: 2026-02-16 18:43+0100\n"
"PO-Revision-Date: 2026-02-16 21:47+0100\n"
"Last-Translator: Guillaume Meunier <guillaume.meunier@centraliens.net>\n"
"Language-Team: French <>\n"
"Language: French\n"
@@ -117,8 +117,8 @@ msgstr "Vérification de la dernière version..."
msgid "No APK is available for this version"
msgstr "Aucun APK n'est disponible pour cette version"
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:368
#: dashboard/qml/Main.qml:426 dashboard/qml/WizardPage.qml:211
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:376
#: dashboard/qml/Main.qml:434 dashboard/qml/WizardPage.qml:211
#: dashboard/qml/WizardPage.qml:337
#, kde-format
msgid "ADB is not installed"
@@ -160,7 +160,7 @@ msgstr "Réinstaller WiVRn"
msgid "Install WiVRn"
msgstr "Installer WiVRn"
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:431
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:439
#, kde-format
msgid "Headsets"
msgstr "Casques"
@@ -287,7 +287,7 @@ msgid "Avahi daemon is not started"
msgstr "Avahi daemon n'est pas démarré"
#: dashboard/qml/Main.qml:157 dashboard/qml/Main.qml:171
#: dashboard/qml/Main.qml:223
#: dashboard/qml/Main.qml:231
#, kde-format
msgid "Fix it"
msgstr "Corriger"
@@ -312,6 +312,18 @@ msgstr "Plus d'infos"
#: dashboard/qml/Main.qml:193
#, kde-format
msgid "Vulkan drivers cannot be found, you may need to run \"flatpak update\""
msgstr ""
"Impossible de trouver les drivers Vulkan, il est peut-être nécessaire "
"d'exécuter \"flatpak update\""
#: dashboard/qml/Main.qml:193
#, kde-format
msgid "Vulkan drivers cannot be found"
msgstr "Impossible de trouver les drivers Vulkan"
#: dashboard/qml/Main.qml:201
#, kde-format
msgid ""
"Use the Mesa (radv) driver for AMD GPUs\n"
"Hardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO"
@@ -319,7 +331,7 @@ msgstr ""
"Utilisez le driver Mesa (redv) pour les GPUs AMD\n"
"L'encodage matériel avec vaapi ne fonctionne pas avec AMDVLK et AMDGPU-PRO"
#: dashboard/qml/Main.qml:201
#: dashboard/qml/Main.qml:209
#, kde-format
msgid ""
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
@@ -329,14 +341,14 @@ msgstr ""
"pourront pas charger le mode VR.\n"
"Veuillez installer xrizer ou OpenComposite."
#: dashboard/qml/Main.qml:209
#: dashboard/qml/Main.qml:217
#, kde-format
msgid "Steam is installed as a snap. Snaps are not compatible with WiVRn."
msgstr ""
"Steam est installé en tant que snap. Les snaps ne sont pas compatibles avec "
"WiVRn."
#: dashboard/qml/Main.qml:217
#: dashboard/qml/Main.qml:225
#, kde-format
msgid ""
"Steam is installed as a flatpak but does not have sufficient permissions."
@@ -344,114 +356,114 @@ msgstr ""
"Steam est installé en tant que flatpak mais n'a pas les autorisations "
"nécessaires."
#: dashboard/qml/Main.qml:232
#: dashboard/qml/Main.qml:240
#, kde-format
msgid "Restart the server for configuration changes to take effect"
msgstr "Redémarez le serveur pour appliquer les changements"
#: dashboard/qml/Main.qml:238
#: dashboard/qml/Main.qml:246
#, kde-format
msgctxt "restart the server"
msgid "Restart now"
msgstr "Redémarrer"
#: dashboard/qml/Main.qml:263
#: dashboard/qml/Main.qml:271
#, kde-format
msgid "Server failed to start"
msgstr "Le serveur n'a pas pu démarrer"
#: dashboard/qml/Main.qml:269 dashboard/qml/TroubleshootPage.qml:89
#: dashboard/qml/Main.qml:277 dashboard/qml/TroubleshootPage.qml:89
#, kde-format
msgid "Open server logs"
msgstr "Ouvrir les logs du serveur"
#: dashboard/qml/Main.qml:295
#: dashboard/qml/Main.qml:303
#, kde-format
msgid "Server status"
msgstr "Serveur"
#: dashboard/qml/Main.qml:301
#: dashboard/qml/Main.qml:309
#, kde-format
msgctxt "whether the server is running, displayed in front of a checkbox"
msgid "Running"
msgstr "Démarré"
#: dashboard/qml/Main.qml:314
#: dashboard/qml/Main.qml:322
#, kde-format
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
msgid "Pairing"
msgstr "Appairage"
#: dashboard/qml/Main.qml:334
#: dashboard/qml/Main.qml:342
#, kde-format
msgid "Headset status"
msgstr "Casque"
#: dashboard/qml/Main.qml:341
#: dashboard/qml/Main.qml:349
#, kde-format
msgctxt "label for headset name/status under server running switch"
msgid "Headset"
msgstr "Casque"
#: dashboard/qml/Main.qml:344
#: dashboard/qml/Main.qml:352
#, kde-format
msgid "Not connected"
msgstr "Déconnecté"
#: dashboard/qml/Main.qml:348
#: dashboard/qml/Main.qml:356
#, kde-format
msgid "Disconnect"
msgstr "Déconnecter"
#: dashboard/qml/Main.qml:357 dashboard/qml/Main.qml:365
#: dashboard/qml/Main.qml:372
#: dashboard/qml/Main.qml:365 dashboard/qml/Main.qml:373
#: dashboard/qml/Main.qml:380
#, kde-format
msgctxt "label for USB status or connect button"
msgid "USB"
msgstr "USB"
#: dashboard/qml/Main.qml:358
#: dashboard/qml/Main.qml:366
#, kde-format
msgctxt "usb connect button"
msgid "Connect (wired)"
msgstr "Connecter (filaire)"
#: dashboard/qml/Main.qml:375 dashboard/qml/WizardPage.qml:339
#: dashboard/qml/Main.qml:383 dashboard/qml/WizardPage.qml:339
#, kde-format
msgid "No headset is connected or your headset is not in developer mode"
msgstr "Le casque n'est pas connecté ou n'est pas en mode développeur"
#: dashboard/qml/Main.qml:396
#: dashboard/qml/Main.qml:404
#, kde-format
msgid "Steam information"
msgstr "Informations pour Steam"
#: dashboard/qml/Main.qml:412
#: dashboard/qml/Main.qml:420
#, kde-format
msgid "Wizard"
msgstr "Assistant"
#: dashboard/qml/Main.qml:418
#: dashboard/qml/Main.qml:426
#, kde-format
msgid "Install the app"
msgstr "Installer l'appli"
#: dashboard/qml/Main.qml:437 dashboard/qml/SettingsPage.qml:14
#: dashboard/qml/Main.qml:445 dashboard/qml/SettingsPage.qml:14
#, kde-format
msgid "Settings"
msgstr "Paramètres"
#: dashboard/qml/Main.qml:443
#: dashboard/qml/Main.qml:451
#, kde-format
msgid "About"
msgstr "À propos"
#: dashboard/qml/Main.qml:448 dashboard/qml/TroubleshootPage.qml:10
#: dashboard/qml/Main.qml:456 dashboard/qml/TroubleshootPage.qml:10
#, kde-format
msgid "Troubleshoot"
msgstr "Dépannage"
#: dashboard/qml/Main.qml:455
#: dashboard/qml/Main.qml:463
#, kde-format
msgid "Version %1"
msgstr "Version %1"
+2 -2
View File
@@ -243,7 +243,7 @@ msgid ""
msgstr ""
"Les valeurs élevées concentrent la qualité là où se\n"
"porte le regard, ce qui diminue la latence, réduit la\n"
"consommation d'énergé et améliore la qualité."
"consommation d'énergie et améliore la qualité."
#: client/scenes/lobby_gui.cpp:700
msgid ""
@@ -252,7 +252,7 @@ msgid ""
msgstr ""
"Les valeurs élevées concentrent la qualité au centre\n"
"de l'image, ce qui diminue la latence, réduit la\n"
"consommation d'énergé et améliore la qualité."
"consommation d'énergie et améliore la qualité."
#: client/scenes/lobby_gui.cpp:709
msgctxt "Codec"
+40 -30
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-04 17:02+0900\n"
"POT-Creation-Date: 2026-02-17 12:42+0900\n"
"PO-Revision-Date: 2025-04-10 07:14+0900\n"
"Last-Translator: Mitsuami Megane <hello@mitsua.me>\n"
"Language-Team: Japanese <>\n"
@@ -112,8 +112,8 @@ msgstr "最新リリースを確認中"
msgid "No APK is available for this version"
msgstr "現在バージョン用の公式APKは提供されていません"
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:368
#: dashboard/qml/Main.qml:426 dashboard/qml/WizardPage.qml:211
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:376
#: dashboard/qml/Main.qml:434 dashboard/qml/WizardPage.qml:211
#: dashboard/qml/WizardPage.qml:337
#, kde-format
msgid "ADB is not installed"
@@ -159,7 +159,7 @@ msgstr "WiVRnをインストールする"
msgid "Headset statistics"
msgstr "HMDの統計情報"
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:431
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:439
#, kde-format
msgid "Headsets"
msgstr "HMD"
@@ -275,7 +275,7 @@ msgid "Avahi daemon is not started"
msgstr "Avahiデーモンが起動していません"
#: dashboard/qml/Main.qml:157 dashboard/qml/Main.qml:171
#: dashboard/qml/Main.qml:223
#: dashboard/qml/Main.qml:231
#, kde-format
msgid "Fix it"
msgstr "直す"
@@ -300,6 +300,16 @@ msgstr "詳細情報"
#: dashboard/qml/Main.qml:193
#, kde-format
msgid "Vulkan drivers cannot be found, you may need to run \"flatpak update\""
msgstr "Vulkanドライバーが見つかりません。「flatpak update」を実行してみて下さい。"
#: dashboard/qml/Main.qml:193
#, kde-format
msgid "Vulkan drivers cannot be found"
msgstr "Vulkanドライバーが見つかりません"
#: dashboard/qml/Main.qml:201
#, kde-format
msgid ""
"Use the Mesa (radv) driver for AMD GPUs\n"
"Hardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO"
@@ -307,7 +317,7 @@ msgstr ""
"AMD GPUの場合は「Mesa (radv)」ドライバーを使ってください\n"
"AMDVLKやAMDGPU-PROなどはvaapiエンコーダーに対応していません"
#: dashboard/qml/Main.qml:201
#: dashboard/qml/Main.qml:209
#, kde-format
msgid ""
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
@@ -316,13 +326,13 @@ msgstr ""
"OpenVR実装ライブラリーは見つかりませんでした。SteamVRゲームを実行するには、\n"
"xrizerかOpenCompositeをインストールしましょう。"
#: dashboard/qml/Main.qml:209
#: dashboard/qml/Main.qml:217
#, kde-format
msgid "Steam is installed as a snap. Snaps are not compatible with WiVRn."
msgstr ""
"SteamはSnapとしてインストールされていますが、Snapはサポートサれていません。"
#: dashboard/qml/Main.qml:217
#: dashboard/qml/Main.qml:225
#, kde-format
msgid ""
"Steam is installed as a flatpak but does not have sufficient permissions."
@@ -330,114 +340,114 @@ msgstr ""
"SteamはFlatpakとしてインストールされていますが、必要な権限が設定されていませ"
"ん。"
#: dashboard/qml/Main.qml:232
#: dashboard/qml/Main.qml:240
#, kde-format
msgid "Restart the server for configuration changes to take effect"
msgstr "設定変更を有効にするにはサーバーを再起動してください。"
#: dashboard/qml/Main.qml:238
#: dashboard/qml/Main.qml:246
#, kde-format
msgctxt "restart the server"
msgid "Restart now"
msgstr "今すぐ再起動する"
#: dashboard/qml/Main.qml:263
#: dashboard/qml/Main.qml:271
#, kde-format
msgid "Server failed to start"
msgstr "サーバーは起動できませんでした"
#: dashboard/qml/Main.qml:269 dashboard/qml/TroubleshootPage.qml:89
#: dashboard/qml/Main.qml:277 dashboard/qml/TroubleshootPage.qml:89
#, kde-format
msgid "Open server logs"
msgstr "ログを見る"
#: dashboard/qml/Main.qml:295
#: dashboard/qml/Main.qml:303
#, kde-format
msgid "Server status"
msgstr "サーバーステータス"
#: dashboard/qml/Main.qml:301
#: dashboard/qml/Main.qml:309
#, kde-format
msgctxt "whether the server is running, displayed in front of a checkbox"
msgid "Running"
msgstr "作動中"
#: dashboard/qml/Main.qml:314
#: dashboard/qml/Main.qml:322
#, kde-format
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
msgid "Pairing"
msgstr "ペアリング"
#: dashboard/qml/Main.qml:334
#: dashboard/qml/Main.qml:342
#, kde-format
msgid "Headset status"
msgstr "HMDステータス"
#: dashboard/qml/Main.qml:341
#: dashboard/qml/Main.qml:349
#, kde-format
msgctxt "label for headset name/status under server running switch"
msgid "Headset"
msgstr "HMD"
#: dashboard/qml/Main.qml:344
#: dashboard/qml/Main.qml:352
#, kde-format
msgid "Not connected"
msgstr "未接続"
#: dashboard/qml/Main.qml:348
#: dashboard/qml/Main.qml:356
#, kde-format
msgid "Disconnect"
msgstr "切断する"
#: dashboard/qml/Main.qml:357 dashboard/qml/Main.qml:365
#: dashboard/qml/Main.qml:372
#: dashboard/qml/Main.qml:365 dashboard/qml/Main.qml:373
#: dashboard/qml/Main.qml:380
#, kde-format
msgctxt "label for USB status or connect button"
msgid "USB"
msgstr "USB"
#: dashboard/qml/Main.qml:358
#: dashboard/qml/Main.qml:366
#, kde-format
msgctxt "usb connect button"
msgid "Connect (wired)"
msgstr "有線で接続する"
#: dashboard/qml/Main.qml:375 dashboard/qml/WizardPage.qml:339
#: dashboard/qml/Main.qml:383 dashboard/qml/WizardPage.qml:339
#, kde-format
msgid "No headset is connected or your headset is not in developer mode"
msgstr "HMDが接続されていないか、HMDが開発者モードになっていません"
#: dashboard/qml/Main.qml:396
#: dashboard/qml/Main.qml:404
#, kde-format
msgid "Steam information"
msgstr "ストリーム情報"
#: dashboard/qml/Main.qml:412
#: dashboard/qml/Main.qml:420
#, kde-format
msgid "Wizard"
msgstr "セットアップウィザード"
#: dashboard/qml/Main.qml:418
#: dashboard/qml/Main.qml:426
#, kde-format
msgid "Install the app"
msgstr "アプリをインストール"
#: dashboard/qml/Main.qml:437 dashboard/qml/SettingsPage.qml:14
#: dashboard/qml/Main.qml:445 dashboard/qml/SettingsPage.qml:14
#, kde-format
msgid "Settings"
msgstr "設定"
#: dashboard/qml/Main.qml:443
#: dashboard/qml/Main.qml:451
#, kde-format
msgid "About"
msgstr "WiVRnについて"
#: dashboard/qml/Main.qml:448 dashboard/qml/TroubleshootPage.qml:10
#: dashboard/qml/Main.qml:456 dashboard/qml/TroubleshootPage.qml:10
#, kde-format
msgid "Troubleshoot"
msgstr "問題解決"
#: dashboard/qml/Main.qml:455
#: dashboard/qml/Main.qml:463
#, kde-format
msgid "Version %1"
msgstr "バージョン%1"
+114 -114
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn 0.16\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-04 17:02+0900\n"
"POT-Creation-Date: 2026-02-17 12:42+0900\n"
"PO-Revision-Date: 2024-06-20 10:33+0900\n"
"Last-Translator: Mitsuami Megane <hello@mitsua.me>\n"
"Language: Japanese\n"
@@ -14,24 +14,24 @@ msgstr ""
msgid "No supported swapchain format"
msgstr "互換性のあるスワップチェーンは見つからなかった"
#: client/scenes/app_launcher.cpp:128
#: client/scenes/app_launcher.cpp:127
msgid "Connected to WiVRn server"
msgstr "WiVRnサーバーに接続しました。"
#: client/scenes/app_launcher.cpp:130
#: client/scenes/app_launcher.cpp:129
#, c++-format
msgid "Connected to {}"
msgstr "{}に接続しました。"
#: client/scenes/app_launcher.cpp:136
#: client/scenes/app_launcher.cpp:135
msgid "Start an application on the server to start streaming."
msgstr "VRアプリを起動してVRに入りましょう!"
#: client/scenes/app_launcher.cpp:146
#: client/scenes/app_launcher.cpp:145
msgid "Start an application on your computer or select one to start streaming."
msgstr "パソコンでVRアプリを起動するか、ここからアプリを選択しましょう。"
#: client/scenes/app_launcher.cpp:148
#: client/scenes/app_launcher.cpp:147
#, c++-format
msgid "Start an application on {} or select one to start streaming."
msgstr "{}でVRアプリを起動するか、ここからアプリを選択しましょう。"
@@ -59,11 +59,11 @@ msgstr "{}に接続できませんでした:({}) {}"
msgid "Waiting for connection"
msgstr "接続を待っています"
#: client/scenes/lobby.cpp:1316
#: client/scenes/lobby.cpp:1307
msgid "Passthrough"
msgstr "パススルー"
#: client/scenes/lobby.cpp:1328
#: client/scenes/lobby.cpp:1319
msgid "Default environment"
msgstr "デフォルトのホーム環境"
@@ -83,13 +83,13 @@ msgid "Disabled"
msgstr "無効"
#: client/scenes/lobby_gui.cpp:114 client/scenes/lobby_gui.cpp:258
#: client/scenes/stream_gui.cpp:1009
#: client/scenes/stream_gui.cpp:992
msgid "Disconnect"
msgstr "切断する"
#: client/scenes/lobby_gui.cpp:134 client/scenes/lobby_gui_customize.cpp:753
#: client/scenes/lobby_gui_customize.cpp:844
#: client/scenes/lobby_gui_customize.cpp:900 client/scenes/stream_gui.cpp:1005
#: client/scenes/lobby_gui_customize.cpp:900 client/scenes/stream_gui.cpp:988
msgid "Close"
msgstr "閉じる"
@@ -127,7 +127,7 @@ msgid "TCP only"
msgstr "TCPのみを使用"
#: client/scenes/lobby_gui.cpp:319 client/scenes/lobby_gui_customize.cpp:655
#: client/scenes/stream_gui.cpp:962
#: client/scenes/stream_gui.cpp:944
msgid "Cancel"
msgstr "キャンセル"
@@ -172,17 +172,17 @@ msgstr "言語"
msgid "System language"
msgstr "デバイス言語"
#: client/scenes/lobby_gui.cpp:580 client/scenes/stream_gui.cpp:411
#: client/scenes/lobby_gui.cpp:580 client/scenes/stream_gui.cpp:413
msgid "Refresh rate"
msgstr "リフレッシュレート"
#: client/scenes/lobby_gui.cpp:580 client/scenes/lobby_gui.cpp:582
#: client/scenes/stream_gui.cpp:411 client/scenes/stream_gui.cpp:413
#: client/scenes/stream_gui.cpp:413 client/scenes/stream_gui.cpp:415
msgctxt "automatic refresh rate"
msgid "Automatic"
msgstr "自動"
#: client/scenes/lobby_gui.cpp:589 client/scenes/stream_gui.cpp:421
#: client/scenes/lobby_gui.cpp:589 client/scenes/stream_gui.cpp:423
msgid ""
"Select refresh rate based on measured application performance.\n"
"May cause flicker when a change happens."
@@ -190,7 +190,7 @@ msgstr ""
"アプリケーションのパフォーマンスを基づいて自動的に設定します。\n"
"変更時にチラツキが発生する可能性があります。"
#: client/scenes/lobby_gui.cpp:606 client/scenes/stream_gui.cpp:439
#: client/scenes/lobby_gui.cpp:606 client/scenes/stream_gui.cpp:441
msgid "Minimum refresh rate"
msgstr "最低リフレッシュレート"
@@ -266,58 +266,58 @@ msgstr "コーデック"
msgid "10-bit"
msgstr "10ビット"
#: client/scenes/lobby_gui.cpp:768
#: client/scenes/lobby_gui.cpp:769
msgid "Bitrate"
msgstr "ビットレート"
#: client/scenes/lobby_gui.cpp:772
#: client/scenes/lobby_gui.cpp:773
#, c++-format
msgid "{}Mbit/s"
msgstr "{}Mbps"
#: client/scenes/lobby_gui.cpp:783
#: client/scenes/lobby_gui.cpp:784
msgid "High power mode"
msgstr "高電力モード"
#: client/scenes/lobby_gui.cpp:786
#: client/scenes/lobby_gui.cpp:787
msgid "Increase power usage to allow higher resolution and refresh rate"
msgstr "HMDの性能問題を緩和するため、電力を増加させます。"
#: client/scenes/lobby_gui.cpp:792
#: client/scenes/lobby_gui.cpp:793
msgid "Enable microphone"
msgstr "マイクを有効する"
#: client/scenes/lobby_gui.cpp:801
#: client/scenes/lobby_gui.cpp:802
msgid "Unprocessed Microphone Audio"
msgstr "未処理のマイク音声"
#: client/scenes/lobby_gui.cpp:807
#: client/scenes/lobby_gui.cpp:808
msgid "Force disable audio filters, such as noise cancellation"
msgstr "ノイズ除去などのフィルターを無効化する"
#: client/scenes/lobby_gui.cpp:814
#: client/scenes/lobby_gui.cpp:815
msgid "Enable hand tracking"
msgstr "ハンドトラッキングを有効する"
#: client/scenes/lobby_gui.cpp:820 client/scenes/lobby_gui.cpp:831
#: client/scenes/lobby_gui.cpp:841 client/scenes/lobby_gui.cpp:856
#: client/scenes/lobby_gui.cpp:821 client/scenes/lobby_gui.cpp:832
#: client/scenes/lobby_gui.cpp:842 client/scenes/lobby_gui.cpp:857
#: client/scenes/lobby_gui_customize.cpp:640
msgid "This feature is not supported by your headset"
msgstr "デバイスはこの機能をサポートしていません"
#: client/scenes/lobby_gui.cpp:825
#: client/scenes/lobby_gui.cpp:826
msgid "Enable eye tracking"
msgstr "アイトラッキングを有効する"
#: client/scenes/lobby_gui.cpp:836
#: client/scenes/lobby_gui.cpp:837
msgid "Enable face tracking"
msgstr "顔トラッキングを有効する"
#: client/scenes/lobby_gui.cpp:848
#: client/scenes/lobby_gui.cpp:849
msgid "Enable body tracking"
msgstr "ボディラッキングを有効する"
#: client/scenes/lobby_gui.cpp:861
#: client/scenes/lobby_gui.cpp:862
msgid ""
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
"tracking settings,\n"
@@ -328,11 +328,11 @@ msgstr ""
"そうでなければ、トラッキングデータはHMDとコントローラーの情報から推測されるこ"
"とになる。"
#: client/scenes/lobby_gui.cpp:871
#: client/scenes/lobby_gui.cpp:872
msgid "Enable lower body tracking"
msgstr "下半身トラッキングを有効する"
#: client/scenes/lobby_gui.cpp:877
#: client/scenes/lobby_gui.cpp:878
msgid ""
"Estimate lower body joint positions using Generative Legs\n"
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
@@ -342,11 +342,11 @@ msgstr ""
"Quest設定・動きのトラッキング・ジェスチャーコントロールとボディトラッキングを"
"有効する必要がある。"
#: client/scenes/lobby_gui.cpp:880
#: client/scenes/lobby_gui.cpp:881
msgid "Enable hip tracking"
msgstr "腰のトラッキングを有効する"
#: client/scenes/lobby_gui.cpp:886
#: client/scenes/lobby_gui.cpp:887
msgid ""
"Only takes affect with lower body tracking enabled\n"
"May be desired when using another source of hip tracking"
@@ -354,11 +354,11 @@ msgstr ""
"下半身トラッキングが有効な場合に使用可能。\n"
"腰トラッカーを持ってる方は無効にしましょう。"
#: client/scenes/lobby_gui.cpp:895
#: client/scenes/lobby_gui.cpp:896
msgid "Enable in-stream window"
msgstr "ストリーミング中の設定パネル"
#: client/scenes/lobby_gui.cpp:898
#: client/scenes/lobby_gui.cpp:899
msgid ""
"Enables the configuration window to be shown while the game is streaming.\n"
"If enabled, the window is activated by pressing both thumbsticks."
@@ -366,23 +366,23 @@ msgstr ""
"ストリーミング中にも設定パネルを表示できるようにします。\n"
"両方のサムスティックを同時に押して切り替えることができます。"
#: client/scenes/lobby_gui.cpp:902
#: client/scenes/lobby_gui.cpp:903
msgid "Extended configuration values"
msgstr "設定に対する制限の緩和"
#: client/scenes/lobby_gui.cpp:905
#: client/scenes/lobby_gui.cpp:906
msgid "Allows unsafe configuration values, use at your own risk."
msgstr "不安定な状態が発生しないよう、十分にご注意ください。"
#: client/scenes/lobby_gui.cpp:919 client/scenes/stream_gui.cpp:473
#: client/scenes/lobby_gui.cpp:920 client/scenes/stream_gui.cpp:475
msgid "OpenXR post-processing"
msgstr "OpenXRポストエフェクト"
#: client/scenes/lobby_gui.cpp:923 client/scenes/stream_gui.cpp:477
#: client/scenes/lobby_gui.cpp:924 client/scenes/stream_gui.cpp:479
msgid "Supersampling"
msgstr "スーパーサンプリング"
#: client/scenes/lobby_gui.cpp:943 client/scenes/stream_gui.cpp:498
#: client/scenes/lobby_gui.cpp:944 client/scenes/stream_gui.cpp:500
msgid ""
"Reduce flicker for high contrast edges.\n"
"Useful when the input resolution is high compared to the headset display"
@@ -390,11 +390,11 @@ msgstr ""
"コントラストが高い部分のギザギザを低減する。\n"
"ストリームの解像度は、HMDの解像度より高い場合は有用です。"
#: client/scenes/lobby_gui.cpp:948 client/scenes/stream_gui.cpp:503
#: client/scenes/lobby_gui.cpp:949 client/scenes/stream_gui.cpp:505
msgid "Sharpening"
msgstr "シャープ"
#: client/scenes/lobby_gui.cpp:968 client/scenes/stream_gui.cpp:524
#: client/scenes/lobby_gui.cpp:969 client/scenes/stream_gui.cpp:526
msgid ""
"Improve clarity of high contrast edges and counteract blur.\n"
"Useful when the input resolution is low compared to the headset display"
@@ -402,129 +402,129 @@ msgstr ""
"ぼかしを低減し、コントラストが高い部分の鮮明度を向上する。\n"
"ストリームの解像度は、HMDの解像度より低い場合に有用です。"
#: client/scenes/lobby_gui.cpp:1152 client/scenes/lobby_gui.cpp:1160
#: client/scenes/stream_gui.cpp:172 client/scenes/stream_gui.cpp:370
#: client/scenes/lobby_gui.cpp:1153 client/scenes/lobby_gui.cpp:1161
#: client/scenes/stream_gui.cpp:174 client/scenes/stream_gui.cpp:372
msgid "CPU time"
msgstr "CPU使用時間"
#: client/scenes/lobby_gui.cpp:1156
#: client/scenes/lobby_gui.cpp:1157
msgid "CPU time [ms]"
msgstr "CPU使用時間、ミリ秒"
#: client/scenes/lobby_gui.cpp:1166 client/scenes/lobby_gui.cpp:1174
#: client/scenes/stream_gui.cpp:174 client/scenes/stream_gui.cpp:371
#: client/scenes/lobby_gui.cpp:1167 client/scenes/lobby_gui.cpp:1175
#: client/scenes/stream_gui.cpp:176 client/scenes/stream_gui.cpp:373
msgid "GPU time"
msgstr "GPU使用時間"
#: client/scenes/lobby_gui.cpp:1170
#: client/scenes/lobby_gui.cpp:1171
msgid "GPU time [ms]"
msgstr "GPU使用時間、ミリ秒"
#: client/scenes/lobby_gui.cpp:1234
#: client/scenes/lobby_gui.cpp:1235
msgid "Enable the microphone?"
msgstr "マイクを有効にしますか?"
#: client/scenes/lobby_gui.cpp:1239
#: client/scenes/lobby_gui.cpp:1240
msgid "Enable eye tracking?"
msgstr "アイトラッキングを有効にしますか?"
#: client/scenes/lobby_gui.cpp:1244
#: client/scenes/lobby_gui.cpp:1245
msgid "Enable face tracking?"
msgstr "フェースラッキングを有効にしますか?"
#: client/scenes/lobby_gui.cpp:1249
#: client/scenes/lobby_gui.cpp:1250
msgid "Enable body tracking?"
msgstr "ボディトラッキングを有効にしますか?"
#: client/scenes/lobby_gui.cpp:1257
#: client/scenes/lobby_gui.cpp:1258
msgid "Welcome to WiVRn"
msgstr "WiVRnへようこそ!"
#: client/scenes/lobby_gui.cpp:1285
#: client/scenes/lobby_gui.cpp:1286
msgid "Yes"
msgstr "はい"
#: client/scenes/lobby_gui.cpp:1292
#: client/scenes/lobby_gui.cpp:1293
msgid "No"
msgstr "いいえ"
#: client/scenes/lobby_gui.cpp:1311 client/scenes/lobby_gui.cpp:1957
#: client/scenes/lobby_gui.cpp:1312 client/scenes/lobby_gui.cpp:1958
msgid "Licenses"
msgstr "ライセンス"
#: client/scenes/lobby_gui.cpp:1587
#: client/scenes/lobby_gui.cpp:1588
msgid "Microphone is enabled"
msgstr "マイクは有効です"
#: client/scenes/lobby_gui.cpp:1588
#: client/scenes/lobby_gui.cpp:1589
msgid "Microphone is disabled"
msgstr "マイクは無効です"
#: client/scenes/lobby_gui.cpp:1597
#: client/scenes/lobby_gui.cpp:1598
msgid "Hand tracking is enabled"
msgstr "ハンドトラッキングは有効です"
#: client/scenes/lobby_gui.cpp:1598
#: client/scenes/lobby_gui.cpp:1599
msgid "Hand tracking is disabled"
msgstr "ハンドラッキングは無効です"
#: client/scenes/lobby_gui.cpp:1607
#: client/scenes/lobby_gui.cpp:1608
msgid "Eye tracking is enabled"
msgstr "アイトラッキングは有効です"
#: client/scenes/lobby_gui.cpp:1608
#: client/scenes/lobby_gui.cpp:1609
msgid "Eye tracking is disabled"
msgstr "アイトラッキングは無効です"
#: client/scenes/lobby_gui.cpp:1618
#: client/scenes/lobby_gui.cpp:1619
msgid "Face tracking is enabled"
msgstr "フェーストラッキングは有効です"
#: client/scenes/lobby_gui.cpp:1619
#: client/scenes/lobby_gui.cpp:1620
msgid "Face tracking is disabled"
msgstr "フェーストラッキングは無効です"
#: client/scenes/lobby_gui.cpp:1633
#: client/scenes/lobby_gui.cpp:1634
msgid "Body tracking is enabled"
msgstr "ボディトラッキングは有効です"
#: client/scenes/lobby_gui.cpp:1634
#: client/scenes/lobby_gui.cpp:1635
msgid "Body tracking is disabled"
msgstr "ボディトラッキングは無効です"
#: client/scenes/lobby_gui.cpp:1650
#: client/scenes/lobby_gui.cpp:1651
msgid "Add server"
msgstr "サーバーを追加する"
#: client/scenes/lobby_gui.cpp:1936
#: client/scenes/lobby_gui.cpp:1937
msgid "Server list"
msgstr "サーバー"
#: client/scenes/lobby_gui.cpp:1939 client/scenes/stream_gui.cpp:990
#: client/scenes/lobby_gui.cpp:1940 client/scenes/stream_gui.cpp:973
msgid "Settings"
msgstr "設定"
#: client/scenes/lobby_gui.cpp:1942
#: client/scenes/lobby_gui.cpp:1943
msgid "Post-processing"
msgstr "ポストエフェクト"
#: client/scenes/lobby_gui.cpp:1945
#: client/scenes/lobby_gui.cpp:1946
msgid "Customize"
msgstr "カスタマイズ"
#: client/scenes/lobby_gui.cpp:1949
#: client/scenes/lobby_gui.cpp:1950
msgid "Debug"
msgstr "デバッグ"
#: client/scenes/lobby_gui.cpp:1954
#: client/scenes/lobby_gui.cpp:1955
msgid "About"
msgstr "WiVRnについて"
#: client/scenes/lobby_gui.cpp:1960
#: client/scenes/lobby_gui.cpp:1961
msgid "Exit"
msgstr "完了"
#: client/scenes/lobby_gui.cpp:1977
#: client/scenes/lobby_gui.cpp:1978
msgid ""
"Press the grip button or put your palm up\n"
"to move the main window"
@@ -532,7 +532,7 @@ msgstr ""
"メイン・パネルを動かすには、グリップを握るか、\n"
"手のひらを上向きにしましょう。"
#: client/scenes/lobby_gui.cpp:1979
#: client/scenes/lobby_gui.cpp:1980
msgid "Press the grip button to move the main window"
msgstr "グリップを握ってパネルを動かしましょう。"
@@ -611,160 +611,160 @@ msgstr "ホーム環境をダウンロード"
msgid "Open local glTF model"
msgstr "glTFファイルを開く"
#: client/scenes/stream_gui.cpp:174
#: client/scenes/stream_gui.cpp:176
msgid "Defoveate"
msgstr "フォビエーション解除"
#: client/scenes/stream_gui.cpp:176
#: client/scenes/stream_gui.cpp:178
msgid "Network"
msgstr "ネットワーク"
#: client/scenes/stream_gui.cpp:176 client/scenes/stream_gui.cpp:368
#: client/scenes/stream_gui.cpp:178 client/scenes/stream_gui.cpp:370
msgid "Download"
msgstr "ダウンロード"
#: client/scenes/stream_gui.cpp:177 client/scenes/stream_gui.cpp:369
#: client/scenes/stream_gui.cpp:179 client/scenes/stream_gui.cpp:371
msgid "Upload"
msgstr "アップロード"
#: client/scenes/stream_gui.cpp:246
#: client/scenes/stream_gui.cpp:248
#, c++-format
msgid "Decoder {}"
msgstr "デコーダー {}"
#: client/scenes/stream_gui.cpp:258
#: client/scenes/stream_gui.cpp:260
msgid "Timings [ms]"
msgstr "タイミング、ミリ秒"
#: client/scenes/stream_gui.cpp:318
#: client/scenes/stream_gui.cpp:320
msgid "Encode"
msgstr "動画エンコード"
#: client/scenes/stream_gui.cpp:319
#: client/scenes/stream_gui.cpp:321
msgid "Send"
msgstr "送信"
#: client/scenes/stream_gui.cpp:320
#: client/scenes/stream_gui.cpp:322
msgid "Receive"
msgstr "受信"
#: client/scenes/stream_gui.cpp:321
#: client/scenes/stream_gui.cpp:323
msgid "Decode"
msgstr "デコード"
#: client/scenes/stream_gui.cpp:322
#: client/scenes/stream_gui.cpp:324
msgid "Blitted"
msgstr "描画"
#: client/scenes/stream_gui.cpp:323
#: client/scenes/stream_gui.cpp:325
msgid "Displayed"
msgstr "表示"
#: client/scenes/stream_gui.cpp:324
#: client/scenes/stream_gui.cpp:326
msgid "Predicted"
msgstr "予測時間"
#: client/scenes/stream_gui.cpp:343
#: client/scenes/stream_gui.cpp:345
#, c++-format
msgid "Estimated motion to photons latency: {}ms"
msgstr "「Motion-to-photon」推定遅延 {}ミリ秒"
#: client/scenes/stream_gui.cpp:348
#: client/scenes/stream_gui.cpp:350
msgid "Press the grip button to move the window"
msgstr "グリップを握ってパネルを動かしましょう。"
#: client/scenes/stream_gui.cpp:350 client/scenes/stream_gui.cpp:918
#: client/scenes/stream_gui.cpp:352 client/scenes/stream_gui.cpp:900
msgid "Press both thumbsticks to display the WiVRn window"
msgstr "両方のサムスティックを同時に押すことで設定表示"
#: client/scenes/stream_gui.cpp:372
#: client/scenes/stream_gui.cpp:374
msgid "Motion to photon latency"
msgstr "「Motion-to-photon」遅延"
#: client/scenes/stream_gui.cpp:458
#: client/scenes/stream_gui.cpp:460
msgid "Bitrate:"
msgstr "ビットレート:"
#: client/scenes/stream_gui.cpp:468
#: client/scenes/stream_gui.cpp:470
msgid "Click to adjust bitrate"
msgstr "クリックしてビットレートを調整"
#: client/scenes/stream_gui.cpp:531
#: client/scenes/stream_gui.cpp:534
msgid "Foveation center override"
msgstr "光学中心の調整"
#: client/scenes/stream_gui.cpp:534
#: client/scenes/stream_gui.cpp:537
msgid "Enable"
msgstr "有効"
#: client/scenes/stream_gui.cpp:542 client/scenes/stream_gui.cpp:614
#: client/scenes/stream_gui.cpp:545 client/scenes/stream_gui.cpp:616
#, c++-format
msgid "Height {:.1f} deg"
msgstr "仰角 {:.1f}°"
#: client/scenes/stream_gui.cpp:543 client/scenes/stream_gui.cpp:615
#: client/scenes/stream_gui.cpp:546 client/scenes/stream_gui.cpp:617
#, c++-format
msgid "Distance {:.2f} m"
msgstr "距離 {:.2f}m"
#: client/scenes/stream_gui.cpp:544
#: client/scenes/stream_gui.cpp:547
msgid "Default"
msgstr "デフォルト"
#: client/scenes/stream_gui.cpp:555
#: client/scenes/stream_gui.cpp:558
msgid "Change"
msgstr "編集"
#: client/scenes/stream_gui.cpp:588
#: client/scenes/stream_gui.cpp:590
msgid "Use the right thumbstick to adjust the bitrate"
msgstr "右スティックでビットレートを調整しましょう"
#: client/scenes/stream_gui.cpp:589
#: client/scenes/stream_gui.cpp:591
msgid "Press A to go back"
msgstr "「A」を押して戻る"
#: client/scenes/stream_gui.cpp:590
#: client/scenes/stream_gui.cpp:592
#, c++-format
msgid "Bitrate: {}Mbit/s"
msgstr "ビットレート:{}Mbps"
#: client/scenes/stream_gui.cpp:612
#: client/scenes/stream_gui.cpp:614
msgid "Use the thumbsticks to move the foveation center"
msgstr "ジョイスティックを使って中心点を調整しましょう。"
#: client/scenes/stream_gui.cpp:613
#: client/scenes/stream_gui.cpp:615
msgid "Press A to save or B to cancel"
msgstr "AかBを押してキャンセル。"
#: client/scenes/stream_gui.cpp:671
#: client/scenes/stream_gui.cpp:673
msgid "Running XR applications:"
msgstr "XRアプリの実行"
#: client/scenes/stream_gui.cpp:688
#: client/scenes/stream_gui.cpp:690
msgid "Overlays"
msgstr "オーバーレイ"
#: client/scenes/stream_gui.cpp:727
#: client/scenes/stream_gui.cpp:729
msgid "Request to quit, may be ignored by the application"
msgstr "終了シグナルを送信する"
#: client/scenes/stream_gui.cpp:977
#: client/scenes/stream_gui.cpp:959
msgid "Applications"
msgstr "アプリ"
#: client/scenes/stream_gui.cpp:980
#: client/scenes/stream_gui.cpp:962
msgid "Start"
msgstr "実行する"
#: client/scenes/stream_gui.cpp:993
#: client/scenes/stream_gui.cpp:976
msgid "Stats"
msgstr "統計情報"
#: client/scenes/stream_gui.cpp:999
#: client/scenes/stream_gui.cpp:982
msgid "Statistics overlay"
msgstr "統計オーバーレイ"
#: client/scenes/stream_gui.cpp:1002
#: client/scenes/stream_gui.cpp:985
msgid "Compact view"
msgstr "コンパクト・モード"
+44 -32
View File
@@ -10,8 +10,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-02 14:05+0100\n"
"PO-Revision-Date: 2026-02-02 15:54+0100\n"
"POT-Creation-Date: 2026-02-16 21:54+0100\n"
"PO-Revision-Date: 2026-02-16 23:23+0100\n"
"Last-Translator: Claudio Sampaio (Patola) <patola@gmail.com>\n"
"Language-Team: Portuguese <>\n"
"Language: pt_BR\n"
@@ -19,7 +19,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Lokalize 25.12.1\n"
"X-Generator: Lokalize 25.12.2\n"
#: dashboard/apk_installer.cpp:137
#, kde-format
@@ -121,8 +121,8 @@ msgstr "Verificando a última versão..."
msgid "No APK is available for this version"
msgstr "Nenhum APK está disponível para esta versão"
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:368
#: dashboard/qml/Main.qml:426 dashboard/qml/WizardPage.qml:211
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:376
#: dashboard/qml/Main.qml:434 dashboard/qml/WizardPage.qml:211
#: dashboard/qml/WizardPage.qml:337
#, kde-format
msgid "ADB is not installed"
@@ -165,7 +165,7 @@ msgstr "Reinstalar WiVRn"
msgid "Install WiVRn"
msgstr "Instalar WiVRn"
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:431
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:439
#, kde-format
msgid "Headsets"
msgstr "Headsets"
@@ -291,7 +291,7 @@ msgid "Avahi daemon is not started"
msgstr "Avahi daemon não foi iniciado"
#: dashboard/qml/Main.qml:157 dashboard/qml/Main.qml:171
#: dashboard/qml/Main.qml:223
#: dashboard/qml/Main.qml:231
#, kde-format
msgid "Fix it"
msgstr "Conserte"
@@ -315,6 +315,18 @@ msgstr "Mais informações"
#: dashboard/qml/Main.qml:193
#, kde-format
msgid "Vulkan drivers cannot be found, you may need to run \"flatpak update\""
msgstr ""
"Drivers vulkan não foram encontrados, você pode ter que rodar \"flatpak update"
"\""
#: dashboard/qml/Main.qml:193
#, kde-format
msgid "Vulkan drivers cannot be found"
msgstr "Drivers vulkan não foram encontrados"
#: dashboard/qml/Main.qml:201
#, kde-format
msgid ""
"Use the Mesa (radv) driver for AMD GPUs\n"
"Hardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO"
@@ -322,7 +334,7 @@ msgstr ""
"Use o driver Mesa (radv) para GPUs AMD\n"
"Codificação de hardware com a vaapi não funciona com AMDVLK e AMDGPU-PRO"
#: dashboard/qml/Main.qml:201
#: dashboard/qml/Main.qml:209
#, kde-format
msgid ""
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
@@ -332,127 +344,127 @@ msgstr ""
"conseguirão carregar em VR.\n"
"Instale o xrizer ou o OpenComposite."
#: dashboard/qml/Main.qml:209
#: dashboard/qml/Main.qml:217
#, kde-format
msgid "Steam is installed as a snap. Snaps are not compatible with WiVRn."
msgstr "A Steam está instalada como snap. Snaps não são compatíveis com WiVRn."
#: dashboard/qml/Main.qml:217
#: dashboard/qml/Main.qml:225
#, kde-format
msgid ""
"Steam is installed as a flatpak but does not have sufficient permissions."
msgstr "A Steam está instalada como flatpak e não tem permissões suficientes."
#: dashboard/qml/Main.qml:232
#: dashboard/qml/Main.qml:240
#, kde-format
msgid "Restart the server for configuration changes to take effect"
msgstr ""
"Reinicie o servidor para que as alterações de configuração tenham efeito"
#: dashboard/qml/Main.qml:238
#: dashboard/qml/Main.qml:246
#, kde-format
msgctxt "restart the server"
msgid "Restart now"
msgstr "Reiniciar agora"
#: dashboard/qml/Main.qml:263
#: dashboard/qml/Main.qml:271
#, kde-format
msgid "Server failed to start"
msgstr "Servidor falhou em iniciar"
#: dashboard/qml/Main.qml:269 dashboard/qml/TroubleshootPage.qml:89
#: dashboard/qml/Main.qml:277 dashboard/qml/TroubleshootPage.qml:89
#, kde-format
msgid "Open server logs"
msgstr "Abrir logs do servidor"
#: dashboard/qml/Main.qml:295
#: dashboard/qml/Main.qml:303
#, kde-format
msgid "Server status"
msgstr "Status do servidor"
#: dashboard/qml/Main.qml:301
#: dashboard/qml/Main.qml:309
#, kde-format
msgctxt "whether the server is running, displayed in front of a checkbox"
msgid "Running"
msgstr "Rodando"
#: dashboard/qml/Main.qml:314
#: dashboard/qml/Main.qml:322
#, kde-format
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
msgid "Pairing"
msgstr "Pareando"
#: dashboard/qml/Main.qml:334
#: dashboard/qml/Main.qml:342
#, kde-format
msgid "Headset status"
msgstr "Status do headset"
#: dashboard/qml/Main.qml:341
#: dashboard/qml/Main.qml:349
#, kde-format
msgctxt "label for headset name/status under server running switch"
msgid "Headset"
msgstr "Headset"
#: dashboard/qml/Main.qml:344
#: dashboard/qml/Main.qml:352
#, kde-format
msgid "Not connected"
msgstr "Não conectado"
#: dashboard/qml/Main.qml:348
#: dashboard/qml/Main.qml:356
#, kde-format
msgid "Disconnect"
msgstr "Desconectar"
#: dashboard/qml/Main.qml:357 dashboard/qml/Main.qml:365
#: dashboard/qml/Main.qml:372
#: dashboard/qml/Main.qml:365 dashboard/qml/Main.qml:373
#: dashboard/qml/Main.qml:380
#, kde-format
msgctxt "label for USB status or connect button"
msgid "USB"
msgstr "USB"
#: dashboard/qml/Main.qml:358
#: dashboard/qml/Main.qml:366
#, kde-format
msgctxt "usb connect button"
msgid "Connect (wired)"
msgstr "Conectar (por cabo)"
#: dashboard/qml/Main.qml:375 dashboard/qml/WizardPage.qml:339
#: dashboard/qml/Main.qml:383 dashboard/qml/WizardPage.qml:339
#, kde-format
msgid "No headset is connected or your headset is not in developer mode"
msgstr ""
"Nenhum headset está conectado ou seu headset não está em modo desenvolvedor"
#: dashboard/qml/Main.qml:396
#: dashboard/qml/Main.qml:404
#, kde-format
msgid "Steam information"
msgstr "Informações da Steam"
#: dashboard/qml/Main.qml:412
#: dashboard/qml/Main.qml:420
#, kde-format
msgid "Wizard"
msgstr "Assistente"
#: dashboard/qml/Main.qml:418
#: dashboard/qml/Main.qml:426
#, kde-format
msgid "Install the app"
msgstr "Instalar o aplicativo"
#: dashboard/qml/Main.qml:437 dashboard/qml/SettingsPage.qml:14
#: dashboard/qml/Main.qml:445 dashboard/qml/SettingsPage.qml:14
#, kde-format
msgid "Settings"
msgstr "Ajustes"
#: dashboard/qml/Main.qml:443
#: dashboard/qml/Main.qml:451
#, kde-format
msgid "About"
msgstr "Sobre"
#: dashboard/qml/Main.qml:448 dashboard/qml/TroubleshootPage.qml:10
#: dashboard/qml/Main.qml:456 dashboard/qml/TroubleshootPage.qml:10
#, kde-format
msgid "Troubleshoot"
msgstr "Resolver problemas"
#: dashboard/qml/Main.qml:455
#: dashboard/qml/Main.qml:463
#, kde-format
msgid "Version %1"
msgstr "Versão %1"
+1 -1
View File
@@ -1 +1 @@
9dcc3e1de2f7449d9757f5db332c867b4d794fb3
723652b545a79609f9f04cb89fcbf807d9d6451a
@@ -1,7 +1,7 @@
From 0595d01bb32c959e2e64b96d5187fdb5f0f2d929 Mon Sep 17 00:00:00 2001
From 2884795b7d352e3e45348473a17660a568260d6e 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
Subject: [PATCH 1/8] c/multi: early wake of compositor
---
.../compositor/multi/comp_multi_compositor.c | 14 +++++++++
@@ -1,7 +1,7 @@
From bda12c93b506dd46980ca8f7e3dee6581fbdf549 Mon Sep 17 00:00:00 2001
From 8d22720c9574146f7115f5ba7ac39f3c4e4f48ae Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Tue, 8 Oct 2024 22:13:15 +0200
Subject: [PATCH 02/11] Use extern socket fd
Subject: [PATCH 2/8] Use extern socket fd
---
src/xrt/ipc/server/ipc_server_mainloop_linux.c | 8 ++++++++
@@ -1,7 +1,7 @@
From a258427c4c622f838a0360c1f4c1ead3bd3e182a Mon Sep 17 00:00:00 2001
From dc8c6b0fdd002631827528b0cd831e762cf74c31 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 03/11] change environment blend mode selection logic
Subject: [PATCH 3/8] change environment blend mode selection logic
---
src/xrt/compositor/multi/comp_multi_system.c | 26 +++++++++++++-------
@@ -1,7 +1,7 @@
From 4ebef00766669bcda9f27f57ef6e10da4e66a60e Mon Sep 17 00:00:00 2001
From f4b4c07740dcc58438340171ec473570b002b379 Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Sat, 15 Mar 2025 22:19:48 +0100
Subject: [PATCH 04/11] st/oxr: forward 0 refresh rate
Subject: [PATCH 4/8] st/oxr: forward 0 refresh rate
---
src/xrt/compositor/main/comp_compositor.c | 2 +-
@@ -1,7 +1,7 @@
From fb72a558ef3ccdcd9428345efcd2d2f15e474d27 Mon Sep 17 00:00:00 2001
From 73f329eaba1e46bf62ff6579e27cd39f0d9e6730 Mon Sep 17 00:00:00 2001
From: Patrick Nicolas <patricknicolas@laposte.net>
Date: Wed, 11 Sep 2024 22:56:29 +0200
Subject: [PATCH 05/11] Replace distortion with foveation
Subject: [PATCH 5/8] Replace distortion with foveation
---
src/xrt/compositor/main/comp_renderer.c | 6 +-
@@ -1,7 +1,7 @@
From c63be87d014aa9b67d7a8766a952a70701a629b4 Mon Sep 17 00:00:00 2001
From 9d1294834f49fc90ea22f5d841d7c0e5c0c1045d Mon Sep 17 00:00:00 2001
From: no name <git-am@invalid>
Date: Sun, 28 Sep 2025 11:33:10 +0200
Subject: [PATCH 06/11] d/steamvr_lh: prevent crash on vive pro2/WiVRn
Subject: [PATCH 6/8] d/steamvr_lh: prevent crash on vive pro2/WiVRn
---
src/xrt/drivers/steamvr_lh/steamvr_lh.cpp | 2 +-
@@ -1,7 +1,7 @@
From ccd1bef8ef971f29bf521abd74b9ebc97cb689fb Mon Sep 17 00:00:00 2001
From b9af535cf229acdbf7f1b534e9804c1b4e3fa3e1 Mon Sep 17 00:00:00 2001
From: Sapphire <imsapphire0@gmail.com>
Date: Fri, 7 Nov 2025 20:41:16 -0600
Subject: [PATCH 07/11] st/oxr: push XrEventDataInteractionProfileChanged when
Subject: [PATCH 7/8] st/oxr: push XrEventDataInteractionProfileChanged when
profile changes to NULL
---
@@ -9,7 +9,7 @@ Subject: [PATCH 07/11] st/oxr: push XrEventDataInteractionProfileChanged when
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/xrt/state_trackers/oxr/oxr_input.c b/src/xrt/state_trackers/oxr/oxr_input.c
index 388a37d9d..8e3bd9513 100644
index df2b479eb..c4b36ba81 100644
--- a/src/xrt/state_trackers/oxr/oxr_input.c
+++ b/src/xrt/state_trackers/oxr/oxr_input.c
@@ -1881,26 +1881,21 @@ oxr_session_update_action_bindings(struct oxr_logger *log, struct oxr_session *s
@@ -1,7 +1,7 @@
From 671ac1619a8986ef95cdb2dc3ca4c9db79930585 Mon Sep 17 00:00:00 2001
From 02206ede3aae832be5024263a805cafee2264080 Mon Sep 17 00:00:00 2001
From: no name <git-am@invalid>
Date: Thu, 15 Jan 2026 12:13:06 +0100
Subject: [PATCH 11/11] Don't get pose data for fast path
Subject: [PATCH 8/8] Don't get pose data for fast path
---
src/xrt/compositor/main/comp_renderer.c | 17 +++++++++--------
@@ -1,25 +0,0 @@
From b0e8426914c2b3bec366dbeaccce7db0260fa252 Mon Sep 17 00:00:00 2001
From: rcelyte <rcelyte@battletrains.org>
Date: Mon, 8 Dec 2025 19:29:28 +0000
Subject: [PATCH 08/11] d/solarxr: Fix flatpak socket path
---
src/xrt/drivers/solarxr/solarxr_ipc_socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/xrt/drivers/solarxr/solarxr_ipc_socket.c b/src/xrt/drivers/solarxr/solarxr_ipc_socket.c
index d50d30310..8a958ad8c 100644
--- a/src/xrt/drivers/solarxr/solarxr_ipc_socket.c
+++ b/src/xrt/drivers/solarxr/solarxr_ipc_socket.c
@@ -129,7 +129,7 @@ solarxr_ipc_socket_find(const enum u_logging_level log_level, const char filenam
}
// try path used by SlimeVR flatpak
- static const char flatpak_runtime_dir[] = "app/" SLIMEVR_IDENTIFIER "/";
+ static const char flatpak_runtime_dir[] = ".flatpak/" SLIMEVR_IDENTIFIER "/xdg-run/";
if (sizeof(addr.sun_path) - 1 - filename_len - runtime_dir_len >= sizeof(flatpak_runtime_dir) - 1) {
memcpy(&addr.sun_path[runtime_dir_len], flatpak_runtime_dir, sizeof(flatpak_runtime_dir) - 1);
memcpy(&addr.sun_path[runtime_dir_len + (sizeof(flatpak_runtime_dir) - 1)], filename, filename_len + 1);
--
2.53.0
@@ -1,526 +0,0 @@
From b975312f8c05fc12cefe31af791d3db3bc34ac3c Mon Sep 17 00:00:00 2001
From: rcelyte <rcelyte@battletrains.org>
Date: Fri, 14 Nov 2025 19:48:59 +0000
Subject: [PATCH 09/11] d/solarxr: Sync at fixed rate This improves tracking
latency by allowing SlimeVR to synchronize updates with its processing loop.
---
src/xrt/drivers/solarxr/protocol.h | 1 +
src/xrt/drivers/solarxr/solarxr_device.c | 429 ++++++++++++-----------
2 files changed, 223 insertions(+), 207 deletions(-)
diff --git a/src/xrt/drivers/solarxr/protocol.h b/src/xrt/drivers/solarxr/protocol.h
index fbdc36081..35c1dd917 100644
--- a/src/xrt/drivers/solarxr/protocol.h
+++ b/src/xrt/drivers/solarxr/protocol.h
@@ -150,6 +150,7 @@ struct solarxr_data_feed_update
enum solarxr_data_feed_message_type
{
SOLARXR_DATA_FEED_MESSAGE_POLL_DATA_FEED = 1,
+ SOLARXR_DATA_FEED_MESSAGE_START_DATA_FEED = 2,
SOLARXR_DATA_FEED_MESSAGE_DATA_FEED_UPDATE = 3,
};
diff --git a/src/xrt/drivers/solarxr/solarxr_device.c b/src/xrt/drivers/solarxr/solarxr_device.c
index ec5444b2a..29c0f9716 100644
--- a/src/xrt/drivers/solarxr/solarxr_device.c
+++ b/src/xrt/drivers/solarxr/solarxr_device.c
@@ -24,8 +24,8 @@
DEBUG_GET_ONCE_LOG_OPTION(solarxr_log, "SOLARXR_LOG", U_LOGGING_INFO)
DEBUG_GET_ONCE_BOOL_OPTION(solarxr_raw_trackers, "SOLARXR_RAW_TRACKERS", false)
-DEBUG_GET_ONCE_NUM_OPTION(solarxr_sync_delay_ms, "SOLARXR_SYNC_DELAY_MS", 4)
-DEBUG_GET_ONCE_NUM_OPTION(solarxr_sync_timeout_ms, "SOLARXR_SYNC_TIMEOUT_MS", 50)
+DEBUG_GET_ONCE_NUM_OPTION(solarxr_startup_timeout_ms, "SOLARXR_STARTUP_TIMEOUT_MS", 4000)
+DEBUG_GET_ONCE_NUM_OPTION(solarxr_sync_period_ms, "SOLARXR_SYNC_PERIOD_MS", 1)
struct solarxr_device;
struct solarxr_generic_tracker
@@ -43,7 +43,6 @@ struct solarxr_device
struct xrt_device base;
struct os_thread thread;
struct solarxr_ipc_socket socket;
- _Atomic(timepoint_ns) next_sync;
struct os_mutex mutex;
_Atomic(timepoint_ns) timestamp;
_Atomic(uint64_t) enabled_bones;
@@ -104,183 +103,6 @@ solarxr_tracker_id_to_wchar(struct solarxr_tracker_id id)
return le32toh(out);
}
-static void
-solarxr_device_sync(struct solarxr_device *const device)
-{
- const timepoint_ns time = os_monotonic_get_ns(), next_sync = atomic_exchange(&device->next_sync, INT64_MAX);
- if (time <= next_sync) {
- atomic_store(&device->next_sync, next_sync);
- return;
- }
-
- struct
- {
- uint8_t head[sizeof(struct solarxr_ipc_message)];
- struct poll_packet
- {
- uint32_t _root;
- uint16_t _table_shared[3];
- struct
- { // table MessageBundle
- int32_t _table;
- uint32_t data_feed_msgs; // vector*
- } bundle;
- struct
- { // vector<table DataFeedMessageHeader>
- uint32_t length;
- uint32_t values[1]; // table*
- } data_feed_msgs;
- uint16_t _table_data_feed_msgs_0[4];
- struct
- { // table DataFeedMessageHeader
- int32_t _table;
- uint32_t message; // table*
- uint8_t message_type; // enum DataFeedMessage
- uint8_t _pad[3];
- } data_feed_msgs_0;
- struct
- { // table PollDataFeed
- int32_t _table;
- uint32_t config; // table*
- } message;
- uint16_t _table_config[6];
- struct
- { // table DataFeedConfig
- int32_t _table;
- uint32_t trackers_mask; // table*
- bool bone_mask;
- uint8_t _pad[3];
- } config;
- struct
- { // table DeviceDataMask
- int32_t _table;
- uint32_t tracker_data; // table*
- } data_mask;
- uint16_t _table_synthetic_trackers_mask[10];
- struct
- { // table TrackerDataMask
- int32_t _table;
- bool rotation, position, raw_angular_velocity, linear_acceleration;
- } synthetic_trackers_mask;
- } body;
- } const poll_packet =
- {
- .body =
- {
- ._root = htole32(offsetof(struct poll_packet, bundle)),
- ._table_shared =
- {
- htole16(sizeof(poll_packet.body._table_shared)),
- htole16(8),
- htole16(4),
- },
- .bundle =
- {
- ._table = htole32(offsetof(struct poll_packet, bundle) -
- offsetof(struct poll_packet, _table_shared)),
- .data_feed_msgs = htole32(offsetof(struct poll_packet, data_feed_msgs) -
- offsetof(struct poll_packet, bundle.data_feed_msgs)),
- },
- .data_feed_msgs =
- {
- .length = htole32(ARRAY_SIZE(poll_packet.body.data_feed_msgs.values)),
- .values = {htole32(offsetof(struct poll_packet, data_feed_msgs_0) -
- offsetof(struct poll_packet, data_feed_msgs.values[0]))},
- },
- ._table_data_feed_msgs_0 =
- {
- htole16(sizeof(poll_packet.body._table_data_feed_msgs_0)),
- htole16(sizeof(poll_packet.body.data_feed_msgs_0) -
- sizeof(poll_packet.body.data_feed_msgs_0._pad)),
- htole16(offsetof(struct poll_packet, data_feed_msgs_0.message_type) -
- offsetof(struct poll_packet, data_feed_msgs_0)),
- htole16(offsetof(struct poll_packet, data_feed_msgs_0.message) -
- offsetof(struct poll_packet, data_feed_msgs_0)),
- },
- .data_feed_msgs_0 =
- {
- ._table = htole32(offsetof(struct poll_packet, data_feed_msgs_0) -
- offsetof(struct poll_packet, _table_data_feed_msgs_0)),
- .message = htole32(offsetof(struct poll_packet, message) -
- offsetof(struct poll_packet, data_feed_msgs_0.message)),
- .message_type = 1, // DataFeedMessage::PollDataFeed
- },
- .message =
- {
- ._table = htole32(offsetof(struct poll_packet, message) -
- offsetof(struct poll_packet, _table_shared)),
- .config = htole32(offsetof(struct poll_packet, config) -
- offsetof(struct poll_packet, message.config)),
- },
- ._table_config =
- {
- htole16(sizeof(poll_packet.body._table_config)),
- htole16(sizeof(poll_packet.body.config) - sizeof(poll_packet.body.config._pad)),
- 0,
- htole16((device->use_trackers && debug_get_bool_option_solarxr_raw_trackers()) *
- (offsetof(struct poll_packet, config.trackers_mask) -
- offsetof(struct poll_packet, config))),
- htole16((device->use_trackers && !debug_get_bool_option_solarxr_raw_trackers()) *
- (offsetof(struct poll_packet, config.trackers_mask) -
- offsetof(struct poll_packet, config))),
- htole16(offsetof(struct poll_packet, config.bone_mask) -
- offsetof(struct poll_packet, config)),
- },
- .config =
- {
- ._table = htole32(offsetof(struct poll_packet, config) -
- offsetof(struct poll_packet, _table_config)),
- .trackers_mask = htole32((debug_get_bool_option_solarxr_raw_trackers()
- ? offsetof(struct poll_packet, data_mask)
- : offsetof(struct poll_packet, synthetic_trackers_mask)) -
- offsetof(struct poll_packet, config.trackers_mask)),
- .bone_mask = true,
- },
- .data_mask =
- {
- ._table = htole32(offsetof(struct poll_packet, data_mask) -
- offsetof(struct poll_packet, _table_shared)),
- .tracker_data = htole32(offsetof(struct poll_packet, synthetic_trackers_mask) -
- offsetof(struct poll_packet, data_mask.tracker_data)),
- },
- ._table_synthetic_trackers_mask =
- {
- htole16(sizeof(poll_packet.body._table_synthetic_trackers_mask)),
- htole16(sizeof(poll_packet.body.synthetic_trackers_mask)),
- 0,
- 0,
- htole16(offsetof(struct poll_packet, synthetic_trackers_mask.rotation) -
- offsetof(struct poll_packet, synthetic_trackers_mask)),
- htole16(offsetof(struct poll_packet, synthetic_trackers_mask.position) -
- offsetof(struct poll_packet, synthetic_trackers_mask)),
- htole16(offsetof(struct poll_packet, synthetic_trackers_mask.raw_angular_velocity) -
- offsetof(struct poll_packet, synthetic_trackers_mask)),
- 0,
- 0,
- htole16(offsetof(struct poll_packet, synthetic_trackers_mask.linear_acceleration) -
- offsetof(struct poll_packet, synthetic_trackers_mask)),
- },
- .synthetic_trackers_mask =
- {
- ._table = htole32(offsetof(struct poll_packet, synthetic_trackers_mask) -
- offsetof(struct poll_packet, _table_synthetic_trackers_mask)),
- .rotation = true,
- .position = true,
- .raw_angular_velocity = true,
- .linear_acceleration = true,
- },
- },
- };
-
- solarxr_ipc_socket_send_raw(
- &device->socket, (const uint8_t *)&poll_packet,
- solarxr_ipc_message_inline((uint8_t *)&poll_packet,
- device->use_trackers
- ? sizeof(poll_packet)
- : sizeof(poll_packet.head) + offsetof(struct poll_packet, data_mask)));
- atomic_store(&device->next_sync, time + debug_get_num_option_solarxr_sync_timeout_ms() * U_TIME_1MS_IN_NS);
-}
-
static xrt_result_t
solarxr_device_update_inputs(struct xrt_device *const xdev)
{
@@ -435,7 +257,6 @@ solarxr_device_get_body_joints(struct xrt_device *const xdev,
struct solarxr_device *const device = solarxr_device(xdev);
assert(device != NULL);
- solarxr_device_sync(device);
os_mutex_lock(&device->mutex);
@@ -530,23 +351,208 @@ solarxr_device_handle_trackers(struct solarxr_device *const device,
}
}
-static struct span
-solarxr_device_receive_blocking(struct solarxr_device *const device)
-{
- do {
- const uint32_t buffer_len = solarxr_ipc_socket_receive(&device->socket);
- if (buffer_len != 0) {
- return (struct span){buffer_len, device->socket.buffer};
- }
- } while (solarxr_ipc_socket_wait_timeout(&device->socket, -1));
- return (struct span){0};
-}
-
static void *
solarxr_network_thread(void *const ptr)
{
struct solarxr_device *const device = (struct solarxr_device *)ptr;
- for (struct span buffer; (buffer = solarxr_device_receive_blocking(device)).length != 0;) {
+
+ {
+ struct
+ {
+ uint8_t head[sizeof(struct solarxr_ipc_message)];
+ struct start_packet
+ {
+ uint32_t _root;
+ uint16_t _table_shared[3];
+ struct
+ { // table MessageBundle
+ int32_t _table;
+ uint32_t data_feed_msgs; // vector*
+ } bundle;
+ struct
+ { // vector<table DataFeedMessageHeader>
+ uint32_t length;
+ uint32_t values[1]; // table*
+ } data_feed_msgs;
+ uint16_t _table_data_feed_msgs_0[4];
+ struct
+ { // table DataFeedMessageHeader
+ int32_t _table;
+ uint32_t message; // table*
+ uint8_t message_type; // enum DataFeedMessage
+ uint8_t _pad[3];
+ } data_feed_msgs_0;
+ struct
+ { // table StartDataFeed
+ int32_t _table;
+ uint32_t configs; // vector*
+ } message;
+ struct
+ { // vector<table DataFeedConfig>
+ uint32_t length;
+ uint32_t values[1]; // table*
+ } configs;
+ uint16_t _table_configs_0[6];
+ struct
+ { // table DataFeedConfig
+ int32_t _table;
+ uint32_t trackers_mask; // table*
+ uint16_t minimum_time_since_last;
+ bool bone_mask;
+ uint8_t _pad;
+ } configs_0;
+ struct
+ { // table DeviceDataMask
+ int32_t _table;
+ uint32_t tracker_data; // table*
+ } data_mask;
+ uint16_t _table_synthetic_trackers_mask[10];
+ struct
+ { // table TrackerDataMask
+ int32_t _table;
+ bool rotation, position, raw_angular_velocity, linear_acceleration;
+ } synthetic_trackers_mask;
+ } body;
+ } const start_packet =
+ {
+ .body =
+ {
+ ._root = htole32(offsetof(struct start_packet, bundle)),
+ ._table_shared =
+ {
+ htole16(sizeof(start_packet.body._table_shared)),
+ htole16(8),
+ htole16(4),
+ },
+ .bundle =
+ {
+ ._table = htole32(offsetof(struct start_packet, bundle) -
+ offsetof(struct start_packet, _table_shared)),
+ .data_feed_msgs = htole32(offsetof(struct start_packet, data_feed_msgs) -
+ offsetof(struct start_packet, bundle.data_feed_msgs)),
+ },
+ .data_feed_msgs =
+ {
+ .length = htole32(ARRAY_SIZE(start_packet.body.data_feed_msgs.values)),
+ .values = {htole32(offsetof(struct start_packet, data_feed_msgs_0) -
+ offsetof(struct start_packet, data_feed_msgs.values[0]))},
+ },
+ ._table_data_feed_msgs_0 =
+ {
+ htole16(sizeof(start_packet.body._table_data_feed_msgs_0)),
+ htole16(sizeof(start_packet.body.data_feed_msgs_0) -
+ sizeof(start_packet.body.data_feed_msgs_0._pad)),
+ htole16(offsetof(struct start_packet, data_feed_msgs_0.message_type) -
+ offsetof(struct start_packet, data_feed_msgs_0)),
+ htole16(offsetof(struct start_packet, data_feed_msgs_0.message) -
+ offsetof(struct start_packet, data_feed_msgs_0)),
+ },
+ .data_feed_msgs_0 =
+ {
+ ._table = htole32(offsetof(struct start_packet, data_feed_msgs_0) -
+ offsetof(struct start_packet, _table_data_feed_msgs_0)),
+ .message = htole32(offsetof(struct start_packet, message) -
+ offsetof(struct start_packet, data_feed_msgs_0.message)),
+ .message_type = SOLARXR_DATA_FEED_MESSAGE_START_DATA_FEED,
+ },
+ .message =
+ {
+ ._table = htole32(offsetof(struct start_packet, message) -
+ offsetof(struct start_packet, _table_shared)),
+ .configs = htole32(offsetof(struct start_packet, configs) -
+ offsetof(struct start_packet, message.configs)),
+ },
+ .configs =
+ {
+ .length = htole32(ARRAY_SIZE(start_packet.body.configs.values)),
+ .values = {htole32(offsetof(struct start_packet, configs_0) -
+ offsetof(struct start_packet, configs.values[0]))},
+ },
+ ._table_configs_0 =
+ {
+ htole16(sizeof(start_packet.body._table_configs_0)),
+ htole16(sizeof(start_packet.body.configs_0) -
+ sizeof(start_packet.body.configs_0._pad)),
+ htole16(offsetof(struct start_packet, configs_0.minimum_time_since_last) -
+ offsetof(struct start_packet, configs_0)),
+ htole16((device->use_trackers && debug_get_bool_option_solarxr_raw_trackers()) *
+ (offsetof(struct start_packet, configs_0.trackers_mask) -
+ offsetof(struct start_packet, configs_0))),
+ htole16((device->use_trackers &&
+ !debug_get_bool_option_solarxr_raw_trackers()) *
+ (offsetof(struct start_packet, configs_0.trackers_mask) -
+ offsetof(struct start_packet, configs_0))),
+ htole16(offsetof(struct start_packet, configs_0.bone_mask) -
+ offsetof(struct start_packet, configs_0)),
+ },
+ .configs_0 =
+ {
+ ._table = htole32(offsetof(struct start_packet, configs_0) -
+ offsetof(struct start_packet, _table_configs_0)),
+ .trackers_mask =
+ htole32((debug_get_bool_option_solarxr_raw_trackers()
+ ? offsetof(struct start_packet, data_mask)
+ : offsetof(struct start_packet, synthetic_trackers_mask)) -
+ offsetof(struct start_packet, configs_0.trackers_mask)),
+ .minimum_time_since_last =
+ htole16(
+ CLAMP(debug_get_num_option_solarxr_sync_period_ms(), 0, UINT16_MAX)),
+ .bone_mask = true,
+ },
+ .data_mask =
+ {
+ ._table = htole32(offsetof(struct start_packet, data_mask) -
+ offsetof(struct start_packet, _table_shared)),
+ .tracker_data = htole32(offsetof(struct start_packet, synthetic_trackers_mask) -
+ offsetof(struct start_packet, data_mask.tracker_data)),
+ },
+ ._table_synthetic_trackers_mask =
+ {
+ htole16(sizeof(start_packet.body._table_synthetic_trackers_mask)),
+ htole16(sizeof(start_packet.body.synthetic_trackers_mask)),
+ 0,
+ 0,
+ htole16(offsetof(struct start_packet, synthetic_trackers_mask.rotation) -
+ offsetof(struct start_packet, synthetic_trackers_mask)),
+ htole16(offsetof(struct start_packet, synthetic_trackers_mask.position) -
+ offsetof(struct start_packet, synthetic_trackers_mask)),
+ htole16(offsetof(struct start_packet,
+ synthetic_trackers_mask.raw_angular_velocity) -
+ offsetof(struct start_packet, synthetic_trackers_mask)),
+ 0,
+ 0,
+ htole16(offsetof(struct start_packet,
+ synthetic_trackers_mask.linear_acceleration) -
+ offsetof(struct start_packet, synthetic_trackers_mask)),
+ },
+ .synthetic_trackers_mask =
+ {
+ ._table =
+ htole32(offsetof(struct start_packet, synthetic_trackers_mask) -
+ offsetof(struct start_packet, _table_synthetic_trackers_mask)),
+ .rotation = true,
+ .position = true,
+ .raw_angular_velocity = true,
+ .linear_acceleration = true,
+ },
+ },
+ };
+
+ // start streaming
+ solarxr_ipc_socket_send_raw(
+ &device->socket, (const uint8_t *)&start_packet,
+ solarxr_ipc_message_inline((uint8_t *)&start_packet,
+ device->use_trackers ? sizeof(start_packet)
+ : sizeof(start_packet.head) +
+ offsetof(struct start_packet, data_mask)));
+ }
+
+ while (solarxr_ipc_socket_wait_timeout(&device->socket, -1)) {
+ const struct span buffer = {solarxr_ipc_socket_receive(&device->socket), device->socket.buffer};
+
+ if (buffer.length == 0) {
+ continue;
+ }
struct solarxr_message_bundle bundle;
if (!read_solarxr_message_bundle(&bundle, buffer.data, buffer.length,
@@ -617,11 +623,6 @@ solarxr_network_thread(void *const ptr)
if (bundle.data_feed_msgs.length == 0) {
continue;
}
-#if 0 // for latency testing
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(), "%.3fus", (os_monotonic_get_ns() - (atomic_load(&device->next_sync) - debug_get_num_option_solarxr_sync_timeout_ms() * U_TIME_1MS_IN_NS)) / 1000.);
-#endif
- atomic_store(&device->next_sync,
- device->timestamp + debug_get_num_option_solarxr_sync_delay_ms() * U_TIME_1MS_IN_NS);
os_mutex_lock(&device->mutex);
@@ -783,7 +784,6 @@ solarxr_generic_tracker_get_tracked_pose(struct xrt_device *const xdev,
struct solarxr_device *const parent = device->parent;
if (parent != NULL && (atomic_load(&parent->enabled_bones) & (1llu << device->role)) != 0) {
- solarxr_device_sync(parent);
assert(device->history != NULL);
m_relation_history_get(device->history, at_timestamp_ns, out_relation);
result = XRT_SUCCESS;
@@ -1101,10 +1101,28 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *const tracking_origin,
}
if (use_trackers) {
- const struct span buffer = solarxr_device_receive_blocking(device);
- if (buffer.length == 0) {
- U_LOG_IFL_E(debug_get_log_option_solarxr_log(), "solarxr_ipc_socket_receive() failed");
- goto fail;
+ struct span buffer;
+ const timepoint_ns startTime = os_monotonic_get_ns();
+ for (time_duration_ns waited = 0, timeout = CLAMP(debug_get_num_option_solarxr_startup_timeout_ms(), 0,
+ INT64_MAX / U_TIME_1MS_IN_NS) *
+ U_TIME_1MS_IN_NS;
+ true;) {
+ if (!solarxr_ipc_socket_wait_timeout(&device->socket, timeout - waited)) {
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(),
+ "solarxr_ipc_socket_wait_timeout() failed");
+ goto fail;
+ }
+
+ buffer = (struct span){solarxr_ipc_socket_receive(&device->socket), device->socket.buffer};
+ if (buffer.length != 0) {
+ break;
+ }
+
+ waited = os_monotonic_get_ns() - startTime;
+ if (waited >= timeout) {
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(), "receive timeout");
+ goto fail;
+ }
}
struct solarxr_message_bundle bundle;
@@ -1231,9 +1249,6 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *const tracking_origin,
goto fail;
}
- // early sync to initialize bone lengths needed by `solarxr_device_get_body_skeleton()`
- solarxr_device_sync(device);
-
assert(1 + trackers_len <= out_xdevs_cap);
out_xdevs[0] = &device->base;
for (uint32_t i = 0; i < trackers_len; ++i) {
--
2.53.0
@@ -0,0 +1,33 @@
From 6f17ee6c92b62a2418164f627775f267eb6d19fc Mon Sep 17 00:00:00 2001
From: no name <git-am@invalid>
Date: Sun, 25 Jan 2026 10:09:10 +0100
Subject: [PATCH] don't verify GL stuff
---
src/xrt/state_trackers/oxr/oxr_verify.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/xrt/state_trackers/oxr/oxr_verify.c b/src/xrt/state_trackers/oxr/oxr_verify.c
index e9197d501..71f81c954 100644
--- a/src/xrt/state_trackers/oxr/oxr_verify.c
+++ b/src/xrt/state_trackers/oxr/oxr_verify.c
@@ -608,16 +608,6 @@ oxr_verify_XrGraphicsBindingOpenGLXlibKHR(struct oxr_logger *log, const XrGraphi
"XrGraphicsBindingOpenGLXlibKHR::glxDrawable is NULL");
}
- if (next->glxFBConfig == NULL) {
- return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID,
- "XrGraphicsBindingOpenGLXlibKHR::glxFBConfig is NULL");
- }
-
- if (next->visualid == 0) {
- return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID,
- "XrGraphicsBindingOpenGLXlibKHR::visualid is 0");
- }
-
return XR_SUCCESS;
}
--
2.52.0
@@ -1,876 +0,0 @@
From c39ea86d5312a3b0da0e376161df57a590a4a856 Mon Sep 17 00:00:00 2001
From: rcelyte <rcelyte@battletrains.org>
Date: Mon, 15 Sep 2025 22:46:15 +0000
Subject: [PATCH 10/11] d/solarxr: Feed device poses to server
For now this utilizes SlimeVR's separate "SteamVR Feeder" API,
waiting on https://github.com/SlimeVR/SlimeVR-Server/issues/895.
---
src/xrt/drivers/CMakeLists.txt | 2 +
src/xrt/drivers/solarxr/feeder.c | 339 ++++++++++++++++++++
src/xrt/drivers/solarxr/feeder.h | 85 +++++
src/xrt/drivers/solarxr/protocol.h | 30 +-
src/xrt/drivers/solarxr/solarxr_device.c | 161 ++++++----
src/xrt/drivers/solarxr/solarxr_interface.h | 20 ++
6 files changed, 573 insertions(+), 64 deletions(-)
create mode 100644 src/xrt/drivers/solarxr/feeder.c
create mode 100644 src/xrt/drivers/solarxr/feeder.h
diff --git a/src/xrt/drivers/CMakeLists.txt b/src/xrt/drivers/CMakeLists.txt
index b44617e1a..040bd76b7 100644
--- a/src/xrt/drivers/CMakeLists.txt
+++ b/src/xrt/drivers/CMakeLists.txt
@@ -543,6 +543,8 @@ endif()
if(XRT_BUILD_DRIVER_SOLARXR)
add_library(
drv_solarxr STATIC
+ solarxr/feeder.c
+ solarxr/feeder.h
solarxr/protocol.c
solarxr/protocol.h
solarxr/solarxr_device.c
diff --git a/src/xrt/drivers/solarxr/feeder.c b/src/xrt/drivers/solarxr/feeder.c
new file mode 100644
index 000000000..3c79eef8b
--- /dev/null
+++ b/src/xrt/drivers/solarxr/feeder.c
@@ -0,0 +1,339 @@
+// Copyright 2025, rcelyte
+// SPDX-License-Identifier: BSL-1.0
+/*!
+ * @file
+ * @brief SolarXR pose feeder
+ * @ingroup drv_solarxr
+ */
+
+#include "feeder.h"
+#include "solarxr_ipc_message.h"
+
+#include "util/u_hashmap.h"
+#include "xrt/xrt_device.h"
+
+#include <math.h>
+#include <pb.h>
+
+static const char manufacturer[] = "Monado";
+
+#define PROTOBUF_FLOAT(v_) ((uint8_t *)&(v_))[0], ((uint8_t *)&(v_))[1], ((uint8_t *)&(v_))[2], ((uint8_t *)&(v_))[3]
+#define PROTOBUF_INT32(v_) \
+ (uint8_t)(0x80 | (uint32_t)(v_)), (uint8_t)(0x80 | (uint32_t)(v_) >> 7), \
+ (uint8_t)(0x80 | (uint32_t)(v_) >> 14), (uint8_t)(0x80 | (uint32_t)(v_) >> 21), (uint32_t)(v_) >> 28
+
+struct feeder_device
+{
+ struct feeder_device *next_to_erase;
+ struct xrt_device *xdev;
+ enum xrt_input_name input_name;
+ uint32_t id;
+ bool destroyed;
+ uint8_t last_status;
+ bool battery_charging;
+ float battery_charge;
+};
+
+bool
+feeder_add_device(struct feeder *const feeder, struct xrt_device *const xdev)
+{
+ if (xdev == NULL || !xdev->supported.orientation_tracking) {
+ return false;
+ }
+ os_mutex_lock(&feeder->mutex);
+
+ bool result = false;
+ if (!solarxr_ipc_socket_is_connected(&feeder->socket) &&
+ !solarxr_ipc_socket_connect(&feeder->socket,
+ solarxr_ipc_socket_find(feeder->socket.log_level, "SlimeVRInput"))) {
+ goto unlock;
+ }
+
+ // find a suitable pose input to report
+ enum xrt_input_name input_name = XRT_INPUT_GENERIC_TRACKER_POSE;
+ for (size_t input = 0, input_count = xdev->input_count; input < input_count; ++input) {
+ if (XRT_GET_INPUT_TYPE(xdev->inputs[input].name) == XRT_INPUT_TYPE_POSE) {
+ input_name = xdev->inputs[input].name;
+ break;
+ }
+ }
+
+ uint8_t role = 0;
+ const char *role_name = "NONE";
+ switch (xdev->device_type) {
+ case XRT_DEVICE_TYPE_HMD: {
+ role = 19;
+ role_name = "HMD";
+ } break;
+ case XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER: {
+ role = 14;
+ role_name = "RIGHT_CONTROLLER";
+ } break;
+ case XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER: {
+ role = 13;
+ role_name = "LEFT_CONTROLLER";
+ } break;
+ case XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER: {
+ role = 21;
+ role_name = "GENERIC_CONTROLLER";
+ } break;
+ default:;
+ }
+
+ // serialize announcement packet
+ const uint32_t serial_len = strlen(xdev->serial), name_len = strlen(xdev->str);
+ const uint8_t message_1[] = {
+ (3 << 3) | PB_WT_STRING, PROTOBUF_INT32(0), // ProtobufMessage::tracker_added
+ (1 << 3) | PB_WT_VARINT, PROTOBUF_INT32(feeder->next_id), // TrackerAdded::tracker_id
+ (4 << 3) | PB_WT_VARINT, role, // TrackerAdded::tracker_role
+ (2 << 3) | PB_WT_STRING, PROTOBUF_INT32(serial_len),
+ };
+ static_assert(sizeof(manufacturer) - 1 < 0x80, "");
+ uint8_t message_2[] = {
+ (5 << 3) | PB_WT_STRING,
+ sizeof(manufacturer) - 1,
+ // TrackerAdded::manufacturer
+ [2 + (sizeof(manufacturer) - 1)] = (3 << 3) | PB_WT_STRING,
+ PROTOBUF_INT32(name_len),
+ };
+ memcpy(&message_2[2], manufacturer, sizeof(manufacturer) - 1);
+ uint8_t packet[sizeof(struct solarxr_ipc_message) + sizeof(message_1) + sizeof(xdev->serial) +
+ sizeof(message_2) + sizeof(xdev->str)];
+ struct solarxr_ipc_message *const message = solarxr_ipc_message_start(packet, &packet[ARRAY_SIZE(packet)]);
+ solarxr_ipc_message_write(message, &packet[ARRAY_SIZE(packet)], message_1, sizeof(message_1));
+ solarxr_ipc_message_write(message, &packet[ARRAY_SIZE(packet)], (const uint8_t *)xdev->serial,
+ serial_len); // TrackerAdded::tracker_serial
+ solarxr_ipc_message_write(message, &packet[ARRAY_SIZE(packet)], message_2, sizeof(message_2));
+ solarxr_ipc_message_write(message, &packet[ARRAY_SIZE(packet)], (const uint8_t *)xdev->str,
+ name_len); // TrackerAdded::tracker_name
+ const uint32_t packet_len = solarxr_ipc_message_end(message, &(uint8_t *){packet});
+ if (packet_len == 0) {
+ U_LOG_IFL_E(feeder->socket.log_level, "solarxr_ipc_message_end() failed");
+ assert(false);
+ goto unlock;
+ }
+ const uint8_t tracker_added[] = {
+ PROTOBUF_INT32(packet_len - sizeof(*message) - sizeof((uint8_t[]){0, PROTOBUF_INT32(0)})),
+ };
+ memcpy(&message->body[1], tracker_added, sizeof(tracker_added));
+
+ // initialize tracked state for the device
+ struct feeder_device *const device = malloc(sizeof(*device));
+ if (device == NULL) {
+ U_LOG_IFL_E(feeder->socket.log_level, "malloc() failed");
+ goto unlock;
+ }
+ *device = (struct feeder_device){
+ .xdev = xdev,
+ .input_name = input_name,
+ .id = feeder->next_id++,
+ .last_status = UINT8_MAX,
+ };
+ u_hashmap_int_insert(feeder->devices, (uint64_t)(uintptr_t)xdev, device);
+
+ // send the announcement
+ solarxr_ipc_socket_send_raw(&feeder->socket, packet, packet_len);
+ U_LOG_IFL_D(feeder->socket.log_level, " \"%s\" [id=%" PRIu32 " serial=\"%s\" role=TrackerRole::%s]",
+ xdev->str, device->id, xdev->serial, role_name);
+ result = true;
+
+unlock:
+ os_mutex_unlock(&feeder->mutex);
+ return result;
+}
+
+static void
+feeder_device_unlink(struct feeder_device *const device,
+ struct xrt_device *const xdev,
+ const enum u_logging_level log_level)
+{
+ if (device != NULL) {
+ device->destroyed = true;
+ U_LOG_IFL_D(log_level, "device \"%.*s\" removed", (unsigned)ARRAY_SIZE(xdev->str), xdev->str);
+ }
+}
+
+void
+feeder_remove_device(struct feeder *const feeder, struct xrt_device *const xdev)
+{
+ os_mutex_lock(&feeder->mutex);
+
+ struct feeder_device *device = NULL;
+ u_hashmap_int_find(feeder->devices, (uint64_t)(uintptr_t)xdev, (void **)&device);
+ feeder_device_unlink(device, xdev, feeder->socket.log_level);
+
+ os_mutex_unlock(&feeder->mutex);
+}
+
+static void
+feeder_device_remove_cb(const uint64_t key, const void *const value, void *const userptr)
+{
+ struct feeder_device *const device = (struct feeder_device *)value;
+ if (!device->destroyed) { // xdev pointer may be dangling if destroyed
+ feeder_device_unlink(device, (struct xrt_device *)(uintptr_t)key,
+ ((struct feeder *)userptr)->socket.log_level);
+ }
+}
+
+void
+feeder_clear_devices(struct feeder *const feeder)
+{
+ os_mutex_lock(&feeder->mutex);
+ u_hashmap_int_for_each(feeder->devices, feeder_device_remove_cb, feeder);
+ os_mutex_unlock(&feeder->mutex);
+}
+
+struct send_feedback_userdata
+{
+ struct feeder_device *to_erase;
+ timepoint_ns time;
+ uint8_t *packet_end, packet[0x10000];
+};
+
+static void
+feeder_device_send_feedback_cb(const uint64_t key, const void *const value, void *const userptr)
+{
+ struct feeder_device *const device = (struct feeder_device *)value;
+ struct xrt_device *const xdev = device->destroyed ? NULL : (struct xrt_device *)(uintptr_t)key;
+ struct send_feedback_userdata *const data = (struct send_feedback_userdata *)userptr;
+ uint8_t status = 0; // Status::DISCONNECTED
+ if (xdev == NULL) {
+ device->next_to_erase = data->to_erase;
+ data->to_erase = device;
+ } else {
+ // report meaningful changes in battery level
+ bool present = false, charging = false;
+ float charge = 0;
+ if (xdev->supported.battery_status &&
+ xrt_device_get_battery_status(xdev, &present, &charging, &charge) == XRT_SUCCESS &&
+ (charging != device->battery_charging || fabsf(charge - device->battery_charge) >= 1e-05)) {
+ device->battery_charging = charging;
+ device->battery_charge = charge;
+ uint8_t message[] = {
+ (5 << 3) | PB_WT_STRING, 0, // ProtobufMessage::battery
+ (1 << 3) | PB_WT_VARINT, PROTOBUF_INT32(device->id), // Battery::tracker_id
+ (2 << 3) | PB_WT_32BIT, PROTOBUF_FLOAT(charge), // Battery::battery_level
+ (3 << 3) | PB_WT_VARINT, charging, // Battery::is_charging
+ };
+ message[1] = sizeof(message) - 2;
+ solarxr_ipc_message_write_single(&data->packet_end, &data->packet[ARRAY_SIZE(data->packet)],
+ message, sizeof(message));
+ }
+
+ // report pose
+ struct xrt_space_relation relation = {0};
+ assert(xdev->get_tracked_pose != NULL);
+ if (xrt_device_get_tracked_pose(xdev, device->input_name, data->time, &relation) == XRT_SUCCESS &&
+ (relation.relation_flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) != 0) {
+ uint8_t message[30 + 15] = {
+ (1 << 3) | PB_WT_STRING, 0, // ProtobufMessage::position
+ (1 << 3) | PB_WT_VARINT, PROTOBUF_INT32(device->id), // Position::tracker_id
+ (5 << 3) | PB_WT_32BIT, PROTOBUF_FLOAT(relation.pose.orientation.x), // Position::qx
+ (6 << 3) | PB_WT_32BIT, PROTOBUF_FLOAT(relation.pose.orientation.y), // Position::qy
+ (7 << 3) | PB_WT_32BIT, PROTOBUF_FLOAT(relation.pose.orientation.z), // Position::qz
+ (8 << 3) | PB_WT_32BIT, PROTOBUF_FLOAT(relation.pose.orientation.w), // Position::qw
+ (9 << 3) | PB_WT_VARINT, 3, // Position::data_source = DataSource::FULL
+ };
+ uint32_t message_len = sizeof(message);
+ if ((relation.relation_flags & XRT_SPACE_RELATION_POSITION_VALID_BIT) != 0) {
+ const uint8_t position[15] = {
+ (2 << 3) | PB_WT_32BIT, PROTOBUF_FLOAT(relation.pose.position.x), // Position::x
+ (3 << 3) | PB_WT_32BIT, PROTOBUF_FLOAT(relation.pose.position.y), // Position::y
+ (4 << 3) | PB_WT_32BIT, PROTOBUF_FLOAT(relation.pose.position.z), // Position::z
+ };
+ memcpy(&message[sizeof(message) - sizeof(position)], position, sizeof(position));
+ } else {
+ message_len -= 15;
+ }
+ message[1] = message_len - 2;
+ solarxr_ipc_message_write_single(&data->packet_end, &data->packet[ARRAY_SIZE(data->packet)],
+ message, message_len);
+ if ((relation.relation_flags & XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT) != 0) {
+ status = 1; // Status::OK
+ }
+ }
+ }
+
+ // report tracking status
+ if (status != device->last_status) {
+ device->last_status = status;
+ uint8_t message[] = {
+ (4 << 3) | PB_WT_STRING, 0, // ProtobufMessage::tracker_status
+ (1 << 3) | PB_WT_VARINT, PROTOBUF_INT32(device->id), // TrackerStatus::tracker_id
+ (2 << 3) | PB_WT_VARINT, status, // TrackerStatus::status
+ };
+ message[1] = sizeof(message) - 2;
+ solarxr_ipc_message_write_single(&data->packet_end, &data->packet[ARRAY_SIZE(data->packet)], message,
+ sizeof(message));
+ }
+}
+
+void
+feeder_send_feedback(struct feeder *const feeder)
+{
+ if (!solarxr_ipc_socket_is_connected(&feeder->socket)) {
+ return;
+ }
+
+ // check for errors on the socket
+ if (!solarxr_ipc_socket_wait_timeout(&feeder->socket, 0)) {
+ U_LOG_IFL_E(feeder->socket.log_level, "connection lost");
+ solarxr_ipc_socket_destroy(&feeder->socket);
+ return;
+ }
+
+ os_mutex_lock(&feeder->mutex);
+
+ struct send_feedback_userdata data;
+ data.to_erase = NULL;
+ data.time = os_monotonic_get_ns();
+ data.packet_end = data.packet;
+ u_hashmap_int_for_each(feeder->devices, feeder_device_send_feedback_cb, &data);
+
+ // flush queued messages to socket
+ if (data.packet_end != data.packet) {
+ solarxr_ipc_socket_send_raw(&feeder->socket, data.packet, data.packet_end - data.packet);
+ }
+
+ while (data.to_erase != NULL) {
+ struct feeder_device *const entry = data.to_erase;
+ data.to_erase = entry->next_to_erase;
+ u_hashmap_int_erase(feeder->devices, (uint64_t)(uintptr_t)entry->xdev);
+ free(entry);
+ }
+
+ os_mutex_unlock(&feeder->mutex);
+}
+
+bool
+feeder_init(struct feeder *const feeder, const enum u_logging_level log_level)
+{
+ feeder->devices = NULL;
+ solarxr_ipc_socket_init(&feeder->socket, log_level);
+ if (os_mutex_init(&feeder->mutex) != 0) {
+ return false;
+ }
+ u_hashmap_int_create(&feeder->devices);
+ return true;
+}
+
+static void
+feeder_device_free_cb(const uint64_t key, const void *const value, void *const userptr)
+{
+ (void)key;
+ (void)userptr;
+ free((void *)value);
+}
+
+void
+feeder_fini(struct feeder *const feeder)
+{
+ if (feeder->devices != NULL) {
+ feeder_clear_devices(feeder);
+ feeder_send_feedback(feeder);
+ u_hashmap_int_for_each(feeder->devices, feeder_device_free_cb, NULL);
+ u_hashmap_int_destroy(&feeder->devices);
+ }
+ os_mutex_destroy(&feeder->mutex);
+ solarxr_ipc_socket_destroy(&feeder->socket);
+}
diff --git a/src/xrt/drivers/solarxr/feeder.h b/src/xrt/drivers/solarxr/feeder.h
new file mode 100644
index 000000000..cb8de6d06
--- /dev/null
+++ b/src/xrt/drivers/solarxr/feeder.h
@@ -0,0 +1,85 @@
+// Copyright 2025, rcelyte
+// SPDX-License-Identifier: BSL-1.0
+/*!
+ * @file
+ * @brief SolarXR pose feeder
+ * @ingroup drv_solarxr
+ */
+
+#pragma once
+#include "solarxr_ipc_socket.h"
+
+#include "os/os_threading.h"
+
+/*!
+ * Object that observes a collection of @ref xrt_device objects,
+ * reporting their poses and status to a SolarXR server over IPC
+ * @ingroup drv_solarxr
+ */
+struct u_hashmap_int;
+struct feeder
+{
+ struct os_mutex mutex;
+ struct solarxr_ipc_socket socket;
+ uint32_t next_id;
+ struct u_hashmap_int *devices;
+};
+
+bool
+feeder_init(struct feeder *feeder, enum u_logging_level log_level);
+
+void
+feeder_fini(struct feeder *feeder);
+
+/*!
+ * Register a device to observe and announce it to the server
+ *
+ * Holds the mutex during most of the operation.
+ *
+ * @param feeder self
+ * @param device device to register
+ *
+ * @return true on success.
+ *
+ * @public @memberof feeder
+ */
+bool
+feeder_add_device(struct feeder *feeder, struct xrt_device *xdev); // thread safe
+
+/*!
+ * Unregister a previously added device
+ *
+ * Holds the mutex during most of the operation.
+ *
+ * @param feeder self
+ * @param device device to unregister
+ *
+ * @public @memberof feeder
+ */
+void
+feeder_remove_device(struct feeder *feeder, struct xrt_device *xdev); // thread safe
+
+/*!
+ * Unregister all observed devices
+ *
+ * Holds the mutex during most of the operation.
+ *
+ * @param feeder self
+ *
+ * @public @memberof feeder
+ */
+void
+feeder_clear_devices(struct feeder *feeder); // thread safe
+
+/*!
+ * Poll all observed xdevs and
+ *
+ * Holds the mutex during most of the operation.
+ *
+ * @param feeder self
+ * @param time Timestamp used to query device poses
+ *
+ * @public @memberof feeder
+ */
+void
+feeder_send_feedback(struct feeder *feeder); // thread safe
diff --git a/src/xrt/drivers/solarxr/protocol.h b/src/xrt/drivers/solarxr/protocol.h
index 35c1dd917..b397dff41 100644
--- a/src/xrt/drivers/solarxr/protocol.h
+++ b/src/xrt/drivers/solarxr/protocol.h
@@ -89,10 +89,12 @@ struct solarxr_tracker_id
uint8_t tracker_num;
};
+typedef FLATBUFFERS_VECTOR(char) flatbuffers_vector_char_t;
+
struct solarxr_tracker_info
{ // table solarxr_protocol.data_feed.tracker.TrackerInfo
enum solarxr_body_part body_part;
- FLATBUFFERS_VECTOR(char) display_name;
+ flatbuffers_vector_char_t display_name;
};
typedef struct
@@ -120,10 +122,12 @@ typedef struct
flatbuffers_uoffset_t offset;
} solarxr_device_data_t;
+typedef FLATBUFFERS_VECTOR(solarxr_tracker_data_t) flatbuffers_vector_solarxr_tracker_data_t;
+
struct solarxr_device_data
{ // table solarxr_protocol.data_feed.device_data.DeviceData
uint8_t id;
- FLATBUFFERS_VECTOR(solarxr_tracker_data_t) trackers; // solarxr_protocol.data_feed.tracker.TrackerData[]
+ flatbuffers_vector_solarxr_tracker_data_t trackers; // solarxr_protocol.data_feed.tracker.TrackerData[]
};
typedef struct
@@ -139,12 +143,15 @@ struct solarxr_bone
struct xrt_vec3 head_position_g;
};
+typedef FLATBUFFERS_VECTOR(solarxr_device_data_t) flatbuffers_vector_solarxr_device_data_t;
+typedef FLATBUFFERS_VECTOR(solarxr_bone_t) flatbuffers_vector_solarxr_bone_t;
+
struct solarxr_data_feed_update
-{ // table solarxr_protocol.data_feed.DataFeedUpdate
- FLATBUFFERS_VECTOR(solarxr_device_data_t) devices; // solarxr_protocol.data_feed.device_data.DeviceData[]
- FLATBUFFERS_VECTOR(solarxr_tracker_data_t)
- synthetic_trackers; // solarxr_protocol.data_feed.tracker.TrackerData[]
- FLATBUFFERS_VECTOR(solarxr_bone_t) bones; // solarxr_protocol.data_feed.Bone[]
+{ // table solarxr_protocol.data_feed.DataFeedUpdate
+ flatbuffers_vector_solarxr_device_data_t devices; // solarxr_protocol.data_feed.device_data.DeviceData[]
+ flatbuffers_vector_solarxr_tracker_data_t
+ synthetic_trackers; // solarxr_protocol.data_feed.tracker.TrackerData[]
+ flatbuffers_vector_solarxr_bone_t bones; // solarxr_protocol.data_feed.Bone[]
};
enum solarxr_data_feed_message_type
@@ -214,11 +221,14 @@ typedef struct
flatbuffers_uoffset_t offset;
} solarxr_message_bundle_t;
+typedef FLATBUFFERS_VECTOR(solarxr_data_feed_message_header_t) flatbuffers_vector_solarxr_data_feed_message_header_t;
+typedef FLATBUFFERS_VECTOR(solarxr_rpc_message_header_t) flatbuffers_vector_solarxr_rpc_message_header_t;
+
struct solarxr_message_bundle
{ // table solarxr_protocol.MessageBundle
- FLATBUFFERS_VECTOR(solarxr_data_feed_message_header_t)
- data_feed_msgs; // solarxr_protocol.data_feed.DataFeedMessageHeader[]
- FLATBUFFERS_VECTOR(solarxr_rpc_message_header_t) rpc_msgs; // solarxr_protocol.rpc.RpcMessageHeader[]
+ flatbuffers_vector_solarxr_data_feed_message_header_t
+ data_feed_msgs; // solarxr_protocol.data_feed.DataFeedMessageHeader[]
+ flatbuffers_vector_solarxr_rpc_message_header_t rpc_msgs; // solarxr_protocol.rpc.RpcMessageHeader[]
};
bool
diff --git a/src/xrt/drivers/solarxr/solarxr_device.c b/src/xrt/drivers/solarxr/solarxr_device.c
index 29c0f9716..4a65a7494 100644
--- a/src/xrt/drivers/solarxr/solarxr_device.c
+++ b/src/xrt/drivers/solarxr/solarxr_device.c
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: BSL-1.0
#include "solarxr_interface.h"
+#include "feeder.h"
#include "protocol.h"
#include "solarxr_ipc_message.h"
#include "solarxr_ipc_socket.h"
@@ -41,6 +42,7 @@ struct solarxr_generic_tracker
struct solarxr_device
{
struct xrt_device base;
+ struct feeder feeder;
struct os_thread thread;
struct solarxr_ipc_socket socket;
struct os_mutex mutex;
@@ -305,7 +307,7 @@ solarxr_device_handle_trackers(struct solarxr_device *const device,
for (uint32_t i = 0; i < trackers_len; ++i) {
struct solarxr_tracker_data data;
if (!read_solarxr_tracker_data(&data, buffer.data, buffer.length, &trackers[i])) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(), "read_solarxr_device_data() failed");
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(), "read_solarxr_device_data() failed");
continue;
}
@@ -557,7 +559,7 @@ solarxr_network_thread(void *const ptr)
struct solarxr_message_bundle bundle;
if (!read_solarxr_message_bundle(&bundle, buffer.data, buffer.length,
(const solarxr_message_bundle_t *)buffer.data)) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(), "read_solarxr_message_bundle() failed");
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(), "read_solarxr_message_bundle() failed");
continue;
}
@@ -568,7 +570,7 @@ solarxr_network_thread(void *const ptr)
struct solarxr_rpc_message_header header;
if (!read_solarxr_rpc_message_header(&header, buffer.data, buffer.length,
&bundle.rpc_msgs.data[i])) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(),
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(),
"read_solarxr_rpc_message_header() failed");
continue;
}
@@ -624,6 +626,8 @@ solarxr_network_thread(void *const ptr)
continue;
}
+ feeder_send_feedback(&device->feeder);
+
os_mutex_lock(&device->mutex);
FLATBUFFERS_VECTOR(solarxr_bone_t) bones = {0};
@@ -631,7 +635,7 @@ solarxr_network_thread(void *const ptr)
struct solarxr_data_feed_message_header header;
if (!read_solarxr_data_feed_message_header(&header, buffer.data, buffer.length,
&bundle.data_feed_msgs.data[0])) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(),
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(),
"read_solarxr_data_feed_message_header() failed");
continue;
}
@@ -646,7 +650,7 @@ solarxr_network_thread(void *const ptr)
if (!read_solarxr_device_data(
&device_data, buffer.data, buffer.length,
&header.message.data_feed_update.devices.data[j])) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(),
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(),
"read_solarxr_device_data() failed");
continue;
}
@@ -672,7 +676,7 @@ solarxr_network_thread(void *const ptr)
for (size_t i = 0; i < bones.length; ++i) {
struct solarxr_bone bone;
if (!read_solarxr_bone(&bone, buffer.data, buffer.length, &bones.data[i])) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(), "read_solarxr_bone() failed");
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(), "read_solarxr_bone() failed");
continue;
}
@@ -760,6 +764,8 @@ solarxr_device_destroy(struct xrt_device *xdev)
os_thread_destroy(&device->thread);
}
+ feeder_fini(&device->feeder);
+
for (size_t i = 0; i < ARRAY_SIZE(device->trackers); ++i) {
m_relation_history_destroy(&device->trackers[i]);
}
@@ -826,11 +832,12 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *const tracking_origin,
return 0;
}
- if (out_xdevs_cap > 1 + MAX_GENERIC_TRACKERS) {
- out_xdevs_cap = 1 + MAX_GENERIC_TRACKERS;
+ struct solarxr_device *device;
+ if (out_xdevs_cap > 1 + ARRAY_SIZE(device->trackers)) {
+ out_xdevs_cap = 1 + ARRAY_SIZE(device->trackers);
}
- struct solarxr_device *const device = U_DEVICE_ALLOCATE(struct solarxr_device, U_DEVICE_ALLOC_NO_FLAGS, 2, 0);
+ device = U_DEVICE_ALLOCATE(struct solarxr_device, U_DEVICE_ALLOC_NO_FLAGS, 2, 0);
device->base.name = XRT_DEVICE_FB_BODY_TRACKING;
device->base.device_type = XRT_DEVICE_TYPE_BODY_TRACKER;
strncpy(device->base.str, "SolarXR IPC Connection", sizeof(device->base.str) - 1);
@@ -861,10 +868,11 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *const tracking_origin,
memset(device->tracker_ids, 0xff, sizeof(device->tracker_ids));
uint32_t trackers_len = 0;
- struct solarxr_generic_tracker *trackers[MAX_GENERIC_TRACKERS];
+ struct solarxr_generic_tracker *trackers[ARRAY_SIZE(device->trackers)];
// `solarxr_device_destroy()` asserts unless both have attempted initialization
- if (os_mutex_init(&device->mutex) != 0) {
+ if (((int)!feeder_init(&device->feeder, debug_get_log_option_solarxr_log()) | os_mutex_init(&device->mutex)) !=
+ 0) {
goto fail;
}
@@ -1150,54 +1158,71 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *const tracking_origin,
goto fail;
}
- uint32_t tracker_descs_len = 0;
- const solarxr_tracker_data_t *tracker_descs[ARRAY_SIZE(device->trackers)];
+ uint32_t tracker_datas_len = 0;
+ struct solarxr_tracker_data tracker_datas[ARRAY_SIZE(device->trackers)];
if (debug_get_bool_option_solarxr_raw_trackers()) {
- for (uint32_t i = 0; i < header.message.data_feed_update.devices.length; ++i) {
+ const flatbuffers_vector_solarxr_device_data_t devices =
+ header.message.data_feed_update.devices;
+ for (const solarxr_device_data_t *device = devices.data, *const devices_end =
+ &device[devices.length];
+ device < devices_end; ++device) {
struct solarxr_device_data device_data;
- if (!read_solarxr_device_data(&device_data, buffer.data, buffer.length,
- &header.message.data_feed_update.devices.data[i])) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(),
+ if (!read_solarxr_device_data(&device_data, buffer.data, buffer.length, device)) {
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(),
"read_solarxr_device_data() failed");
continue;
}
-
- uint32_t length = device_data.trackers.length;
- if (length >= ARRAY_SIZE(tracker_descs) - tracker_descs_len) {
- length = ARRAY_SIZE(tracker_descs) - tracker_descs_len;
- header.message.data_feed_update.devices.length = i; // early exit
- }
-
- for (uint32_t j = 0; j < length; ++j) {
- tracker_descs[tracker_descs_len++] = &device_data.trackers.data[j];
+ for (const solarxr_tracker_data_t *tracker = device_data.trackers.data,
+ *const end = &tracker[device_data.trackers.length];
+ tracker < end; ++tracker) {
+ if (tracker_datas_len >= ARRAY_SIZE(tracker_datas)) {
+ device = devices_end - 1; // break outer
+ break;
+ }
+ if (!read_solarxr_tracker_data(&tracker_datas[tracker_datas_len], buffer.data,
+ buffer.length, tracker)) {
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(),
+ "read_solarxr_tracker_data() failed");
+ continue;
+ }
+ ++tracker_datas_len;
}
}
} else {
- tracker_descs_len =
- MIN(header.message.data_feed_update.synthetic_trackers.length, ARRAY_SIZE(tracker_descs));
- for (uint32_t i = 0; i < tracker_descs_len; ++i) {
- tracker_descs[i] = &header.message.data_feed_update.synthetic_trackers.data[i];
+ const flatbuffers_vector_solarxr_tracker_data_t synthetic_trackers =
+ header.message.data_feed_update.synthetic_trackers;
+ for (const solarxr_tracker_data_t *tracker = synthetic_trackers.data,
+ *const end = &tracker[synthetic_trackers.length];
+ tracker < end; ++tracker) {
+ if (tracker_datas_len >= ARRAY_SIZE(tracker_datas)) {
+ break;
+ }
+ if (!read_solarxr_tracker_data(&tracker_datas[tracker_datas_len], buffer.data,
+ buffer.length, tracker)) {
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(),
+ "read_solarxr_tracker_data() failed");
+ continue;
+ }
+ if (tracker_datas[tracker_datas_len].tracker_id.has_device_id) {
+ continue; // filter out loopback feeder devices
+ }
+ ++tracker_datas_len;
}
}
U_LOG_IFL_I(debug_get_log_option_solarxr_log(), "Enumerated %" PRIu32 " SolarXR %s trackers",
- tracker_descs_len, debug_get_bool_option_solarxr_raw_trackers() ? "physical" : "synthetic");
+ tracker_datas_len, debug_get_bool_option_solarxr_raw_trackers() ? "physical" : "synthetic");
- if (tracker_descs_len > out_xdevs_cap - 1) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(),
+ if (tracker_datas_len > out_xdevs_cap - 1) {
+ U_LOG_IFL_E(debug_get_log_option_solarxr_log(),
"Not enough xdev slots! Omitting %" PRIu32 " trackers",
- tracker_descs_len - (out_xdevs_cap - 1));
- tracker_descs_len = out_xdevs_cap - 1;
+ tracker_datas_len - (out_xdevs_cap - 1));
+ tracker_datas_len = out_xdevs_cap - 1;
}
- for (uint32_t i = 0; i < tracker_descs_len; ++i) {
- struct solarxr_tracker_data data;
- if (!read_solarxr_tracker_data(&data, buffer.data, buffer.length, tracker_descs[i])) {
- U_LOG_IFL_W(debug_get_log_option_solarxr_log(), "read_solarxr_device_data() failed");
- continue;
- }
-
- const wchar_t id = solarxr_tracker_id_to_wchar(data.tracker_id);
+ for (const struct solarxr_tracker_data *data = tracker_datas, *const end = &data[tracker_datas_len];
+ data < end; ++data) {
+ const wchar_t id = solarxr_tracker_id_to_wchar(data->tracker_id);
struct solarxr_generic_tracker *const tracker =
U_DEVICE_ALLOCATE(struct solarxr_generic_tracker, U_DEVICE_ALLOC_NO_FLAGS, 1, 0);
@@ -1219,27 +1244,27 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *const tracking_origin,
tracker->base.inputs[0].name = XRT_INPUT_GENERIC_TRACKER_POSE;
tracker->role = SOLARXR_BODY_PART_NONE;
- device->tracker_ids[i] = id;
- m_relation_history_create(&device->trackers[i]);
+ assert(trackers_len < ARRAY_SIZE(trackers));
+ device->tracker_ids[trackers_len] = id;
+ m_relation_history_create(&device->trackers[trackers_len]);
tracker->parent = device;
- tracker->index = i;
- tracker->history = device->trackers[i];
- device->tracker_refs[i] = tracker;
+ tracker->index = trackers_len;
+ tracker->history = device->trackers[trackers_len];
+ device->tracker_refs[trackers_len] = tracker;
- assert(trackers_len < ARRAY_SIZE(trackers));
trackers[trackers_len++] = tracker;
- if (!data.has_info) {
+ if (!data->has_info) {
continue;
}
- if (data.info.body_part < ARRAY_SIZE(device->bones)) {
- tracker->role = data.info.body_part;
+ if (data->info.body_part < ARRAY_SIZE(device->bones)) {
+ tracker->role = data->info.body_part;
}
- if (data.info.display_name.length != 0) {
+ if (data->info.display_name.length != 0) {
snprintf(tracker->base.str, sizeof(tracker->base.str), "SolarXR Tracker \"%.*s\"",
- (unsigned)data.info.display_name.length, data.info.display_name.data);
+ (unsigned)data->info.display_name.length, data->info.display_name.data);
}
}
}
@@ -1264,3 +1289,31 @@ fail:
solarxr_device_destroy(&device->base);
return 0;
}
+
+bool
+solarxr_device_add_feeder_device(struct xrt_device *const device, struct xrt_device *const xdev)
+{
+ struct solarxr_device *const solarxr = solarxr_device(device);
+ if (solarxr == NULL || solarxr_device(xdev) != NULL || solarxr_generic_tracker(xdev) != NULL) {
+ return false;
+ }
+ return feeder_add_device(&solarxr->feeder, xdev);
+}
+
+void
+solarxr_device_remove_feeder_device(struct xrt_device *const device, struct xrt_device *const xdev)
+{
+ struct solarxr_device *const solarxr = solarxr_device(device);
+ if (solarxr != NULL) {
+ feeder_remove_device(&solarxr->feeder, xdev);
+ }
+}
+
+void
+solarxr_device_clear_feeder_devices(struct xrt_device *const device)
+{
+ struct solarxr_device *const solarxr = solarxr_device(device);
+ if (solarxr != NULL) {
+ feeder_clear_devices(&solarxr->feeder);
+ }
+}
diff --git a/src/xrt/drivers/solarxr/solarxr_interface.h b/src/xrt/drivers/solarxr/solarxr_interface.h
index c56bb15b1..209345f79 100644
--- a/src/xrt/drivers/solarxr/solarxr_interface.h
+++ b/src/xrt/drivers/solarxr/solarxr_interface.h
@@ -23,6 +23,15 @@ solarxr_device_create_xdevs(struct xrt_tracking_origin *tracking_origin,
struct xrt_device *out_xdevs[],
uint32_t out_xdevs_cap);
+bool
+solarxr_device_add_feeder_device(struct xrt_device *solarxr, struct xrt_device *xdev);
+
+void
+solarxr_device_remove_feeder_device(struct xrt_device *solarxr, struct xrt_device *xdev);
+
+void
+solarxr_device_clear_feeder_devices(struct xrt_device *solarxr);
+
static inline struct xrt_device *
solarxr_device_create(struct xrt_tracking_origin *const tracking_origin)
{
@@ -31,6 +40,17 @@ solarxr_device_create(struct xrt_tracking_origin *const tracking_origin)
return out;
}
+static inline void
+solarxr_device_set_feeder_devices(struct xrt_device *const solarxr,
+ struct xrt_device *const xdevs[],
+ const uint32_t xdev_count)
+{
+ solarxr_device_clear_feeder_devices(solarxr);
+ for (uint32_t i = 0; i < xdev_count; ++i) {
+ solarxr_device_add_feeder_device(solarxr, xdevs[i]);
+ }
+}
+
#ifdef __cplusplus
}
--
2.53.0
+11
View File
@@ -61,6 +61,7 @@ struct pipewire_device : public audio_device
std::atomic<size_t> mic_buffer_size_bytes;
audio_data mic_current;
std::unique_ptr<pw_stream, deleter> microphone;
std::atomic<std::underlying_type_t<pw_stream_state>> mic_state{PW_STREAM_STATE_UNCONNECTED};
pw_stream_events mic_events{
.version = PW_VERSION_STREAM_EVENTS,
.state_changed = &pipewire_device::mic_state_changed,
@@ -78,6 +79,7 @@ struct pipewire_device : public audio_device
static void mic_state_changed(void * self_v, pw_stream_state old, pw_stream_state state, const char * error);
void process_mic_data(wivrn::audio_data &&) override;
void on_connect() override;
~pipewire_device()
{
@@ -342,6 +344,11 @@ void pipewire_device::mic_process(void * self_v)
void pipewire_device::mic_state_changed(void * self_v, pw_stream_state old, pw_stream_state state, const char * error)
{
auto self = (pipewire_device *)self_v;
self->mic_state = state;
if (error)
U_LOG_I("Microphone state changed from %s to %s (error: %s)", magic_enum::enum_name(old).data(), magic_enum::enum_name(state).data(), error);
else
U_LOG_I("Microphone state changed from %s to %s", magic_enum::enum_name(old).data(), magic_enum::enum_name(state).data());
switch (state)
{
case PW_STREAM_STATE_ERROR:
@@ -408,6 +415,10 @@ void pipewire_device::process_mic_data(wivrn::audio_data && sample)
if (mic_samples.write(std::move(sample)))
mic_buffer_size_bytes += size;
}
void pipewire_device::on_connect()
{
session.send_control(to_headset::feature_control{to_headset::feature_control::microphone, mic_state == PW_STREAM_STATE_STREAMING});
}
std::unique_ptr<audio_device> create_pipewire_handle(
const std::string & source_name,
+5
View File
@@ -404,6 +404,11 @@ struct pulse_device : public audio_device
mic_buffer.push(std::move(mic_data));
}
void on_connect() override
{
session.send_control(to_headset::feature_control{to_headset::feature_control::microphone, true});
}
pulse_device(
const std::string & source_name,
const std::string & source_description,
+1
View File
@@ -36,6 +36,7 @@ struct audio_device
virtual wivrn::to_headset::audio_stream_description description() const = 0;
virtual void process_mic_data(wivrn::audio_data &&) = 0;
virtual void on_connect() = 0;
static std::unique_ptr<audio_device> create(
const std::string & source_name,
+13
View File
@@ -31,6 +31,7 @@
#include <Eigen/Core>
#include <Eigen/QR>
#include <algorithm>
#include <cassert>
#include <limits>
#include <optional>
#include <ranges>
@@ -175,6 +176,10 @@ public:
if (not closest->y)
return *closest;
// Avoid returning obviously wrong data
if (std::abs(closest->timestamp - timestamp) > 1'000'000'000)
return {};
// Not enough data to extrapolate
if (row < 2)
{
@@ -194,6 +199,14 @@ public:
else
sol = (Aprime.transpose() * Aprime).ldlt().solve(Aprime.transpose() * bprime).transpose();
#ifndef NDEBUG
if constexpr (quaternion)
{
float norm = sol.template block<N, 1>(0, 0).norm();
assert(norm > 0.9);
}
#endif
return sample{
.production_timestamp = production_timestamp,
.timestamp = timestamp,
+12 -7
View File
@@ -107,7 +107,7 @@ std::pair<XrTime, XrTime> pose_list::get_bounds() const
void pose_list::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset)
{
if (source)
if (source or not offset)
return;
for (const auto & pose: tracking.device_poses)
@@ -260,13 +260,18 @@ std::pair<XrTime, xrt_space_relation> pose_list::get_at(XrTime at_timestamp_ns)
if (orientation.y)
{
flags(XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT);
if (auto norm2 = orientation.y->squaredNorm(); norm2 > 0.1)
{
flags(XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT);
ret.pose.orientation = {
.x = (*orientation.y)[1],
.y = (*orientation.y)[2],
.z = (*orientation.y)[3],
.w = (*orientation.y)[0]};
orientation.y->normalize();
ret.pose.orientation = {
.x = (*orientation.y)[1],
.y = (*orientation.y)[2],
.z = (*orientation.y)[3],
.w = (*orientation.y)[0]};
}
if (orientation.dy)
{
+1 -1
View File
@@ -40,7 +40,7 @@ class view_list
{
pose_list head_poses{device_id::HEAD};
std::mutex mutex;
XrViewStateFlags flags;
XrViewStateFlags flags{};
std::array<xrt_pose, 2> poses;
std::array<xrt_fov, 2> fovs;
+5 -41
View File
@@ -27,7 +27,6 @@
#include "xrt/xrt_defines.h"
#include <array>
#include <charconv>
#include <cmath>
#include <map>
#include <ranges>
@@ -218,44 +217,6 @@ static void fill_param_2d(
out.resize(count * 2 - 1);
}
static float get_angle_offset()
{
if (const char * cvar = std::getenv("WIVRN_FOVEATION_OFFSET"))
{
std::string_view var(cvar);
float res;
auto e = std::from_chars(var.begin(), var.end(), res);
if (e.ec == std::errc())
{
// No clamping, we don’t know the range
// of actual values for all headsets for sure.
return -res * M_PI / 180;
}
else
U_LOG_W("Malformed WIVRN_FOVEATION_OFFSET, must be a number (angle in °)");
}
// normal sight line is between 10° and 15° below horizontal
// https://apps.dtic.mil/sti/tr/pdf/AD0758339.pdf pages 393-394
// testing shows 10° looks better
return 10 * M_PI / 180;
}
static float get_convergence_distance()
{
if (const char * cvar = std::getenv("WIVRN_FOVEATION_DISTANCE"))
{
std::string_view var(cvar);
float res;
auto e = std::from_chars(var.begin(), var.end(), res);
if (e.ec == std::errc())
return std::max(res, 0.05f);
else
U_LOG_W("Malformed WIVRN_FOVEATION_DISTANCE, must be a number (distance in meters)");
}
// 1m by default
return 1;
}
namespace wivrn
{
@@ -303,8 +264,11 @@ void wivrn_foveation::compute_params(
wivrn_foveation::wivrn_foveation(wivrn_vk_bundle & bundle, const xrt_hmd_parts & hmd) :
foveated_width(hmd.screens[0].w_pixels),
foveated_height(hmd.screens[0].h_pixels),
angle_offset(get_angle_offset()),
convergence_distance(get_convergence_distance()),
// normal sight line is between 10° and 15° below horizontal
// https://apps.dtic.mil/sti/tr/pdf/AD0758339.pdf pages 393-394
// testing shows 10° looks better
angle_offset(10 * M_PI / 180),
convergence_distance(1 /* meter*/),
command_pool(bundle.device, vk::CommandPoolCreateInfo{.queueFamilyIndex = bundle.queue_family_index}),
cmd(std::move(bundle.device.allocateCommandBuffers({
.commandPool = *command_pool,
+3
View File
@@ -18,6 +18,7 @@
*/
#include "wivrn_hmd.h"
#include "math/m_api.h"
#include "os/os_time.h"
#include "wivrn_config.h"
#include "wivrn_session.h"
@@ -188,6 +189,8 @@ xrt_result_t wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
view.relation.relation_flags = (xrt_space_relation_flags)flags;
*out_head_relation = view.relation;
assert((out_head_relation->relation_flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) == 0 or math_quat_ensure_normalized(&out_head_relation->pose.orientation));
assert(view_count == 2);
for (size_t eye = 0; eye < 2; ++eye)
{
+19 -38
View File
@@ -146,7 +146,10 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
get_info(),
*this);
if (audio_handle)
{
send_control(audio_handle->description());
audio_handle->on_connect();
}
}
catch (const std::exception & e)
{
@@ -225,33 +228,18 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> 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
eye_tracker = std::make_unique<wivrn_eye_tracker>(*this);
static_roles.eyes = eye_tracker.get();
xdevs[xdev_count++] = eye_tracker.get();
xdevs[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"))
{
android_face_tracker = std::make_unique<wivrn_android_face_tracker>(&hmd, *this);
static_roles.face = android_face_tracker.get();
xdevs[xdev_count++] = android_face_tracker.get();
}
if (face == from_headset::face_type::fb2 || is_forced_extension("FB_face_tracking2"))
{
fb_face2_tracker = std::make_unique<wivrn_fb_face2_tracker>(&hmd, *this);
static_roles.face = fb_face2_tracker.get();
xdevs[xdev_count++] = fb_face2_tracker.get();
}
if (face == wivrn::from_headset::face_type::htc || is_forced_extension("HTC_facial_tracking"))
{
htc_face_tracker = std::make_unique<wivrn_htc_face_tracker>(&hmd, *this);
static_roles.face = htc_face_tracker.get();
xdevs[xdev_count++] = htc_face_tracker.get();
}
xdevs[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);
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);
auto num_generic_trackers = get_info().num_generic_trackers;
generic_trackers.reserve(num_generic_trackers);
if (num_generic_trackers > 0)
{
if (num_generic_trackers > from_headset::body_tracking::max_tracked_poses)
@@ -271,11 +259,7 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
U_LOG_I("Creating %d generic trackers", num_generic_trackers);
for (int i = 0; i < num_generic_trackers; ++i)
{
auto dev = std::make_unique<wivrn_generic_tracker>(i, &hmd, *this);
xdevs[xdev_count++] = dev.get();
generic_trackers.push_back(std::move(dev));
}
xdevs[xdev_count++] = &generic_trackers.emplace_back(i, &hmd, *this);
}
#if WIVRN_FEATURE_SOLARXR
@@ -365,7 +349,7 @@ xrt_result_t wivrn::wivrn_session::create_session(std::unique_ptr<wivrn_connecti
u_builder_create_space_overseer_legacy(
&self->xrt_system.broadcast,
&self->hmd,
self->eye_tracker.get(),
self->static_roles.eyes,
&self->left_controller,
&self->right_controller,
nullptr,
@@ -382,13 +366,14 @@ xrt_result_t wivrn::wivrn_session::create_session(std::unique_ptr<wivrn_connecti
auto res = xrt_space_overseer_create_pose_space(self->space_overseer, &self->hmd, XRT_INPUT_GENERIC_HEAD_POSE, &head_space);
if (res == XRT_SUCCESS)
{
res = xrt_space_overseer_attach_device(self->space_overseer, self->eye_tracker.get(), head_space);
res = xrt_space_overseer_attach_device(self->space_overseer, self->static_roles.eyes, head_space);
xrt_space_reference(&head_space, NULL);
}
if (res != XRT_SUCCESS)
{
U_LOG_W("failed to initialize eye tracker: %s", xrt_result_to_string(res).c_str());
self->eye_tracker = nullptr;
self->static_roles.eyes = nullptr;
self->eye_tracker.reset();
}
}
@@ -631,10 +616,7 @@ void wivrn_session::operator()(from_headset::override_foveation_center && foveat
void wivrn_session::operator()(from_headset::derived_pose && derived)
{
left_controller.set_derived_pose(derived);
left_hand_interaction.set_derived_pose(derived);
right_controller.set_derived_pose(derived);
right_hand_interaction.set_derived_pose(derived);
}
void wivrn_session::operator()(from_headset::hand_tracking && hand_tracking)
@@ -648,12 +630,8 @@ void wivrn_session::operator()(from_headset::body_tracking && body_tracking)
{
auto offset = offset_est.get_offset();
assert(generic_trackers.size() <= from_headset::body_tracking::max_tracked_poses);
for (int i = 0; i < generic_trackers.size(); i++)
{
auto pose = body_tracking.poses ? (*body_tracking.poses)[i] : from_headset::body_tracking::pose{};
generic_trackers[i]->update_tracking(body_tracking, pose, offset);
}
for (auto [tracker, pose]: std::ranges::zip_view(generic_trackers, *body_tracking.poses))
tracker.update_tracking(body_tracking, pose, offset);
}
void wivrn_session::operator()(from_headset::inputs && inputs)
{
@@ -1128,7 +1106,10 @@ void wivrn_session::reconnect(std::stop_token stop)
comp_target->reset_encoders();
}
if (audio_handle)
{
send_control(audio_handle->description());
audio_handle->on_connect();
}
event.state.visible = true;
event.state.focused = true;
+13 -6
View File
@@ -19,13 +19,19 @@
#pragma once
#include "app_pacer.h"
#include "clock_offset.h"
#include "driver/app_pacer.h"
#include "inplace_vector.hpp"
#include "tracking_control.h"
#include "utils/thread_safe.h"
#include "wivrn_android_face_tracker.h"
#include "wivrn_connection.h"
#include "wivrn_controller.h"
#include "wivrn_eye_tracker.h"
#include "wivrn_fb_face2_tracker.h"
#include "wivrn_generic_tracker.h"
#include "wivrn_hmd.h"
#include "wivrn_htc_face_tracker.h"
#include "wivrn_ipc.h"
#include "wivrn_packets.h"
#include "wivrn_uinput.h"
@@ -35,6 +41,7 @@
#include <map>
#include <memory>
#include <mutex>
#include <optional>
#include <shared_mutex>
#include <thread>
@@ -85,11 +92,11 @@ class wivrn_session : public xrt_system_devices
int32_t left_hand_interaction_index;
wivrn_controller right_hand_interaction;
int32_t right_hand_interaction_index;
std::unique_ptr<wivrn_eye_tracker> eye_tracker;
std::unique_ptr<wivrn_android_face_tracker> android_face_tracker;
std::unique_ptr<wivrn_fb_face2_tracker> fb_face2_tracker;
std::unique_ptr<wivrn_htc_face_tracker> htc_face_tracker;
std::vector<std::unique_ptr<wivrn_generic_tracker>> generic_trackers;
std::optional<wivrn_eye_tracker> eye_tracker;
std::optional<wivrn_android_face_tracker> android_face_tracker;
std::optional<wivrn_fb_face2_tracker> fb_face2_tracker;
std::optional<wivrn_htc_face_tracker> htc_face_tracker;
beman::inplace_vector::inplace_vector<wivrn_generic_tracker, from_headset::body_tracking::max_tracked_poses> generic_trackers;
std::optional<wivrn_uinput> uinput_handler;
std::shared_mutex comp_target_mutex;
+109 -73
View File
@@ -21,6 +21,7 @@
#include "encoder/encoder_settings.h"
#include "util/u_logging.h"
#include "utils/scoped_lock.h"
#include "utils/wivrn_vk_bundle.h"
#include <iostream>
#include <stdexcept>
@@ -292,10 +293,12 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
output_buffer_size = align(output_buffer_size, video_caps.minBitstreamBufferSizeAlignment);
item.output_buffer = buffer_allocation(
vk.device,
{.pNext = &video_profile_list,
.size = output_buffer_size,
.usage = vk::BufferUsageFlagBits::eVideoEncodeDstKHR | vk::BufferUsageFlagBits::eTransferSrc,
.sharingMode = vk::SharingMode::eExclusive},
{
.pNext = &video_profile_list,
.size = output_buffer_size,
.usage = vk::BufferUsageFlagBits::eVideoEncodeDstKHR | vk::BufferUsageFlagBits::eTransferSrc,
.sharingMode = vk::SharingMode::eExclusive,
},
{
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
@@ -304,14 +307,17 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
if (not(item.output_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
{
U_LOG_D("Using staging buffer for vulkan encode output");
item.host_buffer = buffer_allocation(
vk.device,
{.size = output_buffer_size,
.usage = vk::BufferUsageFlagBits::eTransferDst,
.sharingMode = vk::SharingMode::eExclusive},
{
.size = output_buffer_size,
.usage = vk::BufferUsageFlagBits::eTransferDst,
.sharingMode = vk::SharingMode::eExclusive,
},
{
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
.usage = VMA_MEMORY_USAGE_AUTO,
.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST,
},
"vulkan encode host buffer");
}
@@ -477,7 +483,6 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
vk::QueryPoolVideoEncodeFeedbackCreateInfoKHR{
.pNext = &video_profile,
.encodeFeedbackFlags =
vk::VideoEncodeFeedbackFlagBitsKHR::eBitstreamBufferOffset |
vk::VideoEncodeFeedbackFlagBitsKHR::eBitstreamBytesWritten,
},
};
@@ -554,18 +559,58 @@ std::optional<wivrn::video_encoder::data> wivrn::video_encoder_vulkan::encode(ui
throw std::runtime_error("wait for fences: " + vk::to_string(res));
}
// Feedback = offset / size / has overrides
auto [res, feedback] = query_pool.getResults<uint32_t>(encode_slot, 1, 3 * sizeof(uint32_t), 0, vk::QueryResultFlagBits::eWait);
auto [res, size] = query_pool.getResult<uint32_t>(encode_slot, 1, 0, vk::QueryResultFlagBits::eWait);
if (res != vk::Result::eSuccess)
{
std::cerr << "device.getQueryPoolResults: " << vk::to_string(res) << std::endl;
}
// We don't copy the whole buffer, but an estimate of how much we'll need
// If that wasn't enough, we have to issue a second copy command for the rest
if (slot_item.host_buffer and size > slot_item.copy_size)
{
U_LOG_D("additional copy needed: %ld", size - slot_item.copy_size);
const bool main_queue = *slot_item.transfer_cmd_buf;
// The encoded image is larger than expected, we need to copy some more data
vk::raii::CommandBuffer & cmd_buf = main_queue ? slot_item.transfer_cmd_buf : slot_item.video_cmd_buf;
cmd_buf.reset();
cmd_buf.begin({.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit});
cmd_buf.copyBuffer(
slot_item.output_buffer,
slot_item.host_buffer,
vk::BufferCopy{
.srcOffset = slot_item.copy_size,
.dstOffset = slot_item.copy_size,
.size = size - slot_item.copy_size,
});
cmd_buf.end();
vk.device.resetFences(*slot_item.fence);
{
wivrn::scoped_lock lock(main_queue ? vk.vk.main_queue->mutex : vk.vk.encode_queue->mutex);
auto & queue = main_queue ? vk.queue : vk.encode_queue;
queue.submit(vk::SubmitInfo{
.commandBufferCount = 1,
.pCommandBuffers = &*cmd_buf,
},
*slot_item.fence);
}
if (auto res = vk.device.waitForFences(*slot_item.fence, true, 1'000'000'000);
res != vk::Result::eSuccess)
{
throw std::runtime_error("wait for fences: " + vk::to_string(res));
}
}
void * mapped = slot_item.host_buffer ? slot_item.host_buffer.map() : slot_item.output_buffer.map();
return data{
.encoder = this,
.span = std::span(((uint8_t *)mapped) + feedback[0], feedback[1]),
.span = std::span(((uint8_t *)mapped), size),
.prefer_control = slot_item.idr,
};
}
@@ -815,6 +860,11 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
.flags = vk::VideoCodingControlFlagBitsKHR::eEncodeRateControl,
});
if (rate_control)
slot_item.copy_size = (rate_control_layer.maxBitrate * rate_control_layer.frameRateDenominator) / rate_control_layer.frameRateNumerator;
else
slot_item.copy_size = slot_item.output_buffer.info().size;
vk::VideoEncodeInfoKHR encode_info{
.pNext = encode_info_next(dpb.frame_num, slot_index, ref_slot ? std::make_optional(ref_slot->info.slotIndex) : std::nullopt),
.dstBuffer = slot_item.output_buffer,
@@ -840,66 +890,48 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
// When output buffer is not visible, we have to issue a transfer operation
if (slot_item.host_buffer)
{
// encode queue may not allow transfer commands
vk::BufferMemoryBarrier2 barrier{
.srcStageMask = vk::PipelineStageFlagBits2::eAllCommands,
.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite,
.dstStageMask = vk::PipelineStageFlagBits2::eAllCommands,
.dstAccessMask = vk::AccessFlagBits2::eMemoryRead,
.srcQueueFamilyIndex = vk.encode_queue_family_index,
.dstQueueFamilyIndex = vk.encode_queue_family_index,
.buffer = slot_item.output_buffer,
.size = vk::WholeSize,
};
vk::raii::CommandBuffer * transfer_cmd_buf;
if (*slot_item.transfer_cmd_buf)
{
vk::BufferMemoryBarrier2 barrier{
.srcStageMask = vk::PipelineStageFlagBits2::eAllCommands,
.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite,
.dstStageMask = vk::PipelineStageFlagBits2::eAllCommands,
.dstAccessMask = vk::AccessFlagBits2::eMemoryRead,
.srcQueueFamilyIndex = vk.encode_queue_family_index,
.dstQueueFamilyIndex = vk.queue_family_index,
.buffer = slot_item.output_buffer,
.size = vk::WholeSize,
};
video_cmd_buf.pipelineBarrier2({
// We need to transfer the buffer on the main queue
barrier.dstQueueFamilyIndex = vk.queue_family_index;
transfer_cmd_buf = &slot_item.transfer_cmd_buf;
transfer_cmd_buf->reset();
transfer_cmd_buf->begin({.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit});
transfer_cmd_buf->pipelineBarrier2({
.bufferMemoryBarrierCount = 1,
.pBufferMemoryBarriers = &barrier,
});
auto & cmd_buf = slot_item.transfer_cmd_buf;
cmd_buf.reset();
cmd_buf.begin({.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit});
cmd_buf.pipelineBarrier2({
.bufferMemoryBarrierCount = 1,
.pBufferMemoryBarriers = &barrier,
});
cmd_buf.copyBuffer(
slot_item.output_buffer,
slot_item.host_buffer,
vk::BufferCopy{
.size = slot_item.output_buffer.info().size,
});
cmd_buf.end();
}
else
{
vk::BufferMemoryBarrier2 barrier{
.srcStageMask = vk::PipelineStageFlagBits2::eAllCommands,
.srcAccessMask = vk::AccessFlagBits2::eMemoryWrite,
.dstStageMask = vk::PipelineStageFlagBits2::eAllCommands,
.dstAccessMask = vk::AccessFlagBits2::eMemoryRead,
.srcQueueFamilyIndex = vk.encode_queue_family_index,
.dstQueueFamilyIndex = vk.encode_queue_family_index,
.buffer = slot_item.output_buffer,
.size = vk::WholeSize,
};
video_cmd_buf.pipelineBarrier2({
.bufferMemoryBarrierCount = 1,
.pBufferMemoryBarriers = &barrier,
});
transfer_cmd_buf = &video_cmd_buf;
video_cmd_buf.copyBuffer(
slot_item.output_buffer,
slot_item.host_buffer,
vk::BufferCopy{
.size = slot_item.output_buffer.info().size,
});
}
video_cmd_buf.pipelineBarrier2({
.bufferMemoryBarrierCount = 1,
.pBufferMemoryBarriers = &barrier,
});
transfer_cmd_buf->copyBuffer(
slot_item.output_buffer,
slot_item.host_buffer,
vk::BufferCopy{
.size = slot_item.copy_size,
});
if (*slot_item.transfer_cmd_buf)
transfer_cmd_buf->end();
}
video_cmd_buf.end();
@@ -928,17 +960,21 @@ void wivrn::video_encoder_vulkan::post_submit(uint8_t slot)
.commandBuffer = slot_item.video_cmd_buf,
};
vk.encode_queue.submit2(vk::SubmitInfo2{
.waitSemaphoreInfoCount = 1,
.pWaitSemaphoreInfos = &wait_sem_info,
.commandBufferInfoCount = 1,
.pCommandBufferInfos = &cmd_info,
.signalSemaphoreInfoCount = need_transfer ? 1u : 0,
.pSignalSemaphoreInfos = &sem_info,
},
need_transfer ? nullptr : *slot_item.fence);
{
scoped_lock lock(vk.vk.encode_queue->mutex);
vk.encode_queue.submit2(vk::SubmitInfo2{
.waitSemaphoreInfoCount = 1,
.pWaitSemaphoreInfos = &wait_sem_info,
.commandBufferInfoCount = 1,
.pCommandBufferInfos = &cmd_info,
.signalSemaphoreInfoCount = need_transfer ? 1u : 0,
.pSignalSemaphoreInfos = &sem_info,
},
need_transfer ? nullptr : *slot_item.fence);
}
if (need_transfer)
{
// caller already holds the lock
vk::CommandBufferSubmitInfo cmd_info{
.commandBuffer = slot_item.transfer_cmd_buf,
};
+1
View File
@@ -53,6 +53,7 @@ class video_encoder_vulkan : public video_encoder
vk::raii::ImageView view = nullptr;
buffer_allocation output_buffer;
buffer_allocation host_buffer;
vk::DeviceSize copy_size;
bool idr = false;
};
std::array<slot_item, num_slots> slot_data;
+4
View File
@@ -243,6 +243,10 @@ void start_server(configuration config)
setenv("AMD_DEBUG", "lowlatencyenc", false);
// https://github.com/WiVRn/WiVRn/issues/695
// something is broken with Intel CCS under vaapi
setenv("INTEL_DEBUG", "noccs", false);
wivrn::ipc_server_cb server_cb;
ipc_server_main_info server_info{