This patch is Reviewed-by: Ian Romanick <ian.d.roman...@intel.com>
On 02/10/2015 11:09 AM, Matt Turner wrote: > The docs specifically call out SEL with .l and .ge as the > implementations of MIN and MAX respectively. Among other things, SEL > with these conditional mods are commutative. > --- > src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 5 ++++- > src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 6 +++--- > src/mesa/drivers/dri/i965/brw_vec4_vp.cpp | 4 ++-- > src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp | 2 +- > 4 files changed, 10 insertions(+), 7 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp > b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp > index 6cddcf5..bca2139 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp > @@ -322,6 +322,9 @@ void > fs_visitor::emit_minmax(enum brw_conditional_mod conditionalmod, const > fs_reg &dst, > const fs_reg &src0, const fs_reg &src1) > { > + assert(conditionalmod == BRW_CONDITIONAL_GE || > + conditionalmod == BRW_CONDITIONAL_L); > + > fs_inst *inst; > > if (brw->gen >= 6) { > @@ -1948,7 +1951,7 @@ fs_visitor::rescale_texcoord(fs_reg coordinate, int > coord_components, > chan = offset(chan, i); > > inst = emit(BRW_OPCODE_SEL, chan, chan, fs_reg(0.0f)); > - inst->conditional_mod = BRW_CONDITIONAL_G; > + inst->conditional_mod = BRW_CONDITIONAL_GE; > > /* Our parameter comes in as 1.0/width or 1.0/height, > * because that's what people normally want for doing > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp > index e6a7ed0..d13c716 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp > @@ -513,7 +513,7 @@ vec4_visitor::emit_unpack_snorm_4x8(const dst_reg &dst, > src_reg src0) > emit(MUL(scaled, src_reg(f), src_reg(1.0f / 127.0f))); > > dst_reg max(this, glsl_type::vec4_type); > - emit_minmax(BRW_CONDITIONAL_G, max, src_reg(scaled), src_reg(-1.0f)); > + emit_minmax(BRW_CONDITIONAL_GE, max, src_reg(scaled), src_reg(-1.0f)); > emit_minmax(BRW_CONDITIONAL_L, dst, src_reg(max), src_reg(1.0f)); > } > > @@ -541,7 +541,7 @@ void > vec4_visitor::emit_pack_snorm_4x8(const dst_reg &dst, const src_reg &src0) > { > dst_reg max(this, glsl_type::vec4_type); > - emit_minmax(BRW_CONDITIONAL_G, max, src0, src_reg(-1.0f)); > + emit_minmax(BRW_CONDITIONAL_GE, max, src0, src_reg(-1.0f)); > > dst_reg min(this, glsl_type::vec4_type); > emit_minmax(BRW_CONDITIONAL_L, min, src_reg(max), src_reg(1.0f)); > @@ -1673,7 +1673,7 @@ vec4_visitor::visit(ir_expression *ir) > emit_minmax(BRW_CONDITIONAL_L, result_dst, op[0], op[1]); > break; > case ir_binop_max: > - emit_minmax(BRW_CONDITIONAL_G, result_dst, op[0], op[1]); > + emit_minmax(BRW_CONDITIONAL_GE, result_dst, op[0], op[1]); > break; > > case ir_binop_pow: > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp > index 434f032..e2d4b7c 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp > @@ -227,7 +227,7 @@ vec4_vs_visitor::emit_program_code() > /* if (tmp.y < 0) tmp.y = 0; */ > src_reg tmp_y = swizzle(src[0], BRW_SWIZZLE_YYYY); > result.writemask = WRITEMASK_Z; > - emit_minmax(BRW_CONDITIONAL_G, result, tmp_y, src_reg(0.0f)); > + emit_minmax(BRW_CONDITIONAL_GE, result, tmp_y, src_reg(0.0f)); > > src_reg clamped_y(result); > clamped_y.swizzle = BRW_SWIZZLE_ZZZZ; > @@ -314,7 +314,7 @@ vec4_vs_visitor::emit_program_code() > } > > case OPCODE_MAX: > - emit_minmax(BRW_CONDITIONAL_G, dst, src[0], src[1]); > + emit_minmax(BRW_CONDITIONAL_GE, dst, src[0], src[1]); > break; > > case OPCODE_MIN: > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp > index 72b6ef0..a48b730 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp > @@ -97,7 +97,7 @@ vec4_vs_visitor::emit_prolog() > dst.type = brw_type_for_base_type(glsl_type::vec4_type); > emit(MOV(dst, src_reg(reg_d))); > emit(MUL(dst, src_reg(dst), src_reg(es3_normalize_factor))); > - emit_minmax(BRW_CONDITIONAL_G, dst, src_reg(dst), > src_reg(-1.0f)); > + emit_minmax(BRW_CONDITIONAL_GE, dst, src_reg(dst), > src_reg(-1.0f)); > } else { > /* The following equations are from the OpenGL 3.2 > specification: > * > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev