Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Vindicus999
2026-02-12 02:36:36 +00:00
13 changed files with 19573 additions and 19573 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ public:
std::string environment_model = "assets://ground.glb"; std::string environment_model = "assets://ground.glb";
bool override_foveation_enable = false; 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; float override_foveation_distance = 3;
bool high_power_mode; bool high_power_mode;
+1 -1
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) if (next_scene->apps.draw_gui(*imgui_ctx, _("Disconnect")) == app_launcher::Cancel)
{ {
next_scene.reset(); next_scene->exit();
current_tab = tab::server_list; current_tab = tab::server_list;
} }
} }
+1 -1
View File
@@ -769,7 +769,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
last_display_time = frame_state.predictedDisplayTime; last_display_time = frame_state.predictedDisplayTime;
std::shared_lock lock(decoder_mutex); 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 // TODO: stop/restart video stream
session.begin_frame(); session.begin_frame();
+1 -1
View File
@@ -218,6 +218,7 @@ public:
return state_; return state_;
} }
void exit();
bool alive() const bool alive() const
{ {
return !exiting; return !exiting;
@@ -236,7 +237,6 @@ private:
void setup(const to_headset::video_stream_description &); void setup(const to_headset::video_stream_description &);
void setup_reprojection_swapchain(uint32_t width, uint32_t height); void setup_reprojection_swapchain(uint32_t width, uint32_t height);
void exit();
vk::raii::QueryPool query_pool = nullptr; vk::raii::QueryPool query_pool = nullptr;
bool query_pool_filled = false; bool query_pool_filled = false;
+1 -1
View File
@@ -827,7 +827,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
case gui_status::bitrate_settings: case gui_status::bitrate_settings:
case gui_status::foveation_settings: case gui_status::foveation_settings:
imgui_ctx->layers()[0].orientation = head_position->second; 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; break;
case gui_status::hidden: case gui_status::hidden:
+1 -1
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), .flags = cast_flags(location.locationFlags, velocity.velocityFlags),
}; };
spdlog::warn("xrLocateSpace failed for {}: {}", magic_enum::enum_name(device), xr::to_string(res)); spdlog::warn("xrLocateSpace failed for {}: {}", magic_enum::enum_name(device), xr::to_string(res));
return {}; return {.device = device};
} }
class locate_spaces_functor class locate_spaces_functor
+2398 -2426
View File
File diff suppressed because it is too large Load Diff
+11
View File
@@ -61,6 +61,7 @@ struct pipewire_device : public audio_device
std::atomic<size_t> mic_buffer_size_bytes; std::atomic<size_t> mic_buffer_size_bytes;
audio_data mic_current; audio_data mic_current;
std::unique_ptr<pw_stream, deleter> microphone; 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{ pw_stream_events mic_events{
.version = PW_VERSION_STREAM_EVENTS, .version = PW_VERSION_STREAM_EVENTS,
.state_changed = &pipewire_device::mic_state_changed, .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); 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 process_mic_data(wivrn::audio_data &&) override;
void on_connect() override;
~pipewire_device() ~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) 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; 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) switch (state)
{ {
case PW_STREAM_STATE_ERROR: 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))) if (mic_samples.write(std::move(sample)))
mic_buffer_size_bytes += size; 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( std::unique_ptr<audio_device> create_pipewire_handle(
const std::string & source_name, 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)); 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( pulse_device(
const std::string & source_name, const std::string & source_name,
const std::string & source_description, 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 wivrn::to_headset::audio_stream_description description() const = 0;
virtual void process_mic_data(wivrn::audio_data &&) = 0; virtual void process_mic_data(wivrn::audio_data &&) = 0;
virtual void on_connect() = 0;
static std::unique_ptr<audio_device> create( static std::unique_ptr<audio_device> create(
const std::string & source_name, const std::string & source_name,
+1 -1
View File
@@ -40,7 +40,7 @@ class view_list
{ {
pose_list head_poses{device_id::HEAD}; pose_list head_poses{device_id::HEAD};
std::mutex mutex; std::mutex mutex;
XrViewStateFlags flags; XrViewStateFlags flags{};
std::array<xrt_pose, 2> poses; std::array<xrt_pose, 2> poses;
std::array<xrt_fov, 2> fovs; std::array<xrt_fov, 2> fovs;
+6
View File
@@ -146,7 +146,10 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
get_info(), get_info(),
*this); *this);
if (audio_handle) if (audio_handle)
{
send_control(audio_handle->description()); send_control(audio_handle->description());
audio_handle->on_connect();
}
} }
catch (const std::exception & e) catch (const std::exception & e)
{ {
@@ -1128,7 +1131,10 @@ void wivrn_session::reconnect(std::stop_token stop)
comp_target->reset_encoders(); comp_target->reset_encoders();
} }
if (audio_handle) if (audio_handle)
{
send_control(audio_handle->description()); send_control(audio_handle->description());
audio_handle->on_connect();
}
event.state.visible = true; event.state.visible = true;
event.state.focused = true; event.state.focused = true;
+13 -8
View File
@@ -292,10 +292,12 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
output_buffer_size = align(output_buffer_size, video_caps.minBitstreamBufferSizeAlignment); output_buffer_size = align(output_buffer_size, video_caps.minBitstreamBufferSizeAlignment);
item.output_buffer = buffer_allocation( item.output_buffer = buffer_allocation(
vk.device, vk.device,
{.pNext = &video_profile_list, {
.size = output_buffer_size, .pNext = &video_profile_list,
.usage = vk::BufferUsageFlagBits::eVideoEncodeDstKHR | vk::BufferUsageFlagBits::eTransferSrc, .size = output_buffer_size,
.sharingMode = vk::SharingMode::eExclusive}, .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, .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT,
.usage = VMA_MEMORY_USAGE_AUTO, .usage = VMA_MEMORY_USAGE_AUTO,
@@ -304,14 +306,17 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
if (not(item.output_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) 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( item.host_buffer = buffer_allocation(
vk.device, vk.device,
{.size = output_buffer_size, {
.usage = vk::BufferUsageFlagBits::eTransferDst, .size = output_buffer_size,
.sharingMode = vk::SharingMode::eExclusive}, .usage = vk::BufferUsageFlagBits::eTransferDst,
.sharingMode = vk::SharingMode::eExclusive,
},
{ {
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT, .flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
.usage = VMA_MEMORY_USAGE_AUTO, .usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST,
}, },
"vulkan encode host buffer"); "vulkan encode host buffer");
} }