Module: Mesa
Branch: staging/20.0
Commit: 5e1403722710ec29b0d82bf6e79456cfaea76323
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e1403722710ec29b0d82bf6e79456cfaea76323

Author: Marek Olšák <[email protected]>
Date:   Fri Mar 13 17:54:35 2020 -0400

nir: fix clip/cull_distance_array_size in nir_lower_clip_cull_distance_arrays

This fixes a GPU hang on radeonsi.

It only works if optimizations have already been run.

Cc: 19.3 20.0 <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Tested-by: Marge Bot 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4194>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4194>
(cherry picked from commit 3c03718fd7813b9023c286101d4f972aa3390de9)

---

 .pick_status.json                                      |  2 +-
 src/compiler/nir/nir_lower_clip_cull_distance_arrays.c | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 29f4f2fa5d6..de648b8c7f2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -40,7 +40,7 @@
         "description": "nir: fix clip/cull_distance_array_size in 
nir_lower_clip_cull_distance_arrays",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
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 */

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to