From 597a1da426c7be0abde5450169ce0a24d728a409 Mon Sep 17 00:00:00 2001 From: yuzubot Date: Tue, 27 Feb 2024 00:57:11 +0000 Subject: [PATCH] Merge yuzu-emu#13171 --- src/video_core/texture_cache/texture_cache.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 67487b463..feb1c575e 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -2114,7 +2114,9 @@ void TextureCache

::TrackImage(ImageBase& image, ImageId image_id) { ASSERT(False(image.flags & ImageFlagBits::Tracked)); image.flags |= ImageFlagBits::Tracked; if (False(image.flags & ImageFlagBits::Sparse)) { - device_memory.UpdatePagesCachedCount(image.cpu_addr, image.guest_size_bytes, 1); + if (image.cpu_addr < ~(1ULL << 40)) { + device_memory.UpdatePagesCachedCount(image.cpu_addr, image.guest_size_bytes, 1); + } return; } if (True(image.flags & ImageFlagBits::Registered)) { @@ -2140,7 +2142,9 @@ void TextureCache

::UntrackImage(ImageBase& image, ImageId image_id) { ASSERT(True(image.flags & ImageFlagBits::Tracked)); image.flags &= ~ImageFlagBits::Tracked; if (False(image.flags & ImageFlagBits::Sparse)) { - device_memory.UpdatePagesCachedCount(image.cpu_addr, image.guest_size_bytes, -1); + if (image.cpu_addr < ~(1ULL << 40)) { + device_memory.UpdatePagesCachedCount(image.cpu_addr, image.guest_size_bytes, -1); + } return; } ASSERT(True(image.flags & ImageFlagBits::Registered));