aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
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/gallium/drivers
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/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c18
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c18
2 files changed, 19 insertions, 17 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index c0c45b0bae6..171c1393aef 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4904,13 +4904,19 @@ static void create_function(struct si_shader_context *ctx)
add_arg_assign_checked(&fninfo, ARG_SGPR, ctx->i32,
&ctx->abi.prim_mask, SI_PARAM_PRIM_MASK);
- add_arg_checked(&fninfo, ARG_VGPR, ctx->v2i32, SI_PARAM_PERSP_SAMPLE);
- add_arg_checked(&fninfo, ARG_VGPR, ctx->v2i32, SI_PARAM_PERSP_CENTER);
- add_arg_checked(&fninfo, ARG_VGPR, ctx->v2i32, SI_PARAM_PERSP_CENTROID);
+ add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->v2i32,
+ &ctx->abi.persp_sample, SI_PARAM_PERSP_SAMPLE);
+ add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->v2i32,
+ &ctx->abi.persp_center, SI_PARAM_PERSP_CENTER);
+ add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->v2i32,
+ &ctx->abi.persp_centroid, SI_PARAM_PERSP_CENTROID);
add_arg_checked(&fninfo, ARG_VGPR, v3i32, SI_PARAM_PERSP_PULL_MODEL);
- add_arg_checked(&fninfo, ARG_VGPR, ctx->v2i32, SI_PARAM_LINEAR_SAMPLE);
- add_arg_checked(&fninfo, ARG_VGPR, ctx->v2i32, SI_PARAM_LINEAR_CENTER);
- add_arg_checked(&fninfo, ARG_VGPR, ctx->v2i32, SI_PARAM_LINEAR_CENTROID);
+ add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->v2i32,
+ &ctx->abi.linear_sample, SI_PARAM_LINEAR_SAMPLE);
+ add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->v2i32,
+ &ctx->abi.linear_center, SI_PARAM_LINEAR_CENTER);
+ add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->v2i32,
+ &ctx->abi.linear_centroid, SI_PARAM_LINEAR_CENTROID);
add_arg_checked(&fninfo, ARG_VGPR, ctx->f32, SI_PARAM_LINE_STIPPLE_TEX);
add_arg_assign_checked(&fninfo, ARG_VGPR, ctx->f32,
&ctx->abi.frag_pos[0], SI_PARAM_POS_X_FLOAT);
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 21de12a043f..eeb27b66873 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -1088,7 +1088,6 @@ si_nir_lookup_interp_param(struct ac_shader_abi *abi,
enum glsl_interp_mode interp, unsigned location)
{
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
- int interp_param_idx = -1;
switch (interp) {
case INTERP_MODE_FLAT:
@@ -1096,27 +1095,24 @@ si_nir_lookup_interp_param(struct ac_shader_abi *abi,
case INTERP_MODE_SMOOTH:
case INTERP_MODE_NONE:
if (location == INTERP_CENTER)
- interp_param_idx = SI_PARAM_PERSP_CENTER;
+ return ctx->abi.persp_center;
else if (location == INTERP_CENTROID)
- interp_param_idx = SI_PARAM_PERSP_CENTROID;
+ return ctx->abi.persp_centroid;
else if (location == INTERP_SAMPLE)
- interp_param_idx = SI_PARAM_PERSP_SAMPLE;
+ return ctx->abi.persp_sample;
break;
case INTERP_MODE_NOPERSPECTIVE:
if (location == INTERP_CENTER)
- interp_param_idx = SI_PARAM_LINEAR_CENTER;
+ return ctx->abi.linear_center;
else if (location == INTERP_CENTROID)
- interp_param_idx = SI_PARAM_LINEAR_CENTROID;
+ return ctx->abi.linear_centroid;
else if (location == INTERP_SAMPLE)
- interp_param_idx = SI_PARAM_LINEAR_SAMPLE;
+ return ctx->abi.linear_sample;
break;
default:
assert(!"Unhandled interpolation mode.");
- return NULL;
}
-
- return interp_param_idx != -1 ?
- LLVMGetParam(ctx->main_fn, interp_param_idx) : NULL;
+ return NULL;
}
static LLVMValueRef