From a667551cdf6e9044e43e1d0c37320c3ec82a1213 Mon Sep 17 00:00:00 2001 From: Duck <350528965+Duck912@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:47:54 -0500 Subject: video_core: cut per-draw work on the GPU back thread in crowded scenes (#374) * video_core: demote the texture cache's per-draw debug logs to trace The invalid sampler and image view index messages fire for unused binding slots on every draw. Filtered LOG_DEBUG messages still cost a call and argument packing: in a Fire Emblem: Fortune's Weave city scene (about 2,100 draws per frame) they were 3.1% of the GPUBack thread's samples. LOG_TRACE compiles them out of release builds. Assisted-by: Claude Opus 5.5 (profiling, porting and drafting) Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com> * texture_cache: read a descriptor with one page lookup DescriptorTable::Read runs for every texture and sampler of every draw, and it read each 32-byte TIC/TSC entry through the generic ReadBlockUnsafe page walk. In a Fire Emblem: Fortune's Weave city scene (about 2,100 draws per frame) that was 5.0% of the GPUBack thread's samples. An entry within one page is contiguous in host memory, so it is now a single page lookup and memcpy. Entries that cross a page and pages without host memory still take the block read, so unmapped and unbacked entries still read as zero. The same change in another Eden-based build cut these reads from 6.4% to 0.4% of its GPU thread. Assisted-by: Claude Opus 5.5 (profiling, porting and drafting) Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com> --------- Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com> --- src/video_core/texture_cache/texture_cache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/video_core/texture_cache/texture_cache.h') diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index abb22b9bfb..ea82ab02e7 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -580,7 +580,7 @@ template SamplerId TextureCache

::GetSamplerId(u32 index, bool compute) { auto& table = compute ? channel_state->compute_sampler_table : channel_state->graphics_sampler_table; if (index > table.current_limit) { - LOG_DEBUG(HW_GPU, "Invalid sampler index={}", index); + LOG_TRACE(HW_GPU, "Invalid sampler index={}", index); return NULL_SAMPLER_ID; } auto const map_index = index | (compute ? Common::SlotId::TAGGED_VALUE : 0); @@ -812,7 +812,7 @@ ImageViewId TextureCache

::VisitImageView(u32 index, bool compute) { index = Tegra::Texture::TextureHeaderIndex(index, table.current_limit, gpu_memory->UsesNativeTiling()); if (index > table.current_limit) { - LOG_DEBUG(HW_GPU, "Invalid image view index={}", index); + LOG_TRACE(HW_GPU, "Invalid image view index={}", index); return NULL_IMAGE_VIEW_ID; } auto const map_index = index | (compute ? Common::SlotId::TAGGED_VALUE : 0); -- cgit v1.2.3