From 3c03718fd7813b9023c286101d4f972aa3390de9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 13 Mar 2020 17:54:35 -0400 Subject: [PATCH] nir: fix clip/cull_distance_array_size in nir_lower_clip_cull_distance_arrays MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes a GPU hang on radeonsi. It only works if optimizations have already been run. Cc: 19.3 20.0 Reviewed-by: Tapani Pälli Tested-by: Marge Bot Part-of: --- .../nir/nir_lower_clip_cull_distance_arrays.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c index 70578d6f3fd..7587bb26e09 100644 --- a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c +++ b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c @@ -72,8 +72,17 @@ combine_clip_cull(nir_shader *nir, cull = var; } - if (!cull && !clip) + if (!cull && !clip) { + /* If this is run after optimizations and the variables have been + * eliminated, we should update the shader info, because no other + * place does that. + */ + if (store_info) { + nir->info.clip_distance_array_size = 0; + nir->info.cull_distance_array_size = 0; + } return false; + } if (!cull && clip) { /* The GLSL IR lowering pass must have converted these to vectors */ -- 2.30.2