summaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
authorGravatar bunnei2019-03-16 00:05:24 -0400
committerGravatar GitHub2019-03-16 00:05:24 -0400
commit47b622825ca0ff664044abdf2d64a141452a8d1c (patch)
treeff18141caee2b1a460e6d5e22283e78c073880b0 /src/video_core/engines
parentMerge pull request #2048 from FearlessTobi/port-3924 (diff)
parentgpu: Use host address for caching instead of guest address. (diff)
downloadyuzu-47b622825ca0ff664044abdf2d64a141452a8d1c.tar.gz
yuzu-47b622825ca0ff664044abdf2d64a141452a8d1c.tar.xz
yuzu-47b622825ca0ff664044abdf2d64a141452a8d1c.zip
Merge pull request #2237 from bunnei/cache-host-addr
gpu: Use host address for caching instead of guest address.
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/kepler_memory.cpp4
-rw-r--r--src/video_core/engines/maxwell_3d.cpp5
-rw-r--r--src/video_core/engines/maxwell_dma.cpp7
3 files changed, 12 insertions, 4 deletions
diff --git a/src/video_core/engines/kepler_memory.cpp b/src/video_core/engines/kepler_memory.cpp
index aae2a4019..daefa43a6 100644
--- a/src/video_core/engines/kepler_memory.cpp
+++ b/src/video_core/engines/kepler_memory.cpp
@@ -9,6 +9,7 @@
9#include "video_core/engines/kepler_memory.h" 9#include "video_core/engines/kepler_memory.h"
10#include "video_core/engines/maxwell_3d.h" 10#include "video_core/engines/maxwell_3d.h"
11#include "video_core/rasterizer_interface.h" 11#include "video_core/rasterizer_interface.h"
12#include "video_core/renderer_base.h"
12 13
13namespace Tegra::Engines { 14namespace Tegra::Engines {
14 15
@@ -48,7 +49,8 @@ void KeplerMemory::ProcessData(u32 data) {
48 // We have to invalidate the destination region to evict any outdated surfaces from the cache. 49 // We have to invalidate the destination region to evict any outdated surfaces from the cache.
49 // We do this before actually writing the new data because the destination address might contain 50 // We do this before actually writing the new data because the destination address might contain
50 // a dirty surface that will have to be written back to memory. 51 // a dirty surface that will have to be written back to memory.
51 Core::System::GetInstance().GPU().InvalidateRegion(*dest_address, sizeof(u32)); 52 system.Renderer().Rasterizer().InvalidateRegion(ToCacheAddr(Memory::GetPointer(*dest_address)),
53 sizeof(u32));
52 54
53 Memory::Write32(*dest_address, data); 55 Memory::Write32(*dest_address, data);
54 system.GPU().Maxwell3D().dirty_flags.OnMemoryWrite(); 56 system.GPU().Maxwell3D().dirty_flags.OnMemoryWrite();
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 144e7fa82..49979694e 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -396,7 +396,10 @@ void Maxwell3D::ProcessCBData(u32 value) {
396 const auto address = memory_manager.GpuToCpuAddress(buffer_address + regs.const_buffer.cb_pos); 396 const auto address = memory_manager.GpuToCpuAddress(buffer_address + regs.const_buffer.cb_pos);
397 ASSERT_MSG(address, "Invalid GPU address"); 397 ASSERT_MSG(address, "Invalid GPU address");
398 398
399 Memory::Write32(*address, value); 399 u8* ptr{Memory::GetPointer(*address)};
400 rasterizer.InvalidateRegion(ToCacheAddr(ptr), sizeof(u32));
401 std::memcpy(ptr, &value, sizeof(u32));
402
400 dirty_flags.OnMemoryWrite(); 403 dirty_flags.OnMemoryWrite();
401 404
402 // Increment the current buffer position. 405 // Increment the current buffer position.
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp
index 9dfea5999..415a6319a 100644
--- a/src/video_core/engines/maxwell_dma.cpp
+++ b/src/video_core/engines/maxwell_dma.cpp
@@ -9,6 +9,7 @@
9#include "video_core/engines/maxwell_3d.h" 9#include "video_core/engines/maxwell_3d.h"
10#include "video_core/engines/maxwell_dma.h" 10#include "video_core/engines/maxwell_dma.h"
11#include "video_core/rasterizer_interface.h" 11#include "video_core/rasterizer_interface.h"
12#include "video_core/renderer_base.h"
12#include "video_core/textures/decoders.h" 13#include "video_core/textures/decoders.h"
13 14
14namespace Tegra::Engines { 15namespace Tegra::Engines {
@@ -92,12 +93,14 @@ void MaxwellDMA::HandleCopy() {
92 const auto FlushAndInvalidate = [&](u32 src_size, u64 dst_size) { 93 const auto FlushAndInvalidate = [&](u32 src_size, u64 dst_size) {
93 // TODO(Subv): For now, manually flush the regions until we implement GPU-accelerated 94 // TODO(Subv): For now, manually flush the regions until we implement GPU-accelerated
94 // copying. 95 // copying.
95 Core::System::GetInstance().GPU().FlushRegion(*source_cpu, src_size); 96 Core::System::GetInstance().Renderer().Rasterizer().FlushRegion(
97 ToCacheAddr(Memory::GetPointer(*source_cpu)), src_size);
96 98
97 // We have to invalidate the destination region to evict any outdated surfaces from the 99 // We have to invalidate the destination region to evict any outdated surfaces from the
98 // cache. We do this before actually writing the new data because the destination address 100 // cache. We do this before actually writing the new data because the destination address
99 // might contain a dirty surface that will have to be written back to memory. 101 // might contain a dirty surface that will have to be written back to memory.
100 Core::System::GetInstance().GPU().InvalidateRegion(*dest_cpu, dst_size); 102 Core::System::GetInstance().Renderer().Rasterizer().InvalidateRegion(
103 ToCacheAddr(Memory::GetPointer(*dest_cpu)), dst_size);
101 }; 104 };
102 105
103 if (regs.exec.is_dst_linear && !regs.exec.is_src_linear) { 106 if (regs.exec.is_dst_linear && !regs.exec.is_src_linear) {