diff options
author | yuzubot <yuzu@yuzu-emu.org> | 2022-02-22 13:02:16 +0000 |
---|---|---|
committer | yuzubot <yuzu@yuzu-emu.org> | 2022-02-22 13:02:16 +0000 |
commit | 610f30658fd9820fb8d5d15c63c80465e0f811f9 (patch) | |
tree | 5e859e0e7875dc15ef8c97069b437c4543eb1171 | |
parent | 2f45e999d8b4a7df2edc40bee28c7b4907c9f92a (diff) |
"Merge Tagged PR 7812"
-rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 20 |
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{ |