renderer_vulkan: Require exact image format for resolve pass. (#1742)

This commit is contained in:
squidbus 2024-12-11 12:51:39 -08:00 committed by GitHub
parent 0a9c437ec8
commit 714605c6a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 5 deletions

View file

@ -324,6 +324,10 @@ ImageId TextureCache::FindImage(BaseDesc& desc, FindFlags flags) {
!IsVulkanFormatCompatible(info.pixel_format, cache_image.info.pixel_format)) {
continue;
}
if (True(flags & FindFlags::ExactFmt) &&
info.pixel_format != cache_image.info.pixel_format) {
continue;
}
ASSERT((cache_image.info.type == info.type || info.size == Extent3D{1, 1, 1} ||
True(flags & FindFlags::RelaxFmt)));
image_id = cache_id;
@ -348,9 +352,12 @@ ImageId TextureCache::FindImage(BaseDesc& desc, FindFlags flags) {
}
if (image_id) {
Image& image_resoved = slot_images[image_id];
if (image_resoved.info.resources < info.resources) {
Image& image_resolved = slot_images[image_id];
if (True(flags & FindFlags::ExactFmt) &&
info.pixel_format != image_resolved.info.pixel_format) {
// Cannot reuse this image as we need the exact requested format.
image_id = {};
} else if (image_resolved.info.resources < info.resources) {
// The image was clearly picked up wrong.
FreeImage(image_id);
image_id = {};

View file

@ -28,6 +28,7 @@ enum class FindFlags {
RelaxDim = 1 << 1, ///< Do not check the dimentions of image, only address.
RelaxSize = 1 << 2, ///< Do not check that the size matches exactly.
RelaxFmt = 1 << 3, ///< Do not check that format is compatible.
ExactFmt = 1 << 4, ///< Require the format to be exactly the same.
};
DECLARE_ENUM_FLAG_OPERATORS(FindFlags)