From e1634cd8d8318931300d646d27b305baba5fea7b Mon Sep 17 00:00:00 2001 From: bmjask <> Date: Wed, 25 Nov 2026 22:37:26 -0800 Subject: [PATCH] Recompiler: bound far-jump analysis initial allocation The streaming effects fast path capped its initial instruction storage when it only needed to reject memory-writing shaders, but an early S_SETPC_B64 fallback still reserved for the entire shader before seeing a nearby store. Apply the same small initial capacity to the far-jump path and let it grow only when full analysis is required. Follow-up to #2656. Assisted-by: Codex (GPT-5.6-sol) --- crates/xcl/src/gpu/effects.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/xcl/src/gpu/effects.rs b/crates/xcl/src/gpu/effects.rs index 8703febfb8..b76be2aaa9 100644 --- a/crates/xcl/src/gpu/effects.rs +++ b/crates/xcl/src/gpu/effects.rs @@ -81,7 +81,10 @@ fn analyze(code: &[u8], stop_on_memory: bool) -> Option { } fn analyze_with_far_jumps(code: &[u8], stop_on_memory: bool) -> Option { - let mut insts = Vec::with_capacity(code.len() / 6); + // Keep early memory-writer rejection cheap even when an initial SETPC selects this slower + // path; grow only if analysis actually has to retain the rest of a large shader. + let cap = if stop_on_memory { (code.len() / 6).min(256) } else { code.len() / 6 }; + let mut insts = Vec::with_capacity(cap); let mut off = 0; let mut ended = false; let mut e = Effects::default();