diff options
author | Kenneth Graunke <[email protected]> | 2016-07-11 17:19:06 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-07-15 17:16:54 -0700 |
commit | f05770121fb165b28b06af9c502dd21300dee530 (patch) | |
tree | 2f98e76b61444bbcb6984d3ce06f3dec4a8aaf2b | |
parent | 203243f5ffe438c7f7b5f92d8bc177b76880bf5b (diff) |
i965: Remove the emit_linterp() helper.
Rather than computing the barycentric mode each time we emit a LINTERP,
we can simply compute it once, as soon as we know we're doing non-flat
interpolation.
At that point, emit_linterp() doesn't do much, so fold it into the
call sites and drop it.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 3 |
2 files changed, 8 insertions, 21 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 1f6ff59d13b..d4e5e86e465 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1104,18 +1104,6 @@ centroid_to_pixel(enum brw_barycentric_mode bary) return (enum brw_barycentric_mode) ((unsigned) bary - 1); } -fs_inst * -fs_visitor::emit_linterp(const fs_reg &attr, const fs_reg &interp, - glsl_interp_qualifier interpolation_mode, - bool is_centroid, bool is_sample) -{ - brw_barycentric_mode barycoord_mode = - barycentric_mode(interpolation_mode, is_centroid, is_sample); - - return bld.emit(FS_OPCODE_LINTERP, attr, - this->delta_xy[barycoord_mode], interp); -} - void fs_visitor::emit_general_interpolation(fs_reg *attr, const char *name, const glsl_type *type, @@ -1179,6 +1167,9 @@ fs_visitor::emit_general_interpolation(fs_reg *attr, const char *name, } } else { /* Smooth/noperspective interpolation case. */ + enum brw_barycentric_mode bary = + barycentric_mode(interpolation_mode, mod_centroid, mod_sample); + for (unsigned int i = 0; i < type->vector_elements; i++) { fs_reg interp(interp_reg(*location, i)); if (devinfo->needs_unlit_centroid_workaround && mod_centroid) { @@ -1190,23 +1181,22 @@ fs_visitor::emit_general_interpolation(fs_reg *attr, const char *name, bld.emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS); fs_inst *inst; - inst = emit_linterp(*attr, interp, interpolation_mode, - false, false); + inst = bld.emit(FS_OPCODE_LINTERP, *attr, + delta_xy[centroid_to_pixel(bary)], interp); inst->predicate = BRW_PREDICATE_NORMAL; inst->predicate_inverse = true; if (devinfo->has_pln) inst->no_dd_clear = true; - inst = emit_linterp(*attr, interp, interpolation_mode, - mod_centroid, mod_sample); + inst = bld.emit(FS_OPCODE_LINTERP, *attr, + delta_xy[bary], interp); inst->predicate = BRW_PREDICATE_NORMAL; inst->predicate_inverse = false; if (devinfo->has_pln) inst->no_dd_check = true; } else { - emit_linterp(*attr, interp, interpolation_mode, - mod_centroid, mod_sample); + bld.emit(FS_OPCODE_LINTERP, *attr, delta_xy[bary], interp); } if (devinfo->gen < 6 && interpolation_mode == INTERP_QUALIFIER_SMOOTH) { bld.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 ddd66ca708f..70e324919e1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -170,9 +170,6 @@ public: void emit_dummy_fs(); void emit_repclear_shader(); fs_reg *emit_fragcoord_interpolation(); - fs_inst *emit_linterp(const fs_reg &attr, const fs_reg &interp, - glsl_interp_qualifier interpolation_mode, - bool is_centroid, bool is_sample); fs_reg *emit_frontfacing_interpolation(); fs_reg *emit_samplepos_setup(); fs_reg *emit_sampleid_setup(); |