diff options
| author | 2023-06-28 19:32:50 +0200 | |
|---|---|---|
| committer | 2023-06-28 21:32:45 +0200 | |
| commit | da440da9f54cc860f3c69da685a415d5ec9d7b64 (patch) | |
| tree | 5a7a4a56462244970e1356a723e6a8a77477f820 /src/video_core/gpu.cpp | |
| parent | MemoryTracking: Initial setup of atomic writes. (diff) | |
| download | yuzu-da440da9f54cc860f3c69da685a415d5ec9d7b64.tar.gz yuzu-da440da9f54cc860f3c69da685a415d5ec9d7b64.tar.xz yuzu-da440da9f54cc860f3c69da685a415d5ec9d7b64.zip | |
Memory Tracking: Optimize tracking to only use atomic writes when contested with the host GPU
Diffstat (limited to 'src/video_core/gpu.cpp')
| -rw-r--r-- | src/video_core/gpu.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index f823a1e2b..c192e33b2 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -96,7 +96,7 @@ struct GPU::Impl { | |||
| 96 | /// Synchronizes CPU writes with Host GPU memory. | 96 | /// Synchronizes CPU writes with Host GPU memory. |
| 97 | void InvalidateGPUCache() { | 97 | void InvalidateGPUCache() { |
| 98 | std::function<void(VAddr, size_t)> callback_writes( | 98 | std::function<void(VAddr, size_t)> callback_writes( |
| 99 | [this](VAddr address, size_t size) { rasterizer->OnCPUWrite(address, size); }); | 99 | [this](VAddr address, size_t size) { rasterizer->OnCacheInvalidation(address, size); }); |
| 100 | system.GatherGPUDirtyMemory(callback_writes); | 100 | system.GatherGPUDirtyMemory(callback_writes); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| @@ -301,6 +301,10 @@ struct GPU::Impl { | |||
| 301 | gpu_thread.InvalidateRegion(addr, size); | 301 | gpu_thread.InvalidateRegion(addr, size); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | bool OnCPUWrite(VAddr addr, u64 size) { | ||
| 305 | return rasterizer->OnCPUWrite(addr, size); | ||
| 306 | } | ||
| 307 | |||
| 304 | /// Notify rasterizer that any caches of the specified region should be flushed and invalidated | 308 | /// Notify rasterizer that any caches of the specified region should be flushed and invalidated |
| 305 | void FlushAndInvalidateRegion(VAddr addr, u64 size) { | 309 | void FlushAndInvalidateRegion(VAddr addr, u64 size) { |
| 306 | gpu_thread.FlushAndInvalidateRegion(addr, size); | 310 | gpu_thread.FlushAndInvalidateRegion(addr, size); |
| @@ -563,6 +567,10 @@ void GPU::InvalidateRegion(VAddr addr, u64 size) { | |||
| 563 | impl->InvalidateRegion(addr, size); | 567 | impl->InvalidateRegion(addr, size); |
| 564 | } | 568 | } |
| 565 | 569 | ||
| 570 | bool GPU::OnCPUWrite(VAddr addr, u64 size) { | ||
| 571 | return impl->OnCPUWrite(addr, size); | ||
| 572 | } | ||
| 573 | |||
| 566 | void GPU::FlushAndInvalidateRegion(VAddr addr, u64 size) { | 574 | void GPU::FlushAndInvalidateRegion(VAddr addr, u64 size) { |
| 567 | impl->FlushAndInvalidateRegion(addr, size); | 575 | impl->FlushAndInvalidateRegion(addr, size); |
| 568 | } | 576 | } |