Handle perspective interpolation and ceontroid vs. center.
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 **********/
/********** ================== **********/
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;
}
/* 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");