diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 01:11:11 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 15:18:02 -0500 |
| commit | ca1fac93fb4397a89424c6621be3515949b94729 (patch) | |
| tree | 7435c26940dbac3de3b1aa52da210b734eb0b988 /src | |
| parent | 40902b09c7b86de7cf12f26839241f26925d04b5 (diff) | |
texture_cache: cold-hint the guest memory of sparse images too
Images whose guest memory is not contiguous were left out of the cold
hint. With sparse tile remaps Mario Kart World maps its own memory into
such images, and its game memory in RAM rose by ~1.9 GB in one run. Each
mapped piece is now hinted.
(cherry picked from commit 97f034615c174178301a4999c334fb39cd03e568)
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 8ff3e012e1..249559e7be 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -1406,8 +1406,15 @@ void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) { // streams several GB of textures through it). constexpr u64 ColdHintMinBytes = 64_KiB; if (image.guest_size_bytes >= ColdHintMinBytes && - False(image.flags & (ImageFlagBits::GpuModified | ImageFlagBits::Sparse))) { - uploaded_ranges.emplace_back(image.cpu_addr, image.guest_size_bytes); + False(image.flags & ImageFlagBits::GpuModified)) { + if (True(image.flags & ImageFlagBits::Sparse)) { + // Non-contiguous: each mapped piece (title 1 maps its own memory into these). + ForEachSparseSegment(image, [&](GPUVAddr, DAddr address, size_t size) { + uploaded_ranges.emplace_back(address, size); + }); + } else { + uploaded_ranges.emplace_back(image.cpu_addr, image.guest_size_bytes); + } } } |
