From f2ae76e1a6cbdb0b35c04f02d6cf6000b2497c90 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 6 Jul 2021 12:29:58 -0700 Subject: [PATCH] nir_to_tgsi: Declare immediates as float on non-native-ints hardware. Makes the values more legible on i915g, and may keep us from tripping asserts on nouveau's non-native-integer HW. Reviewed-by: Ilia Mirkin Part-of: --- src/gallium/auxiliary/nir/nir_to_tgsi.c | 34 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c index 9bc9e575cb2..fbeadd935bc 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c @@ -460,22 +460,32 @@ ntt_setup_registers(struct ntt_compile *c, struct exec_list *list) static struct ureg_src ntt_get_load_const_src(struct ntt_compile *c, nir_load_const_instr *instr) { - uint32_t values[4]; int num_components = instr->def.num_components; - if (instr->def.bit_size == 32) { + if (!c->native_integers) { + float values[4]; + assert(instr->def.bit_size == 32); for (int i = 0; i < num_components; i++) - values[i] = instr->value[i].u32; - } else { - assert(num_components <= 2); - for (int i = 0; i < num_components; i++) { - values[i * 2 + 0] = instr->value[i].u64 & 0xffffffff; - values[i * 2 + 1] = instr->value[i].u64 >> 32; - } - num_components *= 2; - } + values[i] = uif(instr->value[i].u32); - return ureg_DECL_immediate_uint(c->ureg, values, num_components); + return ureg_DECL_immediate(c->ureg, values, num_components); + } else { + uint32_t values[4]; + + if (instr->def.bit_size == 32) { + for (int i = 0; i < num_components; i++) + values[i] = instr->value[i].u32; + } else { + assert(num_components <= 2); + for (int i = 0; i < num_components; i++) { + values[i * 2 + 0] = instr->value[i].u64 & 0xffffffff; + values[i * 2 + 1] = instr->value[i].u64 >> 32; + } + num_components *= 2; + } + + return ureg_DECL_immediate_uint(c->ureg, values, num_components); + } } static struct ureg_src