summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2016-02-10 16:05:11 +0100
committerSamuel Iglesias Gonsálvez <[email protected]>2016-04-11 08:27:05 +0200
commit8e69782e3e4e574e0395f8300f86e32633d2f21a (patch)
tree86c02580581a09829f1d6dfd50e952240a3b8862 /src/compiler
parent12f628adcbe2f87073fb06f98a98414b898cde5d (diff)
nir/lower_load_const_to_scalar: support doubles and multiple bit sizes
v2 (Sam): - Add assert to detect bitsizes differents than 32 and 64 (Jason). Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_lower_load_const_to_scalar.c8
1 files changed, 6 insertions, 2 deletions
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 d290c303cd2..db5865fb0c0 100644
--- a/src/compiler/nir/nir_lower_load_const_to_scalar.c
+++ b/src/compiler/nir/nir_lower_load_const_to_scalar.c
@@ -49,8 +49,12 @@ 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, 32);
- load_comp->value.u32[0] = lower->value.u32[i];
+ nir_load_const_instr_create(b.shader, 1, lower->def.bit_size);
+ 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];
+ assert(lower->def.bit_size == 64 || lower->def.bit_size == 32);
nir_builder_instr_insert(&b, &load_comp->instr);
loads[i] = &load_comp->def;
}