From 4e533e79ee1abfa3dd5296418ac94b38d4891daa Mon Sep 17 00:00:00 2001 From: fromrivertothesea <345018979+fromrivertothesea@users.noreply.github.com> Date: Fri, 27 Nov 2026 22:44:06 +0100 Subject: [PATCH] Shaders: VICTORY_WAVE_WHY=1 tells a translation's LDS past the host's 32 KiB A console program may use up to 64 KiB of LDS a group; a D3D12 group has 32 KiB. When the program's own LDS and the dwords the translation adds past it (the halves' exchange, wave_base's counter, the console waves' meetings) do not fit, the refusal said only "LDS for the console waves' meetings past the host's 32 KiB", and other forms said nothing until the driver refused the pipeline. With VICTORY_WAVE_WHY=1, a WAVE64-LDS line now gives the total, the program's own dwords and what the translation added, e.g. for vfx_triangleClip:CS_CollectTriangles_Meshlets (#6b82bc7d22016cb5): WAVE64-LDS 8369 dwords of the host's 8192: the program's own 8192, the translation's 177 ... Output only; no translation changes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FsQtBz4aDhUTip3jBagKEX (cherry picked from commit c4b034ab4e09573e0188b4c77c87b277938c9f7b) --- crates/victory-shader/src/emit/lower.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/victory-shader/src/emit/lower.rs b/crates/victory-shader/src/emit/lower.rs index ed8a974..b58845c 100644 --- a/crates/victory-shader/src/emit/lower.rs +++ b/crates/victory-shader/src/emit/lower.rs @@ -2708,6 +2708,21 @@ impl<'a> Lower<'a> { let p = self.x.p; // A host group has 32 KiB of LDS (D3D12): the program's LDS with the meetings' and // exchanges' dwords past it must fit (`CS_CollectTriangles_Meshlets` uses all 32 KiB). + if self.s.lds_dwords > HOST_LDS_DWORDS && std::env::var_os("VICTORY_WAVE_WHY").is_some() { + // (the program's own LDS, then what the translation adds past it) + let own = match &self.x.native.io { + StageIo::Cs(cs) => cs.lds_bytes() / 4, + _ => 0, + }; + eprintln!( + "WAVE64-LDS {} dwords of the host's {HOST_LDS_DWORDS}: the program's own {own}, the translation's {} (exchange {:?}, counter {:?}, meetings {:?})", + self.s.lds_dwords, + self.s.lds_dwords.saturating_sub(own), + self.exchange.as_ref().map(|e| e.0), + self.halves.or(self.ticket), + self.pairs, + ); + } if self.pairs.is_some() && self.s.lds_dwords > HOST_LDS_DWORDS { return Err(unsupported(0, "LDS for the console waves' meetings past the host's 32 KiB")); }