summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-03-20 23:23:53 +0100
committerGitHub <noreply@github.com>2022-03-20 23:23:53 +0100
commitff2e8910225134af408b8ca148ac7c1bc1b9e967 (patch)
tree3d10ea6e57caebf466badeb375ea44e1ab86f23b /src/video_core
parentMerge pull request #8054 from merryhime/dynarmic (diff)
parentBufferCache: Find direction of the stream buffer increase. (diff)
downloadyuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.tar
yuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.tar.gz
yuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.tar.bz2
yuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.tar.lz
yuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.tar.xz
yuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.tar.zst
yuzu-ff2e8910225134af408b8ca148ac7c1bc1b9e967.zip
Diffstat (limited to 'src/video_core')
-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 fa26eb8b0..6d8955ca3 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -1469,19 +1469,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{