From 9da14a21193425dfb02d620e3da7eed954119b68 Mon Sep 17 00:00:00 2001 From: M Henning Date: Tue, 8 Feb 2022 01:00:02 -0500 Subject: [PATCH] nouveau/nir: Allow up to 6 nested joins This matches what the tgsi path does and doesn't regress any tests. (For comparison, unlimited join nesting does regress tests in deqp and piglit) Fixes graphical artifacts from stack overflows in https://www.shadertoy.com/view/Xds3zN with nir on kepler Reviewed-by: Emma Anholt Acked-by: Karol Herbst Part-of: --- src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp index f9703fe7cde..192f2f59c1b 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp @@ -1485,9 +1485,9 @@ Converter::visit(nir_if *nif) insertJoins = insertJoins && bb->getExit()->op == OP_BRA; } - /* only insert joins for the most outer if */ - if (--curIfDepth) + if (curIfDepth > 6) { insertJoins = false; + } /* we made sure that all threads would converge at the same block */ if (insertJoins) { @@ -1498,6 +1498,8 @@ Converter::visit(nir_if *nif) mkFlow(OP_JOIN, NULL, CC_ALWAYS, NULL)->fixed = 1; } + curIfDepth--; + return true; }