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@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11044>
This commit is contained in:
Erik Faye-Lund
2021-05-27 14:42:12 +02:00
committed by Marge Bot
parent 28c842e4b7
commit fb83477a58

View File

@@ -34,7 +34,11 @@
struct ntv_context { struct ntv_context {
void *mem_ctx; 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; struct spirv_builder builder;
@@ -407,7 +411,7 @@ create_shared_block(struct ntv_context *ctx, unsigned shared_size)
SpvStorageClassWorkgroup, SpvStorageClassWorkgroup,
array); array);
ctx->shared_block_var = spirv_builder_emit_var(&ctx->builder, ptr_type, SpvStorageClassWorkgroup); 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)); assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
ctx->entry_ifaces[ctx->num_entry_ifaces++] = ctx->shared_block_var; 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) { if (var->data.mode == nir_var_mem_push_const) {
ctx->push_const_var = var_id; 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)); assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
ctx->entry_ifaces[ctx->num_entry_ifaces++] = var_id; 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); _mesa_hash_table_insert(ctx->image_vars, key, var);
emit_access_decorations(ctx, var, var_id); 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)); assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
ctx->entry_ifaces[ctx->num_entry_ifaces++] = var_id; 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]); assert(!ctx->ubos[var->data.driver_location]);
ctx->ubos[var->data.driver_location] = var_id; 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)); assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
ctx->entry_ifaces[ctx->num_entry_ifaces++] = var_id; 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 = {}; struct ntv_context ctx = {};
ctx.mem_ctx = ralloc_context(NULL); ctx.mem_ctx = ralloc_context(NULL);
ctx.builder.mem_ctx = ctx.mem_ctx; 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); ctx.glsl_types = _mesa_pointer_hash_table_create(ctx.mem_ctx);
if (!ctx.glsl_types) if (!ctx.glsl_types)