From 9690633030fd7b23f37e17008f4bff3d4169a3b5 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 5 Mar 2026 09:27:48 +0100 Subject: [PATCH 1/2] reset defoveator on decoder change --- client/scenes/stream.cpp | 3 +++ client/scenes/stream_defoveator.cpp | 8 ++++++++ client/scenes/stream_defoveator.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 83fe33cf..cb4f3e5c 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -1147,6 +1147,9 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript .decoder = std::make_unique(device, physical_device, instance, queue_family_index, description, shared_from_this(), stream_index), }; } + + if (defoveator) + defoveator->reset_pipelines(); } void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint32_t swapchain_height) diff --git a/client/scenes/stream_defoveator.cpp b/client/scenes/stream_defoveator.cpp index 24467b31..cfff322c 100644 --- a/client/scenes/stream_defoveator.cpp +++ b/client/scenes/stream_defoveator.cpp @@ -283,6 +283,14 @@ stream_defoveator::stream_defoveator( } } +void stream_defoveator::reset_pipelines() +{ + for (auto & p: pipeline_rgb) + p = {}; + for (auto & p: pipeline_a) + p = {}; +} + static size_t required_vertices(const wivrn::to_headset::foveation_parameter & p) { // strips are constructed like this: diff --git a/client/scenes/stream_defoveator.h b/client/scenes/stream_defoveator.h index 5a19510f..dbb9893b 100644 --- a/client/scenes/stream_defoveator.h +++ b/client/scenes/stream_defoveator.h @@ -81,6 +81,8 @@ public: stream_defoveator(const stream_defoveator &) = delete; + void reset_pipelines(); + void defoveate( vk::raii::CommandBuffer & command_buffer, const std::array & foveation, From 02d06562a67d9bc8f3a7ab7710d306f0ea594437 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 5 Mar 2026 10:43:20 +0100 Subject: [PATCH 2/2] Don't reset decoders if there's no change --- client/scenes/stream.cpp | 4 +++- common/wivrn_packets.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index cb4f3e5c..543d785a 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -1137,8 +1137,10 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript { session.set_refresh_rate(description.fps); - spdlog::info("Creating decoders, size {}x{}", description.width, description.height); std::unique_lock lock(decoder_mutex); + if (video_stream_description == description) + return; + spdlog::info("Creating decoders, size {}x{}", description.width, description.height); video_stream_description = description; for (const auto & [stream_index, item]: utils::enumerate(decoders)) diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index 1a814e31..14c6c918 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -659,6 +659,8 @@ struct video_stream_description uint16_t height; std::array codec; // left, right, alpha float fps; + + bool operator==(const video_stream_description &) const = default; }; class video_stream_data_shard