fix depth/stencil buffer creation issues causing asserts in intel driver

This commit is contained in:
Random06457 2024-08-22 01:37:13 +09:00
parent 358a049565
commit 05f551b895
2 changed files with 8 additions and 6 deletions

View File

@ -73,14 +73,15 @@ static vk::ImageUsageFlags ImageUsageFlags(const ImageInfo& info) {
if (!info.IsBlockCoded() && !info.IsPacked()) {
usage |= vk::ImageUsageFlagBits::eColorAttachment;
}
}
// In cases where an image is created as a render/depth target and cleared with compute,
// we cannot predict whether it will be used as a storage image. A proper solution would
// involve re-creating the resource with a new configuration and copying previous content into
// it. However, for now, we will set storage usage for all images (if the format allows),
// sacrificing a bit of performance. Note use of ExtendedUsage flag set by default.
// involve re-creating the resource with a new configuration and copying previous content
// into it. However, for now, we will set storage usage for all images (if the format
// allows), sacrificing a bit of performance. Note use of ExtendedUsage flag set by default.
usage |= vk::ImageUsageFlagBits::eStorage;
}
return usage;
}

View File

@ -200,6 +200,7 @@ ImageView& TextureCache::FindDepthTarget(const ImageInfo& image_info,
Image& image = slot_images[image_id];
image.flags |= ImageFlagBits::GpuModified;
image.flags &= ~ImageFlagBits::CpuModified;
image.aspect_mask = vk::ImageAspectFlagBits::eDepth | vk::ImageAspectFlagBits::eStencil;
const auto new_layout = view_info.is_storage ? vk::ImageLayout::eDepthStencilAttachmentOptimal
: vk::ImageLayout::eDepthStencilReadOnlyOptimal;