From e28cfb2bada2398a9ddcadd03fac060d5654a15e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 26 Sep 2025 12:21:24 +1000 Subject: [PATCH] gallivm: handle u8/u16 const loads properly on big-endian. Turns out just putting the u32 in doesn't work on big endian, so put the proper u8/u16 values in. Got a report that since the loop limiter got removed, a gtk4 blur shader was looping forever on s390x. Turns out it was using a 16-bit loop variable (because why wouldn't you), and the loop counter was just staying at 0 all the time. Cc: mesa-stable Acked-by: Mike Blumenkrantz Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index aa3c167dd9f..c998c18e888 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -1267,8 +1267,10 @@ emit_load_const(struct lp_build_nir_soa_context *bld, for (unsigned i = 0; i < instr->def.num_components; i++) { outval[i] = lp_build_const_int_vec(bld->base.gallivm, int_bld->type, - bits == 32 ? instr->value[i].u32 - : instr->value[i].u64); + bits == 8 ? instr->value[i].u8 : + bits == 16 ? instr->value[i].u32 : + bits == 32 ? instr->value[i].u32 : + instr->value[i].u64); } for (unsigned i = instr->def.num_components; i < NIR_MAX_VEC_COMPONENTS; i++) { outval[i] = NULL;