From 119ad710e099b3081586b0b380b53fc675a5fd5a Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Mon, 31 Jan 2022 12:25:49 +0100 Subject: [PATCH] early-access version 2450 --- README.md | 2 +- src/video_core/buffer_cache/buffer_cache.h | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1a9412088..809ace267 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2448. +This is the source code for early-access 2450. ## Legal Notice diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index a89a0e782..57184d66b 100755 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -1495,19 +1495,29 @@ typename BufferCache

::OverlapResult BufferCache

::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{