mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
zink: handle struct derefs in ntv
Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8142>
This commit is contained in:
parent
d4748913fc
commit
02fd562e65
1 changed files with 26 additions and 0 deletions
|
|
@ -2177,6 +2177,28 @@ emit_deref_array(struct ntv_context *ctx, nir_deref_instr *deref)
|
|||
store_dest(ctx, &deref->dest, result, nir_type_uint);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_deref_struct(struct ntv_context *ctx, nir_deref_instr *deref)
|
||||
{
|
||||
assert(deref->deref_type == nir_deref_type_struct);
|
||||
nir_variable *var = nir_deref_instr_get_variable(deref);
|
||||
|
||||
SpvStorageClass storage_class = get_storage_class(var);
|
||||
|
||||
SpvId index = emit_uint_const(ctx, 32, deref->strct.index);
|
||||
|
||||
SpvId ptr_type = spirv_builder_type_pointer(&ctx->builder,
|
||||
storage_class,
|
||||
get_glsl_type(ctx, deref->type));
|
||||
|
||||
SpvId result = spirv_builder_emit_access_chain(&ctx->builder,
|
||||
ptr_type,
|
||||
get_src(ctx, &deref->parent),
|
||||
&index, 1);
|
||||
/* uint is a bit of a lie here, it's really just an opaque type */
|
||||
store_dest(ctx, &deref->dest, result, nir_type_uint);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_deref(struct ntv_context *ctx, nir_deref_instr *deref)
|
||||
{
|
||||
|
|
@ -2189,6 +2211,10 @@ emit_deref(struct ntv_context *ctx, nir_deref_instr *deref)
|
|||
emit_deref_array(ctx, deref);
|
||||
break;
|
||||
|
||||
case nir_deref_type_struct:
|
||||
emit_deref_struct(ctx, deref);
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("unexpected deref_type");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue