Mesa (main): zink: rename spirv_15 bool to spirv_1_4_interfaces

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 7 12:12:42 UTC 2021


Module: Mesa
Branch: main
Commit: fb83477a588b084375579d99d928627710c0f096
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb83477a588b084375579d99d928627710c0f096

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Thu May 27 14:42:12 2021 +0200

zink: rename spirv_15 bool to spirv_1_4_interfaces

To make it a bit easier to follow what's going on here, rename the
"spirv_15" boolean to "spirv_1_4_interfaces", and add a comment about
what it's all about.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11044>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 6e267f5363f..e5c0399a08e 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -34,7 +34,11 @@
 
 struct ntv_context {
    void *mem_ctx;
-   bool spirv_15;
+
+   /* SPIR-V 1.4 and later requires entrypoints to list all global
+    * variables in the interface.
+    */
+   bool spirv_1_4_interfaces;
 
    struct spirv_builder builder;
 
@@ -407,7 +411,7 @@ create_shared_block(struct ntv_context *ctx, unsigned shared_size)
                                                SpvStorageClassWorkgroup,
                                                array);
    ctx->shared_block_var = spirv_builder_emit_var(&ctx->builder, ptr_type, SpvStorageClassWorkgroup);
-   if (ctx->spirv_15) {
+   if (ctx->spirv_1_4_interfaces) {
       assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
       ctx->entry_ifaces[ctx->num_entry_ifaces++] = ctx->shared_block_var;
    }
@@ -436,7 +440,7 @@ input_var_init(struct ntv_context *ctx, struct nir_variable *var)
    if (var->data.mode == nir_var_mem_push_const) {
       ctx->push_const_var = var_id;
 
-      if (ctx->spirv_15) {
+      if (ctx->spirv_1_4_interfaces) {
          assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
          ctx->entry_ifaces[ctx->num_entry_ifaces++] = var_id;
       }
@@ -836,7 +840,7 @@ emit_image(struct ntv_context *ctx, struct nir_variable *var)
       _mesa_hash_table_insert(ctx->image_vars, key, var);
       emit_access_decorations(ctx, var, var_id);
    }
-   if (ctx->spirv_15) {
+   if (ctx->spirv_1_4_interfaces) {
       assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
       ctx->entry_ifaces[ctx->num_entry_ifaces++] = var_id;
    }
@@ -928,7 +932,7 @@ emit_bo(struct ntv_context *ctx, struct nir_variable *var)
       assert(!ctx->ubos[var->data.driver_location]);
       ctx->ubos[var->data.driver_location] = var_id;
    }
-   if (ctx->spirv_15) {
+   if (ctx->spirv_1_4_interfaces) {
       assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
       ctx->entry_ifaces[ctx->num_entry_ifaces++] = var_id;
    }
@@ -3555,7 +3559,7 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, bool spir
    struct ntv_context ctx = {};
    ctx.mem_ctx = ralloc_context(NULL);
    ctx.builder.mem_ctx = ctx.mem_ctx;
-   ctx.spirv_15 = spirv_15;
+   ctx.spirv_1_4_interfaces = spirv_15;
 
    ctx.glsl_types = _mesa_pointer_hash_table_create(ctx.mem_ctx);
    if (!ctx.glsl_types)



More information about the mesa-commit mailing list