[Mesa-dev] [PATCH] glsl: fix bitfield_insert use when doing ldexp lowering

Ilia Mirkin imirkin at alum.mit.edu
Thu Apr 24 22:13:47 PDT 2014


On Fri, Apr 25, 2014 at 1:05 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> bitfield_insert expects glsl_type::int_type arguments, not uint vectors
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> fs-ldexp still fails with this with my patches to add this to
> gallium/softpipe, but I very well might have messed something up (like the
> bitfield_insert impl). But I no longer get an assert in ir_validate.cpp.

Yeah, it was a bug in my bitfield_insert translation. Passes now.
Argument order matters, who'd-a-thunk it.

>
>  src/glsl/lower_instructions.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/lower_instructions.cpp b/src/glsl/lower_instructions.cpp
> index 01ea0f0..54a7a23 100644
> --- a/src/glsl/lower_instructions.cpp
> +++ b/src/glsl/lower_instructions.cpp
> @@ -360,7 +360,8 @@ lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
>     ir_constant *sign_mask = new(ir) ir_constant(0x80000000u, vec_elem);
>
>     ir_constant *exp_shift = new(ir) ir_constant(23u, vec_elem);
> -   ir_constant *exp_width = new(ir) ir_constant(8u, vec_elem);
> +   ir_constant *exp_shift_int = new(ir) ir_constant(23);
> +   ir_constant *exp_width = new(ir) ir_constant(8);
>
>     /* Temporary variables */
>     ir_variable *x = new(ir) ir_variable(ir->type, "x", ir_var_temporary);
> @@ -421,10 +422,9 @@ lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
>      *     floating-point type, the result is undefined."
>      */
>
> -   ir_constant *exp_shift_clone = exp_shift->clone(ir, NULL);
>     ir->operation = ir_unop_bitcast_i2f;
>     ir->operands[0] = bitfield_insert(bitcast_f2i(x), resulting_biased_exp,
> -                                     exp_shift_clone, exp_width);
> +                                     exp_shift_int, exp_width);
>     ir->operands[1] = NULL;
>
>     /* Don't generate new IR that would need to be lowered in an additional
> --
> 1.8.3.2
>


More information about the mesa-dev mailing list