aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2012-06-21 11:33:22 -0700
committerPaul Berry <[email protected]>2012-06-25 11:03:26 -0700
commitcf0e7aa9f8bc9c175ebd9b2ab3a8bfec4afc5abf (patch)
tree1ec3dfd1a40f87d8f7bc959870ff6462b3905523 /src/mesa/drivers
parent6d7ebb21f8848a4a407e458e2772a45f9c3bd28a (diff)
i965/fs: Refactor interpolation code to prepare for adding centroid support.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp23
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h2
2 files changed, 17 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 43efd68e2c4..c3f851e615c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -419,6 +419,20 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir)
return reg;
}
+fs_inst *
+fs_visitor::emit_linterp(const fs_reg &attr, const fs_reg &interp,
+ glsl_interp_qualifier interpolation_mode)
+{
+ brw_wm_barycentric_interp_mode barycoord_mode;
+ if (interpolation_mode == INTERP_QUALIFIER_SMOOTH)
+ barycoord_mode = BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC;
+ else
+ barycoord_mode = BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC;
+ return emit(FS_OPCODE_LINTERP, attr,
+ this->delta_x[barycoord_mode],
+ this->delta_y[barycoord_mode], interp);
+}
+
fs_reg *
fs_visitor::emit_general_interpolation(ir_variable *ir)
{
@@ -482,14 +496,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
emit(BRW_OPCODE_MOV, attr, fs_reg(1.0f));
} else {
struct brw_reg interp = interp_reg(location, k);
- brw_wm_barycentric_interp_mode barycoord_mode;
- if (interpolation_mode == INTERP_QUALIFIER_SMOOTH)
- barycoord_mode = BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC;
- else
- barycoord_mode = BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC;
- emit(FS_OPCODE_LINTERP, attr,
- this->delta_x[barycoord_mode],
- this->delta_y[barycoord_mode], fs_reg(interp));
+ emit_linterp(attr, fs_reg(interp), interpolation_mode);
if (intel->gen < 6) {
emit(BRW_OPCODE_MUL, attr, attr, this->pixel_w);
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 2c2cb6cbf7c..3e62d12d2af 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -542,6 +542,8 @@ public:
void emit_dummy_fs();
fs_reg *emit_fragcoord_interpolation(ir_variable *ir);
+ fs_inst *emit_linterp(const fs_reg &attr, const fs_reg &interp,
+ glsl_interp_qualifier interpolation_mode);
fs_reg *emit_frontfacing_interpolation(ir_variable *ir);
fs_reg *emit_general_interpolation(ir_variable *ir);
void emit_interpolation_setup_gen4();