vk_texture_runtime: Add explicit "sub-image" index to View accessors

This needs a new pattern, the current one introduces lots of bugs
when we're trying to access the MSAA image.
This commit is contained in:
Wunkolo 2023-11-13 16:34:13 -08:00
parent 8356700ef7
commit 64a116b254
2 changed files with 12 additions and 12 deletions

View File

@ -1278,18 +1278,18 @@ vk::ImageView Surface::ImageView(u32 index) const noexcept {
return image_view;
}
vk::ImageView Surface::FramebufferView() noexcept {
vk::ImageView Surface::FramebufferView(u32 index) noexcept {
is_framebuffer = true;
return ImageView();
return ImageView(index);
}
vk::ImageView Surface::DepthView() noexcept {
vk::ImageView Surface::DepthView(u32 index) noexcept {
if (depth_view) {
return depth_view.get();
}
const vk::ImageViewCreateInfo view_info = {
.image = Image(),
.image = Image(index),
.viewType = vk::ImageViewType::e2D,
.format = instance->GetTraits(pixel_format).native,
.subresourceRange{
@ -1305,13 +1305,13 @@ vk::ImageView Surface::DepthView() noexcept {
return depth_view.get();
}
vk::ImageView Surface::StencilView() noexcept {
vk::ImageView Surface::StencilView(u32 index) noexcept {
if (stencil_view) {
return stencil_view.get();
}
const vk::ImageViewCreateInfo view_info = {
.image = Image(),
.image = Image(index),
.viewType = vk::ImageViewType::e2D,
.format = instance->GetTraits(pixel_format).native,
.subresourceRange{
@ -1327,7 +1327,7 @@ vk::ImageView Surface::StencilView() noexcept {
return stencil_view.get();
}
vk::ImageView Surface::StorageView() noexcept {
vk::ImageView Surface::StorageView(u32 index) noexcept {
if (storage_view) {
return storage_view.get();
}
@ -1336,7 +1336,7 @@ vk::ImageView Surface::StorageView() noexcept {
LOG_WARNING(Render_Vulkan,
"Attempted to retrieve storage view from unsupported surface with format {}",
VideoCore::PixelFormatAsString(pixel_format));
return ImageView();
return ImageView(index);
}
is_storage = true;

View File

@ -132,16 +132,16 @@ public:
vk::ImageView CopyImageView() noexcept;
/// Returns the framebuffer view of the surface image
vk::ImageView FramebufferView() noexcept;
vk::ImageView FramebufferView(u32 index = 1) noexcept;
/// Returns the depth view of the surface image
vk::ImageView DepthView() noexcept;
vk::ImageView DepthView(u32 index = 1) noexcept;
/// Returns the stencil view of the surface image
vk::ImageView StencilView() noexcept;
vk::ImageView StencilView(u32 index = 1) noexcept;
/// Returns the R32 image view used for atomic load/store
vk::ImageView StorageView() noexcept;
vk::ImageView StorageView(u32 index = 1) noexcept;
/// Returns a framebuffer handle for rendering to this surface
vk::Framebuffer Framebuffer() noexcept;