From 267b6e4bef54e4dc6b5d3398f7e5a117631f501e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Thu, 7 May 2026 09:32:51 +0200 Subject: [PATCH] r300: emit one full vec4 immediate per NIR load_const Stop relying on ureg_DECL_immediate's "expand" path to fill earlier TGSI immediates' unused components with values from later load_const instructions and depend on later backed pass to do it. Mostly a wash on shader-db: sub-0.1% regressions on inst/cycles/ consts on RV530/RV370/RV410, with one LOST shader on RV370 (trine/fp-17.shader_test FS). Part-of: --- src/gallium/drivers/r300/compiler/nir_to_rc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/nir_to_rc.c b/src/gallium/drivers/r300/compiler/nir_to_rc.c index bf30b02dc54..08fa792cf81 100644 --- a/src/gallium/drivers/r300/compiler/nir_to_rc.c +++ b/src/gallium/drivers/r300/compiler/nir_to_rc.c @@ -622,12 +622,15 @@ ntr_get_load_const_src(struct ntr_compile *c, nir_load_const_instr *instr) { int num_components = instr->def.num_components; - float values[4]; + /* Always emit a full vec4 immediate per load_const and let the + * RC backend's constant packing handle it later. + */ + float values[4] = {0}; assert(instr->def.bit_size == 32); for (int i = 0; i < num_components; i++) values[i] = uif(instr->value[i].u32); - return ureg_DECL_immediate(c->ureg, values, num_components); + return ureg_DECL_immediate(c->ureg, values, 4); } static struct ureg_src