zink: emit vars with nir_var_shader_temp mode

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19117>
This commit is contained in:
Erik Faye-Lund 2022-10-26 15:38:03 +02:00 committed by Marge Bot
parent 4b17c099ca
commit 85964945e7

View file

@ -779,6 +779,25 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var)
ctx->entry_ifaces[ctx->num_entry_ifaces++] = var_id;
}
static void
emit_shader_temp(struct ntv_context *ctx, struct nir_variable *var)
{
SpvId var_type = get_glsl_type(ctx, var->type);
SpvId pointer_type = spirv_builder_type_pointer(&ctx->builder,
SpvStorageClassPrivate,
var_type);
SpvId var_id = spirv_builder_emit_var(&ctx->builder, pointer_type,
SpvStorageClassPrivate);
if (var->name)
spirv_builder_emit_name(&ctx->builder, var_id, var->name);
_mesa_hash_table_insert(ctx->vars, var, (void *)(intptr_t)var_id);
assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
ctx->entry_ifaces[ctx->num_entry_ifaces++] = var_id;
}
static void
emit_temp(struct ntv_context *ctx, struct nir_variable *var)
{
@ -4730,6 +4749,9 @@ nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, uint32_
ctx.regs[reg->index] = var;
}
nir_foreach_variable_with_modes(var, s, nir_var_shader_temp)
emit_shader_temp(&ctx, var);
nir_foreach_function_temp_variable(var, entry)
emit_temp(&ctx, var);