summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-06-25 19:40:40 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-07-05 12:33:59 +0200
commit50d4e402db819c2ad7b4138a6f801fb708284973 (patch)
treef28df2f58b033e5e3e788b6bcbf7fc8ebad2636d
parentf83b7662390315372edf6ef38cb0f3d0cdc2a169 (diff)
ac/nir,radeonsi: add and use ac_shader_abi::{ancillary,sample_coverage}
v2: update for LLVMValueRefs in ac_shader_abi
-rw-r--r--src/amd/common/ac_nir_to_llvm.c10
-rw-r--r--src/amd/common/ac_shader_abi.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c6
3 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 6ba03cfad9..0cd3590079 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -128,8 +128,6 @@ struct nir_to_llvm_context {
LLVMValueRef sample_pos_offset;
LLVMValueRef persp_sample, persp_center, persp_centroid;
LLVMValueRef linear_sample, linear_center, linear_centroid;
- LLVMValueRef ancillary;
- LLVMValueRef sample_coverage;
LLVMValueRef frag_pos[4];
LLVMTypeRef i1;
@@ -830,8 +828,8 @@ static void create_function(struct nir_to_llvm_context *ctx)
add_vgpr_argument(&args, ctx->f32, &ctx->frag_pos[2]); /* pos z float */
add_vgpr_argument(&args, ctx->f32, &ctx->frag_pos[3]); /* pos w float */
add_vgpr_argument(&args, ctx->i32, &ctx->abi.front_face); /* front face */
- add_vgpr_argument(&args, ctx->i32, &ctx->ancillary); /* ancillary */
- add_vgpr_argument(&args, ctx->i32, &ctx->sample_coverage); /* sample coverage */
+ add_vgpr_argument(&args, ctx->i32, &ctx->abi.ancillary); /* ancillary */
+ add_vgpr_argument(&args, ctx->i32, &ctx->abi.sample_coverage); /* sample coverage */
add_vgpr_argument(&args, ctx->i32, NULL); /* fixed pt */
break;
default:
@@ -3977,13 +3975,13 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
fprintf(stderr, "Unknown primitive id intrinsic: %d", ctx->stage);
break;
case nir_intrinsic_load_sample_id:
- result = unpack_param(ctx->nctx, ctx->nctx->ancillary, 8, 4);
+ result = unpack_param(ctx->nctx, ctx->abi->ancillary, 8, 4);
break;
case nir_intrinsic_load_sample_pos:
result = load_sample_pos(ctx->nctx);
break;
case nir_intrinsic_load_sample_mask_in:
- result = ctx->nctx->sample_coverage;
+ result = ctx->abi->sample_coverage;
break;
case nir_intrinsic_load_front_face:
result = ctx->abi->front_face;
diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h
index 1c8d0e8b3a..fd62f22e2b 100644
--- a/src/amd/common/ac_shader_abi.h
+++ b/src/amd/common/ac_shader_abi.h
@@ -45,6 +45,8 @@ struct ac_shader_abi {
LLVMValueRef vertex_id;
LLVMValueRef instance_id;
LLVMValueRef front_face;
+ LLVMValueRef ancillary;
+ LLVMValueRef sample_coverage;
/* For VS and PS: pre-loaded shader inputs.
*
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 71e559fe7c..7eba137947 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4519,8 +4519,10 @@ static void create_function(struct si_shader_context *ctx)
add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->i32,
&ctx->abi.front_face, SI_PARAM_FRONT_FACE);
shader->info.face_vgpr_index = 20;
- add_arg_checked(&fninfo, ARG_VGPR, ctx->i32, SI_PARAM_ANCILLARY);
- add_arg_checked(&fninfo, ARG_VGPR, ctx->f32, SI_PARAM_SAMPLE_COVERAGE);
+ add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->i32,
+ &ctx->abi.ancillary, SI_PARAM_ANCILLARY);
+ add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->f32,
+ &ctx->abi.sample_coverage, SI_PARAM_SAMPLE_COVERAGE);
add_arg_checked(&fninfo, ARG_VGPR, ctx->i32, SI_PARAM_POS_FIXED_PT);
/* Color inputs from the prolog. */