[Mesa-dev] [PATCH] st/mesa: fix weird UCMP opcode use for bool ubo load
Marek Olšák
maraeo at gmail.com
Thu May 9 05:15:08 PDT 2013
Reviewed-by: Marek Olšák <maraeo at gmail.com>
Marek
On Thu, May 9, 2013 at 12:58 AM, <sroland at vmware.com> wrote:
> From: Roland Scheidegger <sroland at vmware.com>
>
> I don't know what this code was trying to do but whatever it was it couldn't
> have worked since negation of integer boolean inputs while not specified as
> outright illegal (not yet at least) won't do anything since it doesn't affect
> the result of comparison with zero at all. In fact it looks like the whole
> instruction can just be omitted.
> ---
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index f2eb3e7..08b2d7a 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -1945,8 +1945,6 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>
> if (ir->type->base_type == GLSL_TYPE_BOOL) {
> emit(ir, TGSI_OPCODE_USNE, result_dst, cbuf, st_src_reg_for_int(0));
> - result_src.negate = 1;
> - emit(ir, TGSI_OPCODE_UCMP, result_dst, result_src, st_src_reg_for_int(~0), st_src_reg_for_int(0));
> } else {
> emit(ir, TGSI_OPCODE_MOV, result_dst, cbuf);
> }
> @@ -2388,8 +2386,8 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
> if (native_integers) {
> /* This is necessary because TGSI's CMP instruction expects the
> * condition to be a float, and we store booleans as integers.
> - * If TGSI had a UCMP instruction or similar, this extra
> - * instruction would not be necessary.
> + * TODO: really want to avoid i2f path and use UCMP. Requires
> + * changes to process_move_condition though too.
> */
> condition_temp = get_temp(glsl_type::vec4_type);
> condition.negate = 0;
> --
> 1.7.9.5
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list