From 5e922fbc160bcda9b38ccf5704cbd7276a748094 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 18 Jul 2020 10:02:11 -0700 Subject: [PATCH] glsl_to_nir: fix bitfield_extract with 16-bit operands MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit These are defined to explicitly take 32b values. Reviewed-by: Marek Olšák Reviewed-by: Rob Clark Part-of: --- src/compiler/glsl/glsl_to_nir.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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); -- 2.30.2