Mesa (staging/22.0): zink: avoid creating ssbo variable types with multiple runtime arrays

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 20:00:55 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: dce922af5fca86528baffeb63e6305d505a327f2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dce922af5fca86528baffeb63e6305d505a327f2

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Apr 12 09:47:03 2022 -0400

zink: avoid creating ssbo variable types with multiple runtime arrays

this is illegal

affects:
KHR-GL46.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-packed-matC

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15894>
(cherry picked from commit fcd6b2a47a9bff248a35edbeef5ae27a3ca643e0)

---

 .pick_status.json                        | 2 +-
 src/gallium/drivers/zink/zink_compiler.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index e81063ca69b..7c2e931df82 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2220,7 +2220,7 @@
         "description": "zink: avoid creating ssbo variable types with multiple runtime arrays",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": null
     },
     {
diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index 89b319a6ab6..6124b4ea03c 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -1359,12 +1359,13 @@ unbreak_bos(nir_shader *shader)
       u_foreach_bit(slot, ssbo_used) {
          char buf[64];
          snprintf(buf, sizeof(buf), "ssbo_slot_%u", slot);
-         if (ssbo_sizes[slot])
+         bool use_runtime = ssbo_sizes[slot] && max_ssbo_size;
+         if (use_runtime)
             fields[1].type = unsized;
          else
             fields[1].type = NULL;
          nir_variable *var = nir_variable_create(shader, nir_var_mem_ssbo,
-                                                 glsl_struct_type(fields, 1 + !!ssbo_sizes[slot], "struct", false), buf);
+                                                 glsl_struct_type(fields, 1 + use_runtime, "struct", false), buf);
          var->interface_type = var->type;
          var->data.driver_location = slot;
       }



More information about the mesa-commit mailing list