Previously the code to load from a constant instruction was always using the u32 pointer. If the constant is actually a 16-bit source this would end up with the wrong values because the pointer would be offset by the wrong size. This fixes it to use the u16 pointer. --- src/freedreno/ir3/ir3_compiler_nir.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 445a2b291e9..584c7e83fea 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -2525,10 +2525,18 @@ emit_load_const(struct ir3_context *ctx, nir_load_const_instr *instr) { struct ir3_instruction **dst = get_dst_ssa(ctx, &instr->def, instr->def.num_components); - type_t type = (instr->def.bit_size < 32) ? TYPE_U16 : TYPE_U32; - for (int i = 0; i < instr->def.num_components; i++) - dst[i] = create_immed_typed(ctx->block, instr->value.u32[i], type); + if (instr->def.bit_size < 32) { + for (int i = 0; i < instr->def.num_components; i++) + dst[i] = create_immed_typed(ctx->block, + instr->value.u16[i], + TYPE_U16); + } else { + for (int i = 0; i < instr->def.num_components; i++) + dst[i] = create_immed_typed(ctx->block, + instr->value.u32[i], + TYPE_U32); + } } static void -- 2.17.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev