From 05cca7eb3661ba3d268e9acdf17957512bc1f347 Mon Sep 17 00:00:00 2001 From: Aitor Camacho Date: Mon, 9 Feb 2026 18:56:15 +0900 Subject: [PATCH] kk: Fix crash in PositiveShaderImageAccess.UndefImage Clean sample instructions that have an undef texture as a source Reviewed-by: Arcady Goldmints-Orlov Signed-off-by: Aitor Camacho Part-of: --- src/kosmickrisp/compiler/nir_to_msl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/kosmickrisp/compiler/nir_to_msl.c b/src/kosmickrisp/compiler/nir_to_msl.c index 2c96d06820c..ca7ec127d5b 100644 --- a/src/kosmickrisp/compiler/nir_to_msl.c +++ b/src/kosmickrisp/compiler/nir_to_msl.c @@ -1969,6 +1969,11 @@ msl_preprocess_nir(struct nir_shader *nir) * generate discards. */ NIR_PASS(_, nir, nir_lower_system_values); + /* nir_lower_vars_to_ssa may remove instructions due to undef values such as + * store from an undef image sample. Fixes VVL test + * PositiveShaderImageAccess.UndefImage */ + NIR_PASS(_, nir, nir_opt_dce); + if (nir->info.stage == MESA_SHADER_FRAGMENT) { nir_input_attachment_options input_attachment_options = {}; NIR_PASS(_, nir, nir_lower_input_attachments, &input_attachment_options);