From 0134b8c3a876fdc4a4e7885819cab3ac8c501b69 Mon Sep 17 00:00:00 2001 From: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Wed, 1 Oct 2025 22:22:48 +0300 Subject: [PATCH] buffer_cache: Bring back CPU path (#3679) It was reported this resulted in a noticeable 10+ fps drop in Driveclub so bring it back just with check to avoid it if the source range is an image alias --- src/video_core/buffer_cache/buffer_cache.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video_core/buffer_cache/buffer_cache.cpp b/src/video_core/buffer_cache/buffer_cache.cpp index bc19c97e1..9674acf26 100644 --- a/src/video_core/buffer_cache/buffer_cache.cpp +++ b/src/video_core/buffer_cache/buffer_cache.cpp @@ -365,6 +365,16 @@ void BufferCache::InlineData(VAddr address, const void* value, u32 num_bytes, bo } void BufferCache::CopyBuffer(VAddr dst, VAddr src, u32 num_bytes, bool dst_gds, bool src_gds) { + if (!dst_gds && !IsRegionGpuModified(dst, num_bytes)) { + if (!src_gds && !IsRegionGpuModified(src, num_bytes) && + !texture_cache.FindImageFromRange(src, num_bytes)) { + // Both buffers were not transferred to GPU yet. Can safely copy in host memory. + memcpy(std::bit_cast(dst), std::bit_cast(src), num_bytes); + return; + } + // Without a readback there's nothing we can do with this + // Fallback to creating dst buffer on GPU to at least have this data there + } texture_cache.InvalidateMemoryFromGPU(dst, num_bytes); auto& src_buffer = [&] -> const Buffer& { if (src_gds) {