summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2024-02-27 15:39:11 +0100
committerGitHub <noreply@github.com>2024-02-27 15:39:11 +0100
commit1de37306a521a3ee22f1f6703fa9c2f8169dcacb (patch)
treeb6c1b734b448c1de56c9fbb6113f8e8baa0cc741 /src/video_core
parenttexture_cache: use two-pass collection for costly load resources (#13096) (diff)
downloadyuzu-1de37306a521a3ee22f1f6703fa9c2f8169dcacb.tar
yuzu-1de37306a521a3ee22f1f6703fa9c2f8169dcacb.tar.gz
yuzu-1de37306a521a3ee22f1f6703fa9c2f8169dcacb.tar.bz2
yuzu-1de37306a521a3ee22f1f6703fa9c2f8169dcacb.tar.lz
yuzu-1de37306a521a3ee22f1f6703fa9c2f8169dcacb.tar.xz
yuzu-1de37306a521a3ee22f1f6703fa9c2f8169dcacb.tar.zst
yuzu-1de37306a521a3ee22f1f6703fa9c2f8169dcacb.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/buffer_cache/usage_tracker.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/video_core/buffer_cache/usage_tracker.h b/src/video_core/buffer_cache/usage_tracker.h
index 5f8688d31..ae511ccb6 100644
--- a/src/video_core/buffer_cache/usage_tracker.h
+++ b/src/video_core/buffer_cache/usage_tracker.h
@@ -26,6 +26,9 @@ public:
void Track(u64 offset, u64 size) noexcept {
const size_t page = offset >> PAGE_SHIFT;
const size_t page_end = (offset + size) >> PAGE_SHIFT;
+ if (page_end < page || page_end >= pages.size()) {
+ return;
+ }
TrackPage(page, offset, size);
if (page == page_end) {
return;
@@ -41,6 +44,9 @@ public:
[[nodiscard]] bool IsUsed(u64 offset, u64 size) const noexcept {
const size_t page = offset >> PAGE_SHIFT;
const size_t page_end = (offset + size) >> PAGE_SHIFT;
+ if (page_end < page || page_end >= pages.size()) {
+ return false;
+ }
if (IsPageUsed(page, offset, size)) {
return true;
}