From 4eaa0cc369a5724b721a7d2ead7e53f1143c43ab Mon Sep 17 00:00:00 2001 From: Dmugetsu Date: Wed, 21 May 2025 18:16:30 -0600 Subject: [PATCH] Texture cache: Relaxing constraint on image type info, adding loggin and separate expandimage to improve overlap handling. --- .../texture_cache/texture_cache.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/video_core/texture_cache/texture_cache.cpp b/src/video_core/texture_cache/texture_cache.cpp index 82f4d6413..78d4b75c6 100644 --- a/src/video_core/texture_cache/texture_cache.cpp +++ b/src/video_core/texture_cache/texture_cache.cpp @@ -223,11 +223,28 @@ std::tuple TextureCache::ResolveOverlap(const ImageInfo& imag } ImageId new_image_id{}; - if (image_info.type == tex_cache_image.info.type) { - ASSERT(image_info.resources > tex_cache_image.info.resources); + if (image_info.resources.levels > tex_cache_image.info.resources.levels || + image_info.resources.layers > tex_cache_image.info.resources.layers) { + LOG_INFO(Render, + "Expanding image at guest address 0x{:X}: resources ({}x{}) -> ({}x{})", + image_info.guest_address, tex_cache_image.info.resources.levels, + tex_cache_image.info.resources.layers, image_info.resources.levels, + image_info.resources.layers); new_image_id = ExpandImage(image_info, cache_image_id); + } else if (image_info.resources.levels == tex_cache_image.info.resources.levels && + image_info.resources.layers == tex_cache_image.info.resources.layers) { + LOG_INFO(Render, "Reusing exact match at guest address 0x{:X}: resources ({}x{})", + image_info.guest_address, image_info.resources.levels, + image_info.resources.layers); + new_image_id = cache_image_id; } else { - UNREACHABLE(); + LOG_INFO(Render, + "Reusing image at guest address 0x{:X} without expansion (resources ({}x{}) " + "< ({}x{}))", + image_info.guest_address, image_info.resources.levels, + image_info.resources.layers, tex_cache_image.info.resources.levels, + tex_cache_image.info.resources.layers); + new_image_id = cache_image_id; } return {new_image_id, -1, -1}; }