2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #13171 from liamwhite/fake-address

texture_cache: do not track invalid addresses
This commit is contained in:
liamwhite 2024-02-27 09:42:46 -05:00 committed by GitHub
commit f1b1530249
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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