From 16507a99f8df3e3b5f3442f4107e90dca2d7287b Mon Sep 17 00:00:00 2001 From: Slick Daddy <129640104+slick-daddy@users.noreply.github.com> Date: Sun, 25 Oct 2026 14:41:31 +0300 Subject: [PATCH] perf(shader): skip redundant sort/unique on single-element otherReads --- core/shader/recompiler/Recompiler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/shader/recompiler/Recompiler.cpp b/core/shader/recompiler/Recompiler.cpp index 5d4ecc297a..39b5bfcd35 100644 --- a/core/shader/recompiler/Recompiler.cpp +++ b/core/shader/recompiler/Recompiler.cpp @@ -1777,8 +1777,10 @@ void materializeCapture(ResourceCapture& capture, const SrtRuntime& runtime) { traced.readTrace = &capture.readTrace; ResourceMaterializer{}.Materialize(plan, traced, capture.snapshot); auto& other = capture.readTrace.otherReads; - std::sort(other.begin(), other.end()); - other.erase(std::unique(other.begin(), other.end()), other.end()); + if (other.size() > 1) { + std::sort(other.begin(), other.end()); + other.erase(std::unique(other.begin(), other.end()), other.end()); + } } }