summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeon/SIInstructions.td18
-rw-r--r--src/gallium/drivers/radeon/SIIntrinsics.td3
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_shader.c21
3 files changed, 38 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeon/SIInstructions.td b/src/gallium/drivers/radeon/SIInstructions.td
index 57bbc7a5d5a..313728f044f 100644
--- a/src/gallium/drivers/radeon/SIInstructions.td
+++ b/src/gallium/drivers/radeon/SIInstructions.td
@@ -934,6 +934,24 @@ def : Pat <
imm:$attr, SReg_32:$params)
>;
+def : Pat <
+ (int_SI_fs_interp_linear_centroid imm:$attr_chan, imm:$attr, SReg_32:$params),
+ (SI_INTERP (f32 LINEAR_CENTROID_I), (f32 LINEAR_CENTROID_J), imm:$attr_chan,
+ imm:$attr, SReg_32:$params)
+>;
+
+def : Pat <
+ (int_SI_fs_interp_persp_center imm:$attr_chan, imm:$attr, SReg_32:$params),
+ (SI_INTERP (f32 PERSP_CENTER_I), (f32 PERSP_CENTER_J), imm:$attr_chan,
+ imm:$attr, SReg_32:$params)
+>;
+
+def : Pat <
+ (int_SI_fs_interp_persp_centroid imm:$attr_chan, imm:$attr, SReg_32:$params),
+ (SI_INTERP (f32 PERSP_CENTROID_I), (f32 PERSP_CENTROID_J), imm:$attr_chan,
+ imm:$attr, SReg_32:$params)
+>;
+
/********** ================== **********/
/********** Intrinsic Patterns **********/
/********** ================== **********/
diff --git a/src/gallium/drivers/radeon/SIIntrinsics.td b/src/gallium/drivers/radeon/SIIntrinsics.td
index 4d23072d4f1..4e718355428 100644
--- a/src/gallium/drivers/radeon/SIIntrinsics.td
+++ b/src/gallium/drivers/radeon/SIIntrinsics.td
@@ -30,5 +30,8 @@ let TargetPrefix = "SI", isTarget = 1 in {
class Interp : Intrinsic <[llvm_float_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
def int_SI_fs_interp_linear_center : Interp;
+ def int_SI_fs_interp_linear_centroid : Interp;
+ def int_SI_fs_interp_persp_center : Interp;
+ def int_SI_fs_interp_persp_centroid : Interp;
def int_SI_fs_interp_constant : Interp;
}
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 0e1a97bba3e..396b94ad357 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -201,16 +201,29 @@ static void declare_input_fs(
/* XXX: Handle all possible interpolation modes */
switch (decl->Interp.Interpolate) {
case TGSI_INTERPOLATE_COLOR:
- if (si_shader_ctx->rctx->rasterizer->flatshade)
+ if (si_shader_ctx->rctx->rasterizer->flatshade) {
intr_name = "llvm.SI.fs.interp.constant";
- else
- intr_name = "llvm.SI.fs.interp.linear.center";
+ } else {
+ if (decl->Interp.Centroid)
+ intr_name = "llvm.SI.fs.interp.persp.centroid";
+ else
+ intr_name = "llvm.SI.fs.interp.persp.center";
+ }
break;
case TGSI_INTERPOLATE_CONSTANT:
intr_name = "llvm.SI.fs.interp.constant";
break;
case TGSI_INTERPOLATE_LINEAR:
- intr_name = "llvm.SI.fs.interp.linear.center";
+ if (decl->Interp.Centroid)
+ intr_name = "llvm.SI.fs.interp.linear.centroid";
+ else
+ intr_name = "llvm.SI.fs.interp.linear.center";
+ break;
+ case TGSI_INTERPOLATE_PERSPECTIVE:
+ if (decl->Interp.Centroid)
+ intr_name = "llvm.SI.fs.interp.persp.centroid";
+ else
+ intr_name = "llvm.SI.fs.interp.persp.center";
break;
default:
fprintf(stderr, "Warning: Unhandled interpolation mode.\n");