aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryuzubot <yuzu@yuzu-emu.org>2022-02-28 19:36:31 +0000
committeryuzubot <yuzu@yuzu-emu.org>2022-02-28 19:36:31 +0000
commitaff6290d57c86d87e2ba7e3e4ad85c8da5eda775 (patch)
treebcdb1c02d14d83a890c2b8a938f1c5d7197e5d1e
parentff005e9f47b0d08a8a6e3114f643b24854a2ca1e (diff)
"Merge Tagged PR 7812"
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index fa26eb8b0e..9d224b8a89 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -1469,19 +1469,29 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu
overlap_ids.push_back(overlap_id);
overlap.Pick();
const VAddr overlap_cpu_addr = overlap.CpuAddr();
+ bool goes_left = false;
if (overlap_cpu_addr < begin) {
+ goes_left = true;
cpu_addr = begin = overlap_cpu_addr;
}
- end = std::max(end, overlap_cpu_addr + overlap.SizeBytes());
-
+ const VAddr overlap_end = overlap_cpu_addr + overlap.SizeBytes();
+ bool goes_right = false;
+ if (overlap_end > end) {
+ goes_right = true;
+ end = overlap_end;
+ }
stream_score += overlap.StreamScore();
if (stream_score > STREAM_LEAP_THRESHOLD && !has_stream_leap) {
// When this memory region has been joined a bunch of times, we assume it's being used
// as a stream buffer. Increase the size to skip constantly recreating buffers.
has_stream_leap = true;
- begin -= PAGE_SIZE * 256;
- cpu_addr = begin;
- end += PAGE_SIZE * 256;
+ if (goes_right) {
+ begin -= PAGE_SIZE * 256;
+ cpu_addr = begin;
+ }
+ if (goes_left) {
+ end += PAGE_SIZE * 256;
+ }
}
}
return OverlapResult{