image_view: Use array view for color/depth buffers with multiple layers. (#1556)

This commit is contained in:
squidbus 2024-11-20 10:24:30 -08:00 committed by GitHub
parent b41664ac61
commit e585330744
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,6 +131,7 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::ColorBuffer& col_buffer,
Vulkan::LiverpoolToVK::SurfaceFormat(col_buffer.info.format, col_buffer.NumFormat()); Vulkan::LiverpoolToVK::SurfaceFormat(col_buffer.info.format, col_buffer.NumFormat());
range.base.layer = col_buffer.view.slice_start; range.base.layer = col_buffer.view.slice_start;
range.extent.layers = col_buffer.NumSlices() - range.base.layer; range.extent.layers = col_buffer.NumSlices() - range.base.layer;
type = range.extent.layers > 1 ? vk::ImageViewType::e2DArray : vk::ImageViewType::e2D;
format = Vulkan::LiverpoolToVK::AdjustColorBufferFormat( format = Vulkan::LiverpoolToVK::AdjustColorBufferFormat(
base_format, col_buffer.info.comp_swap.Value(), is_vo_surface); base_format, col_buffer.info.comp_swap.Value(), is_vo_surface);
} }
@ -143,6 +144,7 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::DepthBuffer& depth_buffer,
is_storage = ctl.depth_write_enable; is_storage = ctl.depth_write_enable;
range.base.layer = view.slice_start; range.base.layer = view.slice_start;
range.extent.layers = view.NumSlices() - range.base.layer; range.extent.layers = view.NumSlices() - range.base.layer;
type = range.extent.layers > 1 ? vk::ImageViewType::e2DArray : vk::ImageViewType::e2D;
} }
ImageView::ImageView(const Vulkan::Instance& instance, const ImageViewInfo& info_, Image& image, ImageView::ImageView(const Vulkan::Instance& instance, const ImageViewInfo& info_, Image& image,