[Mesa-dev] [PATCH 5/5] gallium: remove TGSI_OPCODE_SUB

Ilia Mirkin imirkin at alum.mit.edu
Sun Jan 1 00:31:28 UTC 2017


On Sat, Dec 31, 2016 at 7:04 PM, Marek Olšák <maraeo at gmail.com> wrote:
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -1695,21 +1695,22 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
>         * driver.
>         */
>        emit_asm(ir, TGSI_OPCODE_MOV, result_dst, st_src_reg_for_float(0.5));
>        break;
>     }
>
>     case ir_binop_add:
>        emit_asm(ir, TGSI_OPCODE_ADD, result_dst, op[0], op[1]);
>        break;
>     case ir_binop_sub:
> -      emit_asm(ir, TGSI_OPCODE_SUB, result_dst, op[0], op[1]);
> +      op[1].negate = 1;
> +      emit_asm(ir, TGSI_OPCODE_ADD, result_dst, op[0], op[1]);
>        break;

I think you want op[1].negate = ~op[1].negate, as it could have been
inverted by ir_unop_neg. [Note that this is not a full review, just
something I happened to notice.]

Cheers,

  -ilia


More information about the mesa-dev mailing list