diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 7dd945a3..9db56dbb 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -1008,6 +1008,10 @@ void scenes::stream::render(const XrFrameState & frame_state) uint16_t x_offset = 0; for (auto & out: decoder_output) { + vk::Extent2D decoder_out_size{ + .width = decoder_out_image.info().extent.width, + .height = decoder_out_image.info().extent.height, + }; command_buffer.beginRenderPass( { .renderPass = *blit_render_pass, @@ -1316,10 +1320,7 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript } // Create outputs for the decoders - decoder_out_size = vk::Extent2D{video_width, video_height}; { - decoder_out_format = vk::Format::eA8B8G8R8SrgbPack32; - vk::ImageCreateInfo image_info{ .flags = vk::ImageCreateFlags{}, .imageType = vk::ImageType::e2D, @@ -1343,7 +1344,7 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript vk::ImageViewCreateInfo image_view_info{ .image = vk::Image{decoder_out_image}, .viewType = vk::ImageViewType::e2D, - .format = vk::Format::eA8B8G8R8SrgbPack32, + .format = image_info.format, .components = {}, .subresourceRange = { .aspectMask = vk::ImageAspectFlagBits::eColor, @@ -1367,8 +1368,8 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript .renderPass = *blit_render_pass, .attachmentCount = 1, .pAttachments = &*output.image_view, - .width = decoder_out_size.width, - .height = decoder_out_size.height, + .width = image_info.extent.width, + .height = image_info.extent.height, .layers = 1, }); } @@ -1435,8 +1436,6 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint device, physical_device, decoder_out_image, - vk::Extent2D{.width = video_width, .height = video_height}, - 2, swapchain_images, extent, swapchain.format()); diff --git a/client/scenes/stream.h b/client/scenes/stream.h index aa28435a..3c227e90 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -101,8 +101,6 @@ private: vk::raii::DescriptorPool blit_descriptor_pool = nullptr; vk::raii::RenderPass blit_render_pass = nullptr; - vk::Extent2D decoder_out_size; - vk::Format decoder_out_format; image_allocation decoder_out_image; struct renderpass_output diff --git a/client/scenes/stream_reprojection.cpp b/client/scenes/stream_reprojection.cpp index deddb0b2..91443138 100644 --- a/client/scenes/stream_reprojection.cpp +++ b/client/scenes/stream_reprojection.cpp @@ -74,16 +74,16 @@ stream_reprojection::vertex * stream_reprojection::get_vertices(size_t view) stream_reprojection::stream_reprojection( vk::raii::Device & device, vk::raii::PhysicalDevice & physical_device, - vk::Image input_image_, - vk::Extent2D input_extent, - uint32_t view_count, + image_allocation & input_image, std::vector output_images_, vk::Extent2D output_extent, vk::Format format) : - view_count(view_count), + view_count(input_image.info().arrayLayers), device(device), - input_image(input_image_), - input_extent(input_extent), + input_extent{ + .width = input_image.info().extent.width, + .height = input_image.info().extent.height, + }, output_images(std::move(output_images_)), output_extent(output_extent) { @@ -144,7 +144,7 @@ stream_reprojection::stream_reprojection( vk::ImageViewCreateInfo iv_info{ .image = input_image, .viewType = vk::ImageViewType::e2D, - .format = vk::Format::eA8B8G8R8SrgbPack32, + .format = input_image.info().format, .components = { .r = vk::ComponentSwizzle::eIdentity, .g = vk::ComponentSwizzle::eIdentity, diff --git a/client/scenes/stream_reprojection.h b/client/scenes/stream_reprojection.h index 6854d4d6..49143149 100644 --- a/client/scenes/stream_reprojection.h +++ b/client/scenes/stream_reprojection.h @@ -43,7 +43,6 @@ class stream_reprojection // Source image vk::raii::Sampler sampler = nullptr; - vk::Image input_image; std::vector input_image_views; std::vector descriptor_sets; vk::Extent2D input_extent; @@ -61,9 +60,7 @@ public: stream_reprojection( vk::raii::Device & device, vk::raii::PhysicalDevice & physical_device, - vk::Image input_image, - vk::Extent2D input_extent, - uint32_t view_count, + image_allocation & input_image, std::vector output_images, vk::Extent2D output_extent, vk::Format format);