diff options
author | Timothy Arceri <[email protected]> | 2017-11-09 15:23:23 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-11-16 10:54:03 +1100 |
commit | b73ce64fb8d71dd4cecaa9548a9bc4ba110c24e8 (patch) | |
tree | 90847efbb13d3d9f1d23522e8186885b0106f203 /src/amd/common | |
parent | 8ae92a9209028f5fbd2abae26b5e11047c359407 (diff) |
ac: add gs_{prim,invocation}_id to the abi
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 16 | ||||
-rw-r--r-- | src/amd/common/ac_shader_abi.h | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 3d9f613d93b..1ecdeca063c 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -122,7 +122,6 @@ struct nir_to_llvm_context { LLVMValueRef gs2vs_offset; LLVMValueRef gs_wave_id; LLVMValueRef gs_vtx_offset[6]; - LLVMValueRef gs_prim_id, gs_invocation_id; LLVMValueRef esgs_ring; LLVMValueRef gsvs_ring; @@ -826,8 +825,8 @@ static void create_function(struct nir_to_llvm_context *ctx, add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[0]); // vtx01 add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[2]); // vtx23 - add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_prim_id); // prim id - add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_invocation_id); + add_vgpr_argument(&args, ctx->ac.i32, &ctx->abi.gs_prim_id); // prim id + add_vgpr_argument(&args, ctx->ac.i32, &ctx->abi.gs_invocation_id); add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[4]); if (previous_stage == MESA_SHADER_VERTEX) { @@ -852,12 +851,12 @@ static void create_function(struct nir_to_llvm_context *ctx, add_sgpr_argument(&args, ctx->ac.i32, &ctx->gs_wave_id); // wave id add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[0]); // vtx0 add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[1]); // vtx1 - add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_prim_id); // prim id + add_vgpr_argument(&args, ctx->ac.i32, &ctx->abi.gs_prim_id); // prim id add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[2]); add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[3]); add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[4]); add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_vtx_offset[5]); - add_vgpr_argument(&args, ctx->ac.i32, &ctx->gs_invocation_id); + add_vgpr_argument(&args, ctx->ac.i32, &ctx->abi.gs_invocation_id); } break; case MESA_SHADER_FRAGMENT: @@ -4058,12 +4057,13 @@ static void visit_intrinsic(struct ac_nir_context *ctx, if (ctx->stage == MESA_SHADER_TESS_CTRL) result = unpack_param(&ctx->ac, ctx->nctx->tcs_rel_ids, 8, 5); else - result = ctx->nctx->gs_invocation_id; + result = ctx->abi->gs_invocation_id; break; case nir_intrinsic_load_primitive_id: if (ctx->stage == MESA_SHADER_GEOMETRY) { - ctx->nctx->shader_info->gs.uses_prim_id = true; - result = ctx->nctx->gs_prim_id; + if (ctx->nctx) + ctx->nctx->shader_info->gs.uses_prim_id = true; + result = ctx->abi->gs_prim_id; } else if (ctx->stage == MESA_SHADER_TESS_CTRL) { ctx->nctx->shader_info->tcs.uses_prim_id = true; result = ctx->nctx->tcs_patch_id; diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h index 27586d0212f..56209bd9175 100644 --- a/src/amd/common/ac_shader_abi.h +++ b/src/amd/common/ac_shader_abi.h @@ -42,6 +42,8 @@ struct ac_shader_abi { LLVMValueRef draw_id; LLVMValueRef vertex_id; LLVMValueRef instance_id; + LLVMValueRef gs_prim_id; + LLVMValueRef gs_invocation_id; LLVMValueRef frag_pos[4]; LLVMValueRef front_face; LLVMValueRef ancillary; |