diff options
| author | 2019-02-18 20:58:32 -0500 | |
|---|---|---|
| committer | 2019-03-14 22:34:42 -0400 | |
| commit | 2eaf6c41a4686028c0abc84d1be6fd48a67cf49f (patch) | |
| tree | 6ad0848c848aea68e637386cad5068e13c831b92 /src/video_core/engines | |
| parent | Merge pull request #2233 from ReinUsesLisp/morton-cleanup (diff) | |
| download | yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.tar.gz yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.tar.xz yuzu-2eaf6c41a4686028c0abc84d1be6fd48a67cf49f.zip | |
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.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.cpp | 7 |
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 | ||
| 13 | namespace Tegra::Engines { | 14 | namespace 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 | ||
| 14 | namespace Tegra::Engines { | 15 | namespace 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) { |