Browse Source

[vk] Remove improper check for image depth in texture cache.

When looking for existing images, ImageBase::TryFindBase checks the depth of the existing image to be greater than the layer of the base + depth of the candidate.
However the depth of images are not updated when cache were merged causing the lookup to fail.
This commit disables this faulty check to fix a critical memory leak that crashes the emulator in some games.
pull/164/head
weakboson 8 months ago
committed by crueter
parent
commit
737896b974
  1. 1
      src/video_core/texture_cache/texture_cache.h
  2. 8
      src/video_core/texture_cache/util.cpp

1
src/video_core/texture_cache/texture_cache.h

@ -1426,6 +1426,7 @@ ImageId TextureCache<P>::JoinImages(const ImageInfo& info, GPUVAddr gpu_addr, DA
if (solution) {
gpu_addr = solution->gpu_addr;
cpu_addr = solution->cpu_addr;
// TODO: properly update new_info.size.depth.
new_info.resources = solution->resources;
join_overlap_ids.push_back(overlap_id);
join_copies_to_do.emplace_back(JoinCopy{false, overlap_id});

8
src/video_core/texture_cache/util.cpp

@ -1216,10 +1216,10 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const
return std::nullopt;
}
if (existing.type == ImageType::e3D) {
const u32 mip_depth = std::max(1U, existing.size.depth << base->level);
if (mip_depth < candidate.size.depth + base->layer) {
return std::nullopt;
}
// const u32 mip_depth = std::max(1U, existing.size.depth << base->level);
// if (mip_depth < candidate.size.depth + base->layer) {
// return std::nullopt;
// }
} else if (existing.resources.layers < candidate.resources.layers + base->layer) {
return std::nullopt;
}

Loading…
Cancel
Save