summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-07-31 09:54:48 +0200
committerSamuel Pitoiset <[email protected]>2019-08-30 08:23:54 +0200
commita63719db6ab07417fe2eb90fb041bc4b807bab18 (patch)
treea20ff1d2b526a8938f9ca01ac2defbb77fb238ee /src/amd
parent8be51061eca39a766f5304198dc6f42296232b22 (diff)
ac: import linear/perspective PS input parameters from radv/radeonsi
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/common/ac_shader_abi.h9
-rw-r--r--src/amd/vulkan/radv_nir_to_llvm.c31
2 files changed, 23 insertions, 17 deletions
diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h
index ef628c1ff10..935355fbffa 100644
--- a/src/amd/common/ac_shader_abi.h
+++ b/src/amd/common/ac_shader_abi.h
@@ -58,6 +58,8 @@ struct ac_shader_abi {
LLVMValueRef tes_patch_id;
LLVMValueRef gs_prim_id;
LLVMValueRef gs_invocation_id;
+
+ /* PS */
LLVMValueRef frag_pos[4];
LLVMValueRef front_face;
LLVMValueRef ancillary;
@@ -66,6 +68,13 @@ struct ac_shader_abi {
LLVMValueRef color0;
LLVMValueRef color1;
LLVMValueRef user_data;
+ LLVMValueRef persp_sample;
+ LLVMValueRef persp_center;
+ LLVMValueRef persp_centroid;
+ LLVMValueRef linear_sample;
+ LLVMValueRef linear_center;
+ LLVMValueRef linear_centroid;
+
/* CS */
LLVMValueRef local_invocation_ids;
LLVMValueRef num_work_groups;
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index fbfe12da562..94d51b31b81 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -86,9 +86,6 @@ struct radv_shader_context {
LLVMValueRef hs_ring_tess_offchip;
LLVMValueRef hs_ring_tess_factor;
- LLVMValueRef persp_sample, persp_center, persp_centroid;
- LLVMValueRef linear_sample, linear_center, linear_centroid;
-
/* Streamout */
LLVMValueRef streamout_buffers;
LLVMValueRef streamout_write_idx;
@@ -1232,13 +1229,13 @@ static void create_function(struct radv_shader_context *ctx,
&desc_sets);
add_arg(&args, ARG_SGPR, ctx->ac.i32, &ctx->abi.prim_mask);
- add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->persp_sample);
- add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->persp_center);
- add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->persp_centroid);
+ add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->abi.persp_sample);
+ add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->abi.persp_center);
+ add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->abi.persp_centroid);
add_arg(&args, ARG_VGPR, ctx->ac.v3i32, NULL); /* persp pull model */
- add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->linear_sample);
- add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->linear_center);
- add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->linear_centroid);
+ add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->abi.linear_sample);
+ add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->abi.linear_center);
+ add_arg(&args, ARG_VGPR, ctx->ac.v2i32, &ctx->abi.linear_centroid);
add_arg(&args, ARG_VGPR, ctx->ac.f32, NULL); /* line stipple tex */
add_arg(&args, ARG_VGPR, ctx->ac.f32, &ctx->abi.frag_pos[0]);
add_arg(&args, ARG_VGPR, ctx->ac.f32, &ctx->abi.frag_pos[1]);
@@ -1774,19 +1771,19 @@ static LLVMValueRef lookup_interp_param(struct ac_shader_abi *abi,
case INTERP_MODE_SMOOTH:
case INTERP_MODE_NONE:
if (location == INTERP_CENTER)
- return ctx->persp_center;
+ return ctx->abi.persp_center;
else if (location == INTERP_CENTROID)
- return ctx->persp_centroid;
+ return ctx->abi.persp_centroid;
else if (location == INTERP_SAMPLE)
- return ctx->persp_sample;
+ return ctx->abi.persp_sample;
break;
case INTERP_MODE_NOPERSPECTIVE:
if (location == INTERP_CENTER)
- return ctx->linear_center;
+ return ctx->abi.linear_center;
else if (location == INTERP_CENTROID)
- return ctx->linear_centroid;
+ return ctx->abi.linear_centroid;
else if (location == INTERP_SAMPLE)
- return ctx->linear_sample;
+ return ctx->abi.linear_sample;
break;
}
return NULL;
@@ -2382,8 +2379,8 @@ prepare_interp_optimize(struct radv_shader_context *ctx,
if (uses_center && uses_centroid) {
LLVMValueRef sel = LLVMBuildICmp(ctx->ac.builder, LLVMIntSLT, ctx->abi.prim_mask, ctx->ac.i32_0, "");
- ctx->persp_centroid = LLVMBuildSelect(ctx->ac.builder, sel, ctx->persp_center, ctx->persp_centroid, "");
- ctx->linear_centroid = LLVMBuildSelect(ctx->ac.builder, sel, ctx->linear_center, ctx->linear_centroid, "");
+ ctx->abi.persp_centroid = LLVMBuildSelect(ctx->ac.builder, sel, ctx->abi.persp_center, ctx->abi.persp_centroid, "");
+ ctx->abi.linear_centroid = LLVMBuildSelect(ctx->ac.builder, sel, ctx->abi.linear_center, ctx->abi.linear_centroid, "");
}
}