mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
zink: implement load_instance_id
Reviewed-by: Dave Airlie <airlied@redhat.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3644> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3644>
This commit is contained in:
parent
c0ced1e79b
commit
f12b844e7c
2 changed files with 22 additions and 3 deletions
|
|
@ -57,7 +57,7 @@ struct ntv_context {
|
|||
bool block_started;
|
||||
SpvId loop_break, loop_cont;
|
||||
|
||||
SpvId front_face_var, vertex_id_var;
|
||||
SpvId front_face_var, instance_id_var, vertex_id_var;
|
||||
};
|
||||
|
||||
static SpvId
|
||||
|
|
@ -1313,6 +1313,22 @@ emit_load_front_face(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
|||
store_dest_uint(ctx, &intr->dest, result);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_load_instance_id(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
||||
{
|
||||
SpvId var_type = spirv_builder_type_uint(&ctx->builder, 32);
|
||||
if (!ctx->instance_id_var)
|
||||
ctx->instance_id_var = create_builtin_var(ctx, var_type,
|
||||
SpvStorageClassInput,
|
||||
"gl_InstanceId",
|
||||
SpvBuiltInInstanceIndex);
|
||||
|
||||
SpvId result = spirv_builder_emit_load(&ctx->builder, var_type,
|
||||
ctx->instance_id_var);
|
||||
assert(1 == nir_dest_num_components(intr->dest));
|
||||
store_dest_uint(ctx, &intr->dest, result);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_load_vertex_id(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
||||
{
|
||||
|
|
@ -1353,6 +1369,10 @@ emit_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr)
|
|||
emit_load_front_face(ctx, intr);
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_instance_id:
|
||||
emit_load_instance_id(ctx, intr);
|
||||
break;
|
||||
|
||||
case nir_intrinsic_load_vertex_id:
|
||||
emit_load_vertex_id(ctx, intr);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -139,9 +139,8 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
|||
return 0;
|
||||
#endif
|
||||
|
||||
case PIPE_CAP_TGSI_INSTANCEID:
|
||||
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_SEAMLESS_CUBE_MAP:
|
||||
return 1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue