diff options
| author | 2023-01-06 07:31:39 -0500 | |
|---|---|---|
| committer | 2023-01-06 07:31:39 -0500 | |
| commit | 5bcbb8de45540bee7a64b7b1867f61c57f51ab88 (patch) | |
| tree | 49fd1c79dfefba1139ad1577a414ed07293ecf81 /src/video_core/renderer_vulkan | |
| parent | Merge pull request #9564 from FernandoS27/oops-i-did-it-again (diff) | |
| parent | BufferBase: Don't ignore GPU pages. (diff) | |
| download | yuzu-5bcbb8de45540bee7a64b7b1867f61c57f51ab88.tar.gz yuzu-5bcbb8de45540bee7a64b7b1867f61c57f51ab88.tar.xz yuzu-5bcbb8de45540bee7a64b7b1867f61c57f51ab88.zip | |
Merge pull request #9559 from FernandoS27/cached-writes
VideoCore: Implement Cached Writes, use fastmem for reading GPU memory and eliminate old stuffs
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 23 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 242bf9602..ed4a72166 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -186,6 +186,7 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) { | |||
| 186 | 186 | ||
| 187 | SCOPE_EXIT({ gpu.TickWork(); }); | 187 | SCOPE_EXIT({ gpu.TickWork(); }); |
| 188 | FlushWork(); | 188 | FlushWork(); |
| 189 | gpu_memory->FlushCaching(); | ||
| 189 | 190 | ||
| 190 | query_cache.UpdateCounters(); | 191 | query_cache.UpdateCounters(); |
| 191 | 192 | ||
| @@ -393,6 +394,7 @@ void RasterizerVulkan::Clear(u32 layer_count) { | |||
| 393 | 394 | ||
| 394 | void RasterizerVulkan::DispatchCompute() { | 395 | void RasterizerVulkan::DispatchCompute() { |
| 395 | FlushWork(); | 396 | FlushWork(); |
| 397 | gpu_memory->FlushCaching(); | ||
| 396 | 398 | ||
| 397 | ComputePipeline* const pipeline{pipeline_cache.CurrentComputePipeline()}; | 399 | ComputePipeline* const pipeline{pipeline_cache.CurrentComputePipeline()}; |
| 398 | if (!pipeline) { | 400 | if (!pipeline) { |
| @@ -481,6 +483,27 @@ void RasterizerVulkan::InvalidateRegion(VAddr addr, u64 size, VideoCommon::Cache | |||
| 481 | } | 483 | } |
| 482 | } | 484 | } |
| 483 | 485 | ||
| 486 | void RasterizerVulkan::InnerInvalidation(std::span<const std::pair<VAddr, std::size_t>> sequences) { | ||
| 487 | { | ||
| 488 | std::scoped_lock lock{texture_cache.mutex}; | ||
| 489 | for (const auto& [addr, size] : sequences) { | ||
| 490 | texture_cache.WriteMemory(addr, size); | ||
| 491 | } | ||
| 492 | } | ||
| 493 | { | ||
| 494 | std::scoped_lock lock{buffer_cache.mutex}; | ||
| 495 | for (const auto& [addr, size] : sequences) { | ||
| 496 | buffer_cache.WriteMemory(addr, size); | ||
| 497 | } | ||
| 498 | } | ||
| 499 | { | ||
| 500 | for (const auto& [addr, size] : sequences) { | ||
| 501 | query_cache.InvalidateRegion(addr, size); | ||
| 502 | pipeline_cache.InvalidateRegion(addr, size); | ||
| 503 | } | ||
| 504 | } | ||
| 505 | } | ||
| 506 | |||
| 484 | void RasterizerVulkan::OnCPUWrite(VAddr addr, u64 size) { | 507 | void RasterizerVulkan::OnCPUWrite(VAddr addr, u64 size) { |
| 485 | if (addr == 0 || size == 0) { | 508 | if (addr == 0 || size == 0) { |
| 486 | return; | 509 | return; |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index c661e5b19..472cc64d9 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h | |||
| @@ -79,6 +79,7 @@ public: | |||
| 79 | VideoCommon::CacheType which = VideoCommon::CacheType::All) override; | 79 | VideoCommon::CacheType which = VideoCommon::CacheType::All) override; |
| 80 | void InvalidateRegion(VAddr addr, u64 size, | 80 | void InvalidateRegion(VAddr addr, u64 size, |
| 81 | VideoCommon::CacheType which = VideoCommon::CacheType::All) override; | 81 | VideoCommon::CacheType which = VideoCommon::CacheType::All) override; |
| 82 | void InnerInvalidation(std::span<const std::pair<VAddr, std::size_t>> sequences) override; | ||
| 82 | void OnCPUWrite(VAddr addr, u64 size) override; | 83 | void OnCPUWrite(VAddr addr, u64 size) override; |
| 83 | void InvalidateGPUCache() override; | 84 | void InvalidateGPUCache() override; |
| 84 | void UnmapMemory(VAddr addr, u64 size) override; | 85 | void UnmapMemory(VAddr addr, u64 size) override; |