mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-21 00:00:22 +01:00
zink: add helper for vec-type input variables in ntv
we'll see a lot of reuse of this type of thing, so we can avoid duplicating it later Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7192>
This commit is contained in:
parent
7c5129985b
commit
441b32bf3f
1 changed files with 31 additions and 0 deletions
|
|
@ -1664,6 +1664,37 @@ emit_load_uint_input(struct ntv_context *ctx, nir_intrinsic_instr *intr, SpvId *
|
|||
store_dest(ctx, &intr->dest, result, nir_type_uint);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_load_vec_input(struct ntv_context *ctx, nir_intrinsic_instr *intr, SpvId *var_id, const char *var_name, SpvBuiltIn builtin, nir_alu_type type)
|
||||
{
|
||||
SpvId var_type;
|
||||
|
||||
switch (type) {
|
||||
case nir_type_bool:
|
||||
var_type = get_bvec_type(ctx, nir_dest_num_components(intr->dest));
|
||||
break;
|
||||
case nir_type_int:
|
||||
var_type = get_ivec_type(ctx, nir_dest_bit_size(intr->dest), nir_dest_num_components(intr->dest));
|
||||
break;
|
||||
case nir_type_uint:
|
||||
var_type = get_uvec_type(ctx, nir_dest_bit_size(intr->dest), nir_dest_num_components(intr->dest));
|
||||
break;
|
||||
case nir_type_float:
|
||||
var_type = get_fvec_type(ctx, nir_dest_bit_size(intr->dest), nir_dest_num_components(intr->dest));
|
||||
break;
|
||||
default:
|
||||
unreachable("unknown type passed");
|
||||
}
|
||||
if (!*var_id)
|
||||
*var_id = create_builtin_var(ctx, var_type,
|
||||
SpvStorageClassInput,
|
||||
var_name,
|
||||
builtin);
|
||||
|
||||
SpvId result = spirv_builder_emit_load(&ctx->builder, var_type, *var_id);
|
||||
store_dest(ctx, &intr->dest, result, type);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue