From effee24951ddf1f7fee45e85e5163c86e4bfa79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Mon, 13 Feb 2023 10:23:37 +0200 Subject: [PATCH] spirv: add workaround for Metro Exodus in spirv_to_nir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is commit 4397c166c01 for spirv_to_nir, otherwise we hit the same assert with anv driver. Signed-off-by: Tapani Pälli Reviewed-by: Konstantin Seurer Reviewed-by: Lionel Landwerlin Reviewed-by: Faith Ekstrand Part-of: --- src/compiler/spirv/spirv_to_nir.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index d06c1a1b4da..802936fd6ce 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -6797,6 +6797,15 @@ spirv_to_nir(const uint32_t *words, size_t word_count, } } + /* Work around applications that declare shader_call_data variables inside + * ray generation shaders. + * + * https://gitlab.freedesktop.org/mesa/mesa/-/issues/5326 + */ + if (stage == MESA_SHADER_RAYGEN) + NIR_PASS(_, b->shader, nir_remove_dead_variables, nir_var_shader_call_data, + NULL); + /* Unparent the shader from the vtn_builder before we delete the builder */ ralloc_steal(NULL, b->shader);