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

Ilia Mirkin imirkin at alum.mit.edu
Fri Apr 25 10:41:40 PDT 2014


bitfield_insert expects glsl_type::int_type arguments, not uint vectors

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

Identical to the patch I sent out last night. Without it ldexp lowering
(without bfi lowering) causes assertion failures in the next mesa/st patch.

 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