From 3e96c367bd1729d1a6c8bfd8b532301da85d4b5a Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 15 Apr 2019 22:42:34 -0400 Subject: [PATCH] Use WriteBlock and ReadBlock. --- src/video_core/engines/kepler_memory.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/video_core/engines/kepler_memory.cpp b/src/video_core/engines/kepler_memory.cpp index 4df19c1f5..7387886a3 100644 --- a/src/video_core/engines/kepler_memory.cpp +++ b/src/video_core/engines/kepler_memory.cpp @@ -50,15 +50,8 @@ void KeplerMemory::ProcessData(u32 data, bool is_last_call) { state.write_offset += sub_copy_size; if (is_last_call) { const GPUVAddr address{regs.dest.Address()}; - const auto host_ptr = memory_manager.GetPointer(address); if (regs.exec.linear != 0) { - // We have to invalidate the destination region to evict any outdated surfaces from the - // cache. We do this before actually writing the new data because the destination - // address might contain a dirty surface that will have to be written back to memory. - - rasterizer.InvalidateRegion(ToCacheAddr(host_ptr), state.copy_size); - std::memcpy(host_ptr, state.inner_buffer.data(), state.copy_size); - system.GPU().Maxwell3D().dirty_flags.OnMemoryWrite(); + memory_manager.WriteBlock(address, state.inner_buffer.data(), state.copy_size); } else { UNIMPLEMENTED_IF(regs.dest.z != 0); UNIMPLEMENTED_IF(regs.dest.depth != 1); @@ -66,11 +59,14 @@ void KeplerMemory::ProcessData(u32 data, bool is_last_call) { UNIMPLEMENTED_IF(regs.dest.BlockDepth() != 1); const std::size_t dst_size = Tegra::Texture::CalculateSize( true, 1, regs.dest.width, regs.dest.height, 1, regs.dest.BlockHeight(), 1); - rasterizer.InvalidateRegion(ToCacheAddr(host_ptr), dst_size); + std::vector tmp_buffer(dst_size); + memory_manager.ReadBlock(address, tmp_buffer.data(), dst_size); Tegra::Texture::SwizzleKepler(regs.dest.width, regs.dest.height, regs.dest.x, regs.dest.y, regs.dest.BlockHeight(), state.copy_size, - state.inner_buffer.data(), host_ptr); + state.inner_buffer.data(), tmp_buffer.data()); + memory_manager.WriteBlock(address, tmp_buffer.data(), dst_size); } + system.GPU().Maxwell3D().dirty_flags.OnMemoryWrite(); } }