[Mesa-dev] [PATCH 10/29] nir/lower_load_const_to_scalar: suppport doubles and multiple bit sizes

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Mar 21 12:05:49 UTC 2016


From: Iago Toral Quiroga <itoral at igalia.com>

---
 src/compiler/nir/nir_lower_load_const_to_scalar.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_lower_load_const_to_scalar.c b/src/compiler/nir/nir_lower_load_const_to_scalar.c
index b5df464..13eb299 100644
--- a/src/compiler/nir/nir_lower_load_const_to_scalar.c
+++ b/src/compiler/nir/nir_lower_load_const_to_scalar.c
@@ -49,7 +49,11 @@ lower_load_const_instr_scalar(nir_load_const_instr *lower)
    nir_ssa_def *loads[4];
    for (unsigned i = 0; i < lower->def.num_components; i++) {
       nir_load_const_instr *load_comp = nir_load_const_instr_create(b.shader, 1);
-      load_comp->value.u32[0] = lower->value.u32[i];
+      if (lower->def.bit_size == 64)
+         load_comp->value.f64[0] = lower->value.f64[i];
+      else
+         load_comp->value.u32[0] = lower->value.u32[i];
+      load_comp->def.bit_size = lower->def.bit_size;
       nir_builder_instr_insert(&b, &load_comp->instr);
       loads[i] = &load_comp->def;
    }
-- 
2.5.0



More information about the mesa-dev mailing list