From 727cbc3d136f16d6358073678530ce749bdac339 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 26 Dec 2025 21:33:06 -0700 Subject: [PATCH] refactor(core): `debug_assert` that we wrote at least one deduction for `maxInterStageShaderVariables` errors --- wgpu-core/src/validation/shader_io_deductions.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wgpu-core/src/validation/shader_io_deductions.rs b/wgpu-core/src/validation/shader_io_deductions.rs index 6189b15ce..fbbf17fe0 100644 --- a/wgpu-core/src/validation/shader_io_deductions.rs +++ b/wgpu-core/src/validation/shader_io_deductions.rs @@ -147,9 +147,18 @@ where .filter(|(_, effective_deduction)| *effective_deduction > 0); if relevant_deductions.clone().next().is_some() { writeln!(f, "; note that some deductions apply during validation:")?; + let mut wrote_something = false; for deduction in deductions { - writeln!(f, "\n- {deduction:?}: {}", accessor(deduction))?; + let deducted_amount = accessor(deduction); + if deducted_amount > 0 { + writeln!(f, "\n- {deduction:?}: {}", accessor(deduction))?; + wrote_something = true; + } } + debug_assert!( + wrote_something, + "no substantial deductions found in error display" + ); } Ok(()) })