summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2022-01-31 10:07:01 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2022-03-20 21:37:23 +0100
commit3b0d233cbdcd1aba8b00032a9924586307dc6ccd (patch)
tree7ffff195466b5d6a283c25ca03c49293f8ba3a07
parentMerge pull request #7791 from german77/wall_clock (diff)
downloadyuzu-3b0d233cbdcd1aba8b00032a9924586307dc6ccd.tar
yuzu-3b0d233cbdcd1aba8b00032a9924586307dc6ccd.tar.gz
yuzu-3b0d233cbdcd1aba8b00032a9924586307dc6ccd.tar.bz2
yuzu-3b0d233cbdcd1aba8b00032a9924586307dc6ccd.tar.lz
yuzu-3b0d233cbdcd1aba8b00032a9924586307dc6ccd.tar.xz
yuzu-3b0d233cbdcd1aba8b00032a9924586307dc6ccd.tar.zst
yuzu-3b0d233cbdcd1aba8b00032a9924586307dc6ccd.zip
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 048dba4f3..367f30517 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -1464,19 +1464,27 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(VAddr cpu
overlap_ids.push_back(overlap_id);
overlap.Pick();
const VAddr overlap_cpu_addr = overlap.CpuAddr();
- if (overlap_cpu_addr < begin) {
+ const bool expands_left = overlap_cpu_addr < begin;
+ if (expands_left) {
cpu_addr = begin = overlap_cpu_addr;
}
- end = std::max(end, overlap_cpu_addr + overlap.SizeBytes());
-
+ const VAddr overlap_end = overlap_cpu_addr + overlap.SizeBytes();
+ const bool expands_right = overlap_end > end;
+ if (overlap_end > end) {
+ 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 (expands_right) {
+ begin -= PAGE_SIZE * 256;
+ cpu_addr = begin;
+ }
+ if (expands_left) {
+ end += PAGE_SIZE * 256;
+ }
}
}
return OverlapResult{