Cleanup some redundant variables

This commit is contained in:
Patrick Nicolas
2025-08-15 23:20:11 +02:00
parent 6d0cc60626
commit 31c347475e
4 changed files with 15 additions and 21 deletions
+7 -8
View File
@@ -1008,6 +1008,10 @@ void scenes::stream::render(const XrFrameState & frame_state)
uint16_t x_offset = 0; uint16_t x_offset = 0;
for (auto & out: decoder_output) 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( command_buffer.beginRenderPass(
{ {
.renderPass = *blit_render_pass, .renderPass = *blit_render_pass,
@@ -1316,10 +1320,7 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript
} }
// Create outputs for the decoders // Create outputs for the decoders
decoder_out_size = vk::Extent2D{video_width, video_height};
{ {
decoder_out_format = vk::Format::eA8B8G8R8SrgbPack32;
vk::ImageCreateInfo image_info{ vk::ImageCreateInfo image_info{
.flags = vk::ImageCreateFlags{}, .flags = vk::ImageCreateFlags{},
.imageType = vk::ImageType::e2D, .imageType = vk::ImageType::e2D,
@@ -1343,7 +1344,7 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript
vk::ImageViewCreateInfo image_view_info{ vk::ImageViewCreateInfo image_view_info{
.image = vk::Image{decoder_out_image}, .image = vk::Image{decoder_out_image},
.viewType = vk::ImageViewType::e2D, .viewType = vk::ImageViewType::e2D,
.format = vk::Format::eA8B8G8R8SrgbPack32, .format = image_info.format,
.components = {}, .components = {},
.subresourceRange = { .subresourceRange = {
.aspectMask = vk::ImageAspectFlagBits::eColor, .aspectMask = vk::ImageAspectFlagBits::eColor,
@@ -1367,8 +1368,8 @@ void scenes::stream::setup(const to_headset::video_stream_description & descript
.renderPass = *blit_render_pass, .renderPass = *blit_render_pass,
.attachmentCount = 1, .attachmentCount = 1,
.pAttachments = &*output.image_view, .pAttachments = &*output.image_view,
.width = decoder_out_size.width, .width = image_info.extent.width,
.height = decoder_out_size.height, .height = image_info.extent.height,
.layers = 1, .layers = 1,
}); });
} }
@@ -1435,8 +1436,6 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint
device, device,
physical_device, physical_device,
decoder_out_image, decoder_out_image,
vk::Extent2D{.width = video_width, .height = video_height},
2,
swapchain_images, swapchain_images,
extent, extent,
swapchain.format()); swapchain.format());
-2
View File
@@ -101,8 +101,6 @@ private:
vk::raii::DescriptorPool blit_descriptor_pool = nullptr; vk::raii::DescriptorPool blit_descriptor_pool = nullptr;
vk::raii::RenderPass blit_render_pass = nullptr; vk::raii::RenderPass blit_render_pass = nullptr;
vk::Extent2D decoder_out_size;
vk::Format decoder_out_format;
image_allocation decoder_out_image; image_allocation decoder_out_image;
struct renderpass_output struct renderpass_output
+7 -7
View File
@@ -74,16 +74,16 @@ stream_reprojection::vertex * stream_reprojection::get_vertices(size_t view)
stream_reprojection::stream_reprojection( stream_reprojection::stream_reprojection(
vk::raii::Device & device, vk::raii::Device & device,
vk::raii::PhysicalDevice & physical_device, vk::raii::PhysicalDevice & physical_device,
vk::Image input_image_, image_allocation & input_image,
vk::Extent2D input_extent,
uint32_t view_count,
std::vector<vk::Image> output_images_, std::vector<vk::Image> output_images_,
vk::Extent2D output_extent, vk::Extent2D output_extent,
vk::Format format) : vk::Format format) :
view_count(view_count), view_count(input_image.info().arrayLayers),
device(device), 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_images(std::move(output_images_)),
output_extent(output_extent) output_extent(output_extent)
{ {
@@ -144,7 +144,7 @@ stream_reprojection::stream_reprojection(
vk::ImageViewCreateInfo iv_info{ vk::ImageViewCreateInfo iv_info{
.image = input_image, .image = input_image,
.viewType = vk::ImageViewType::e2D, .viewType = vk::ImageViewType::e2D,
.format = vk::Format::eA8B8G8R8SrgbPack32, .format = input_image.info().format,
.components = { .components = {
.r = vk::ComponentSwizzle::eIdentity, .r = vk::ComponentSwizzle::eIdentity,
.g = vk::ComponentSwizzle::eIdentity, .g = vk::ComponentSwizzle::eIdentity,
+1 -4
View File
@@ -43,7 +43,6 @@ class stream_reprojection
// Source image // Source image
vk::raii::Sampler sampler = nullptr; vk::raii::Sampler sampler = nullptr;
vk::Image input_image;
std::vector<vk::raii::ImageView> input_image_views; std::vector<vk::raii::ImageView> input_image_views;
std::vector<vk::DescriptorSet> descriptor_sets; std::vector<vk::DescriptorSet> descriptor_sets;
vk::Extent2D input_extent; vk::Extent2D input_extent;
@@ -61,9 +60,7 @@ public:
stream_reprojection( stream_reprojection(
vk::raii::Device & device, vk::raii::Device & device,
vk::raii::PhysicalDevice & physical_device, vk::raii::PhysicalDevice & physical_device,
vk::Image input_image, image_allocation & input_image,
vk::Extent2D input_extent,
uint32_t view_count,
std::vector<vk::Image> output_images, std::vector<vk::Image> output_images,
vk::Extent2D output_extent, vk::Extent2D output_extent,
vk::Format format); vk::Format format);