From 1c2ed2a072ba24a3d21a25dfa6cfcce1bf1ae905 Mon Sep 17 00:00:00 2001 From: Takoroka <137927095+Takoroka@users.noreply.github.com> Date: Thu, 29 Oct 2026 04:40:26 -0400 Subject: video_core: skip empty fences; one lock per cache per fence; single-pass overlap subtract Switch 2 titles signal a fence for each compute dispatch's release (5,000-7,000 a second in title 1). With fast GPU fences the callback runs at once, so a fence with no downloads, queries or queued operations does nothing: those (~20%) are no longer made (one in 64 still is, for the operations fences carry). Each cache's lock is now taken once per fence (the flush check took both together first). The overlap range set's Subtract restarted its search after every erase (quadratic); the fencing thread runs it for every downloaded range while holding the buffer cache. The GPU profiler counts fences, skipped fences and buffer download bytes. --- src/video_core/buffer_cache/buffer_cache.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/video_core/buffer_cache/buffer_cache.h') diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index ad2e200438..e2de0eede1 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -17,6 +17,7 @@ #include "video_core/buffer_cache/buffer_cache_base.h" #include "video_core/guest_memory.h" #include "video_core/host1x/gpu_device_memory_manager.h" +#include "video_core/nx2_profile.h" #include "video_core/texture_cache/util.h" namespace VideoCommon { @@ -666,6 +667,8 @@ void BufferCache

::CommitAsyncFlushesHigh() { async_buffers.emplace_back(std::optional{}); return; } + Nx2Profile::Add(Nx2Profile::Counter::DownloadBytes, total_size_bytes); + Nx2Profile::Add(Nx2Profile::Counter::DownloadCopies, downloads.size()); auto download_staging = runtime.DownloadStagingBuffer(total_size_bytes, true); boost::container::small_vector normalized_copies; runtime.PreCopyBarrier(); -- cgit v1.2.3