From c3459968cd889143929c875a225757d106642769 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 25 Jun 2019 11:45:26 +0200 Subject: [PATCH] ac/nir: unpacked GS invocation ID on GFX10+ Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/common/ac_nir_to_llvm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 57daf2a52aa..3f8625630bc 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -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) { -- 2.30.2