aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/buffer_cache/buffer_cache.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2023-07-10 18:54:19 -0700
committerGitHub <noreply@github.com>2023-07-10 18:54:19 -0700
commitce7c418e0cc05d92c18ad69c7cb37fecfa71b037 (patch)
treeea1852111c1b3c3c340608ae518fc8711a4fcfe3 /src/video_core/buffer_cache/buffer_cache.h
parent169b198d084b925d3ad7048e939e8d25a83a34b8 (diff)
parentf1cfd9c2197e3e0c8409b869714b599d96e079c0 (diff)
Merge pull request #10996 from Kelebek1/readblock_optimisation
Use spans over guest memory where possible instead of copying data
Diffstat (limited to 'src/video_core/buffer_cache/buffer_cache.h')
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index b5ed3380f..6ed4b78f2 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -234,9 +234,10 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am
if (has_new_downloads) {
memory_tracker.MarkRegionAsGpuModified(*cpu_dest_address, amount);
}
- tmp_buffer.resize_destructive(amount);
- cpu_memory.ReadBlockUnsafe(*cpu_src_address, tmp_buffer.data(), amount);
- cpu_memory.WriteBlockUnsafe(*cpu_dest_address, tmp_buffer.data(), amount);
+
+ Core::Memory::CpuGuestMemoryScoped<u8, Core::Memory::GuestMemoryFlags::UnsafeReadWrite> tmp(
+ cpu_memory, *cpu_src_address, amount, &tmp_buffer);
+ tmp.SetAddressAndSize(*cpu_dest_address, amount);
return true;
}