diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-01-29 22:00:49 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-01-29 22:53:27 +0100 |
commit | 4258d515e69d5f2d40301a1d1592304c12fd8126 (patch) | |
tree | 7b9ac154bb75d9ea79e0425fda2ee3db587d6d2e /src/video_core/renderer_vulkan | |
parent | Inline2Memory: Flush before writting buffer. (diff) | |
download | yuzu-4258d515e69d5f2d40301a1d1592304c12fd8126.tar yuzu-4258d515e69d5f2d40301a1d1592304c12fd8126.tar.gz yuzu-4258d515e69d5f2d40301a1d1592304c12fd8126.tar.bz2 yuzu-4258d515e69d5f2d40301a1d1592304c12fd8126.tar.lz yuzu-4258d515e69d5f2d40301a1d1592304c12fd8126.tar.xz yuzu-4258d515e69d5f2d40301a1d1592304c12fd8126.tar.zst yuzu-4258d515e69d5f2d40301a1d1592304c12fd8126.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 22 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index fd334a146..65c5fd63f 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -548,6 +548,28 @@ Tegra::Engines::AccelerateDMAInterface& RasterizerVulkan::AccessAccelerateDMA() return accelerate_dma; } +void RasterizerVulkan::AccelerateInline2Memory(GPUVAddr address, size_t copy_size, + std::span<u8> memory) { + auto cpu_addr = gpu_memory.GpuToCpuAddress(address); + if (!cpu_addr) [[unlikely]] { + gpu_memory.WriteBlock(address, memory.data(), copy_size); + return; + } + gpu_memory.WriteBlockUnsafe(address, memory.data(), copy_size); + { + std::unique_lock<std::mutex> lock{buffer_cache.mutex}; + if (!buffer_cache.InlineMemory(*cpu_addr, copy_size, memory)) { + buffer_cache.WriteMemory(*cpu_addr, copy_size); + } + } + { + std::scoped_lock lock_texture{texture_cache.mutex}; + texture_cache.WriteMemory(*cpu_addr, copy_size); + } + pipeline_cache.InvalidateRegion(*cpu_addr, copy_size); + query_cache.InvalidateRegion(*cpu_addr, copy_size); +} + bool RasterizerVulkan::AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr, u32 pixel_stride) { if (!framebuffer_addr) { diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 866827247..bbd79aae4 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h @@ -99,6 +99,7 @@ public: const Tegra::Engines::Fermi2D::Surface& dst, const Tegra::Engines::Fermi2D::Config& copy_config) override; Tegra::Engines::AccelerateDMAInterface& AccessAccelerateDMA() override; + void AccelerateInline2Memory(GPUVAddr address, size_t copy_size, std::span<u8> memory) override; bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr, u32 pixel_stride) override; void LoadDiskResources(u64 title_id, std::stop_token stop_loading, |