diff --git a/client/scenes/blitter.cpp b/client/scenes/blitter.cpp index 71cfd931..bab9d0df 100644 --- a/client/scenes/blitter.cpp +++ b/client/scenes/blitter.cpp @@ -24,7 +24,6 @@ #include "vk/shader.h" #include "vk/specialization_constants.h" #include -#include #include namespace wivrn @@ -198,7 +197,7 @@ void blitter::begin(vk::raii::CommandBuffer & cmd) vk::SubpassContents::eInline); } -void blitter::push_image(vk::raii::CommandBuffer & cmd, uint8_t stream, vk::Sampler sampler, const vk::Extent2D & extent_, vk::ImageView image, vk::ImageLayout layout) +bool blitter::push_image(vk::raii::CommandBuffer & cmd, uint8_t stream, vk::Sampler sampler, const vk::Extent2D & extent_, vk::ImageView image, vk::ImageLayout layout) { if (stream == passthrough_rgb) { @@ -209,7 +208,7 @@ void blitter::push_image(vk::raii::CommandBuffer & cmd, uint8_t stream, vk::Samp extent_.width * desc.items[stream].subsampling, extent_.height * desc.items[stream].subsampling, }; - return; + return true; } if (stream == passthrough_a) { @@ -220,15 +219,15 @@ void blitter::push_image(vk::raii::CommandBuffer & cmd, uint8_t stream, vk::Samp extent_.width * desc.items[stream].subsampling, extent_.height * desc.items[stream].subsampling, }; - return; + return false; } if (pipelines.empty()) - return; + return false; assert(stream < pipelines.size()); auto & p = pipelines[stream]; if (not p.used) - return; + return false; const auto & extent = target.info().extent; const auto & description = desc.items[stream]; @@ -352,6 +351,7 @@ void blitter::push_image(vk::raii::CommandBuffer & cmd, uint8_t stream, vk::Samp .extent = {.width = uint32_t(x1 - x0), .height = uint32_t(y1 - y0)}, }); cmd.draw(3, 1, 0, 0); + return true; } blitter::output blitter::end(vk::raii::CommandBuffer & cmd) diff --git a/client/scenes/blitter.h b/client/scenes/blitter.h index 26685c72..cd2bea3f 100644 --- a/client/scenes/blitter.h +++ b/client/scenes/blitter.h @@ -66,7 +66,8 @@ public: void reset(const to_headset::video_stream_description & desc); void begin(vk::raii::CommandBuffer &); - void push_image(vk::raii::CommandBuffer & buf, uint8_t stream, vk::Sampler sampler, const vk::Extent2D &, vk::ImageView image, vk::ImageLayout); + // Return true if the image is used for this blitter's rgb + bool push_image(vk::raii::CommandBuffer & buf, uint8_t stream, vk::Sampler sampler, const vk::Extent2D &, vk::ImageView image, vk::ImageLayout); output end(vk::raii::CommandBuffer &); }; } // namespace wivrn diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index fdbdce05..17144c9e 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -839,9 +839,9 @@ void scenes::stream::render(const XrFrameState & frame_state) // Search for frame with desired display time on all decoders // If no such frame exists, use the latest frame for each decoder current_blit_handles = common_frame(frame_state.predictedDisplayTime); - std::array pose{}; - std::array fov{}; - std::array foveation{}; + std::array pose{}; + std::array fov{}; + std::array foveation{}; bool use_alpha = false; for (auto & blit_handle: current_blit_handles) @@ -855,9 +855,6 @@ void scenes::stream::render(const XrFrameState & frame_state) ++blit_handle->feedback.times_displayed; blit_handle->feedback.displayed = frame_state.predictedDisplayTime; - pose = blit_handle->view_info.pose; - fov = blit_handle->view_info.fov; - foveation = blit_handle->view_info.foveation; use_alpha = blit_handle->view_info.alpha; if (blit_handle->current_layout == vk::ImageLayout::eUndefined) @@ -889,7 +886,12 @@ void scenes::stream::render(const XrFrameState & frame_state) { if (not blit_handle) continue; - b.push_image(command_buffer, j, decoders[j].decoder->sampler(), decoders[j].decoder->extent(), blit_handle->image_view, blit_handle->current_layout); + if (b.push_image(command_buffer, j, decoders[j].decoder->sampler(), decoders[j].decoder->extent(), blit_handle->image_view, blit_handle->current_layout)) + { + pose[i] = blit_handle->view_info.pose[i]; + fov[i] = blit_handle->view_info.fov[i]; + foveation[i] = blit_handle->view_info.foveation[i]; + } } blitted[i] = b.end(command_buffer); }