Texture cache: Relaxing constraint on image type info, adding loggin and separate expandimage to improve overlap handling.

This commit is contained in:
Dmugetsu 2025-05-21 18:16:30 -06:00
parent 786ad6f71e
commit 4eaa0cc369

View File

@ -223,11 +223,28 @@ std::tuple<ImageId, int, int> TextureCache::ResolveOverlap(const ImageInfo& imag
} }
ImageId new_image_id{}; ImageId new_image_id{};
if (image_info.type == tex_cache_image.info.type) { if (image_info.resources.levels > tex_cache_image.info.resources.levels ||
ASSERT(image_info.resources > tex_cache_image.info.resources); 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); 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 { } 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}; return {new_image_id, -1, -1};
} }