From a50d069d1ce8e105be6359fbde7568d049891488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 19 Dec 2024 02:45:15 -0500 Subject: [PATCH] nir/opt_varyings: clear info->clip/cull_distance_array_size if relocated svga breaks if shader_info declares these, but the shader is missing the outputs. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_opt_varyings.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compiler/nir/nir_opt_varyings.c b/src/compiler/nir/nir_opt_varyings.c index 77aad75abdc..36ec8cf9622 100644 --- a/src/compiler/nir/nir_opt_varyings.c +++ b/src/compiler/nir/nir_opt_varyings.c @@ -5301,6 +5301,14 @@ nir_opt_varyings(nir_shader *producer, nir_shader *consumer, bool spirv, free_linkage(linkage); FREE(linkage); + /* Compaction moves CLIP_DIST and CULL_DIST outputs to VARn if the next + * shader is not FS. Clear those fields in shader_info. + */ + if (consumer->info.stage <= MESA_SHADER_GEOMETRY) { + producer->info.clip_distance_array_size = 0; + producer->info.cull_distance_array_size = 0; + } + if (progress & nir_progress_producer) nir_validate_shader(producer, "nir_opt_varyings"); if (progress & nir_progress_consumer)