aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan/vk_rasterizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_rasterizer.cpp')
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 429b2d63ef..0826820714 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -1250,20 +1250,37 @@ void RasterizerVulkan::AccelerateInlineToMemory(GPUVAddr address, size_t copy_si
return;
}
gpu_memory->WriteBlockUnsafe(address, memory.data(), copy_size);
+ // EDEN_NX2_INLINE_DEFER=0: invalidate every cache at once (for comparisons).
+ static const bool defer = [] {
+ const char* value = std::getenv("EDEN_NX2_INLINE_DEFER");
+ return value == nullptr || value[0] != '0';
+ }();
// One cache at a time: holding both while waiting for either (std::lock) waited longer, the
// fencing thread and CPU write traps holding one of them most of the time.
+ bool uploaded;
{
std::scoped_lock lock{buffer_cache.mutex};
- if (!buffer_cache.InlineMemory(*cpu_addr, copy_size, memory)) {
+ uploaded = buffer_cache.InlineMemory(*cpu_addr, copy_size, memory);
+ if (!uploaded && !defer) {
buffer_cache.WriteMemory(*cpu_addr, copy_size);
}
}
+ // Pending query results must not land over the new words later: drop them now.
+ query_cache.InvalidateRegion(*cpu_addr, copy_size);
+ if (!uploaded && defer) {
+ // Title 1 makes thousands of small inline writes between draws (~10% of the GPU
+ // thread invalidating every cache for each). Guest memory is written; the buffer,
+ // texture and shader caches see the merged ranges at the next FlushCaching, which runs
+ // before anything of theirs is used. Writes into GPU-written buffer data were uploaded
+ // in place above, as before.
+ gpu_memory->AccumulateInvalidation(address, copy_size);
+ return;
+ }
{
std::scoped_lock lock{texture_cache.mutex};
texture_cache.WriteMemory(*cpu_addr, copy_size);
}
pipeline_cache.InvalidateRegion(*cpu_addr, copy_size);
- query_cache.InvalidateRegion(*cpu_addr, copy_size);
}
std::optional<FramebufferTextureInfo> RasterizerVulkan::AccelerateDisplay(
@@ -1309,8 +1326,10 @@ void RasterizerVulkan::FlushWork() {
static constexpr u32 DRAWS_TO_DISPATCH = 512;
static constexpr u32 CHECK_MASK = 3;
#else
+ // Every 32 draws (was 8): each dispatch woke the worker thread, and Switch 2 titles make
+ // ~55,000 draws a second. A full chunk is dispatched on its own (Scheduler::Record).
static constexpr u32 DRAWS_TO_DISPATCH = 4096;
- static constexpr u32 CHECK_MASK = 7;
+ static constexpr u32 CHECK_MASK = 31;
#endif // __ANDROID__
static_assert(DRAWS_TO_DISPATCH % (CHECK_MASK + 1) == 0);