From a3c45306e25e047a5e74ccc24182bc9e59aae90f Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Wed, 7 Feb 2024 15:59:02 -0800 Subject: [PATCH] spirv2dxil: Remove dead branches early during shader compilation Apparently spiregg can produce not-taken branches that somehow try to access textures that aren't actually declared. These branches need to be trimmed before any texture lowering is done. Part-of: --- src/microsoft/spirv_to_dxil/dxil_spirv_nir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c index 4bf617a0e0d..223b7baf3b6 100644 --- a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c +++ b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c @@ -1173,6 +1173,8 @@ dxil_spirv_nir_passes(nir_shader *nir, } NIR_PASS(progress, nir, nir_lower_vars_to_ssa); NIR_PASS(progress, nir, nir_opt_algebraic); + NIR_PASS(progress, nir, nir_opt_dead_cf); + NIR_PASS(progress, nir, nir_opt_remove_phis); } while (progress); }