From: Erik Faye-Lund Date: Thu, 30 Jan 2020 19:35:04 +0000 (+0100) Subject: zink: implement load_instance_id X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f12b844e7c284f691323d4f77f2fd94c648e37e0;p=mesa.git zink: implement load_instance_id Reviewed-by: Dave Airlie Tested-by: Marge Bot Part-of: --- diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index 6d2d713b7f9..34bb14379c4 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index d0a29609881..9e29a51862a 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -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;