texture_cache: Handle overlap with equal address and different tiling mode (#2981)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

This commit is contained in:
squidbus 2025-05-23 10:56:46 -07:00 committed by GitHub
parent d124f40503
commit e5c6c88835
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -222,14 +222,23 @@ std::tuple<ImageId, int, int> TextureCache::ResolveOverlap(const ImageInfo& imag
-1, -1};
}
ImageId new_image_id{};
if (image_info.type == tex_cache_image.info.type) {
ASSERT(image_info.resources > tex_cache_image.info.resources);
new_image_id = ExpandImage(image_info, cache_image_id);
} else {
UNREACHABLE();
if (image_info.type == tex_cache_image.info.type &&
image_info.resources > tex_cache_image.info.resources) {
// Size and resources are greater, expand the image.
return {ExpandImage(image_info, cache_image_id), -1, -1};
}
return {new_image_id, -1, -1};
if (image_info.tiling_mode != tex_cache_image.info.tiling_mode) {
// Size is greater but resources are not, because the tiling mode is different.
// Likely this memory address is being reused for a different image with a different
// tiling mode.
if (safe_to_delete) {
FreeImage(cache_image_id);
}
return {merged_image_id, -1, -1};
}
UNREACHABLE_MSG("Encountered unresolvable image overlap with equal memory address.");
}
// Right overlap, the image requested is a possible subresource of the image from cache.