From: Rob Clark Date: Sat, 18 Jul 2020 17:02:11 +0000 (-0700) Subject: glsl_to_nir: fix bitfield_extract with 16-bit operands X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e922fbc160bcda9b38ccf5704cbd7276a748094;p=mesa.git glsl_to_nir: fix bitfield_extract with 16-bit operands These are defined to explicitly take 32b values. Reviewed-by: Marek Olšák Reviewed-by: Rob Clark Part-of: --- diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 69bcdeeff59..2dc0df32a93 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -2300,12 +2300,14 @@ nir_visitor::visit(ir_expression *ir) result = nir_bcsel(&b, srcs[0], srcs[1], srcs[2]); break; case ir_triop_bitfield_extract: - result = (out_type == GLSL_TYPE_INT) ? - nir_ibitfield_extract(&b, srcs[0], srcs[1], srcs[2]) : - nir_ubitfield_extract(&b, srcs[0], srcs[1], srcs[2]); + result = ir->type->is_int_16_32() ? + nir_ibitfield_extract(&b, nir_i2i32(&b, srcs[0]), nir_i2i32(&b, srcs[1]), nir_i2i32(&b, srcs[2])) : + nir_ubitfield_extract(&b, nir_u2u32(&b, srcs[0]), nir_i2i32(&b, srcs[1]), nir_i2i32(&b, srcs[2])); break; case ir_quadop_bitfield_insert: - result = nir_bitfield_insert(&b, srcs[0], srcs[1], srcs[2], srcs[3]); + result = nir_bitfield_insert(&b, + nir_u2u32(&b, srcs[0]), nir_u2u32(&b, srcs[1]), + nir_i2i32(&b, srcs[2]), nir_i2i32(&b, srcs[3])); break; case ir_quadop_vector: result = nir_vec(&b, srcs, ir->type->vector_elements);