aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/zink
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2020-01-30 20:35:04 +0100
committerMarge Bot <[email protected]>2020-01-31 08:40:24 +0000
commitf12b844e7c284f691323d4f77f2fd94c648e37e0 (patch)
tree4589598c5b65996f00dc89fc20b688098a17380a /src/gallium/drivers/zink
parentc0ced1e79b3311cf55f3c8852417825e3fe102ef (diff)
zink: implement load_instance_id
Reviewed-by: Dave Airlie <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3644> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3644>
Diffstat (limited to 'src/gallium/drivers/zink')
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c22
-rw-r--r--src/gallium/drivers/zink/zink_screen.c3
2 files changed, 22 insertions, 3 deletions
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
@@ -1314,6 +1314,22 @@ emit_load_front_face(struct ntv_context *ctx, nir_intrinsic_instr *intr)
}
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)
{
SpvId var_type = spirv_builder_type_uint(&ctx->builder, 32);
@@ -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;