ac/nir: unpacked GS invocation ID on GFX10+
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 25 Jun 2019 09:45:26 +0000 (11:45 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 7 Jul 2019 15:03:38 +0000 (17:03 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_nir_to_llvm.c

index 57daf2a52aab054888564107040e3fe4a534cb85..3f8625630bc13cd8e8750f7a0ebd352f711efeff 100644 (file)
@@ -3158,10 +3158,17 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
                result = ctx->abi->view_index;
                break;
        case nir_intrinsic_load_invocation_id:
-               if (ctx->stage == MESA_SHADER_TESS_CTRL)
+               if (ctx->stage == MESA_SHADER_TESS_CTRL) {
                        result = ac_unpack_param(&ctx->ac, ctx->abi->tcs_rel_ids, 8, 5);
-               else
-                       result = ctx->abi->gs_invocation_id;
+               } else {
+                       if (ctx->ac.chip_class >= GFX10) {
+                               result = LLVMBuildAnd(ctx->ac.builder,
+                                                     ctx->abi->gs_invocation_id,
+                                                     LLVMConstInt(ctx->ac.i32, 127, 0), "");
+                       } else {
+                               result = ctx->abi->gs_invocation_id;
+                       }
+               }
                break;
        case nir_intrinsic_load_primitive_id:
                if (ctx->stage == MESA_SHADER_GEOMETRY) {