radv/ac: handle invocation and primitive id intrinsics
authorDave Airlie <airlied@redhat.com>
Thu, 19 Jan 2017 04:54:18 +0000 (14:54 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 30 Jan 2017 23:29:55 +0000 (09:29 +1000)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c

index 340681fa71452ddd0097072b745091f80b3cd2c3..bf42ed67db8e146ee5947eafc9d88383327e4227 100644 (file)
@@ -3083,6 +3083,15 @@ static void visit_intrinsic(struct nir_to_llvm_context *ctx,
        case nir_intrinsic_load_base_instance:
                result = ctx->start_instance;
                break;
+       case nir_intrinsic_load_invocation_id:
+               result = ctx->gs_invocation_id;
+               break;
+       case nir_intrinsic_load_primitive_id:
+               if (ctx->stage == MESA_SHADER_GEOMETRY)
+                       result = ctx->gs_prim_id;
+               else
+                       fprintf(stderr, "Unknown primitive id intrinsic: %d", ctx->stage);
+               break;
        case nir_intrinsic_load_sample_id:
                ctx->shader_info->fs.force_persample = true;
                result = unpack_param(ctx, ctx->ancillary, 8, 4);