The implementation is going to be nontrivial, so let's get it out of visit().
Signed-off-by: Chris Forbes <chr...@ijw.co.nz> --- src/mesa/drivers/dri/i965/brw_fs.h | 1 + src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 29 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index c45faea..401f273 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -369,6 +369,7 @@ public: fs_reg src0, fs_reg src1); bool try_emit_saturate(ir_expression *ir); bool try_emit_mad(ir_expression *ir, int mul_arg); + void emit_interpolate_expression(ir_expression *ir); void try_replace_with_sel(); void emit_bool_to_cond_code(ir_rvalue *condition); void emit_if_gen6(ir_if *ir); diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 9eb9a9d..538f1b3 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -326,6 +326,12 @@ fs_visitor::try_emit_mad(ir_expression *ir, int mul_arg) } void +fs_visitor::emit_interpolate_expression(ir_expression *ir) +{ + this->result = fs_reg(this, ir->type); +} + +void fs_visitor::visit(ir_expression *ir) { unsigned int operand; @@ -336,9 +342,22 @@ fs_visitor::visit(ir_expression *ir) if (try_emit_saturate(ir)) return; - if (ir->operation == ir_binop_add) { + + /* Deal with the real oddball stuff first */ + switch (ir->operation) { + case ir_binop_add: if (try_emit_mad(ir, 0) || try_emit_mad(ir, 1)) - return; + return; + break; + + case ir_unop_interpolate_at_centroid: + case ir_binop_interpolate_at_offset: + case ir_binop_interpolate_at_sample: + emit_interpolate_expression(ir); + return; + + default: + break; } for (operand = 0; operand < ir->get_num_operands(); operand++) { @@ -781,6 +800,12 @@ fs_visitor::visit(ir_expression *ir) inst = emit(BRW_OPCODE_SEL, this->result, op[1], op[2]); inst->predicate = BRW_PREDICATE_NORMAL; break; + + case ir_unop_interpolate_at_centroid: + case ir_binop_interpolate_at_offset: + case ir_binop_interpolate_at_sample: + assert(!"not reached; already handled above"); + break; } } -- 1.8.4.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev