<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 13, 2018 at 12:45 PM, Rob Clark <span dir="ltr"><<a href="mailto:robdclark@gmail.com" target="_blank">robdclark@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>><br>
---<br>
src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c | 9 +++++++--<br>
1 file changed, 7 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c b/src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c<br>
index e494facfd21..9d37e3fecef 100644<br>
--- a/src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c<br>
+++ b/src/compiler/nir/nir_lower_<wbr>load_const_to_scalar.c<br>
@@ -52,9 +52,14 @@ lower_load_const_instr_scalar(<wbr>nir_load_const_instr *lower)<br>
nir_load_const_instr_create(b.<wbr>shader, 1, lower->def.bit_size);<br>
if (lower->def.bit_size == 64)<br>
load_comp->value.f64[0] = lower->value.f64[i];<br>
- else<br>
+ else if (lower->def.bit_size == 32)<br>
load_comp->value.u32[0] = lower->value.u32[i];<br>
- assert(lower->def.bit_size == 64 || lower->def.bit_size == 32);<br>
+ else if (lower->def.bit_size == 16)<br>
+ load_comp->value.u16[0] = lower->value.u16[i];<br>
+ else if (lower->def.bit_size == 8)<br>
+ load_comp->value.u8[0] = lower->value.u8[i];<br>
+ else<br>
+ assert(!"invalid bit size");<br></blockquote><div><br></div><div>Let's make it a switch since we have 4 cases which are all == constant.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
nir_builder_instr_insert(&b, &load_comp->instr);<br>
loads[i] = &load_comp->def;<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.3<br>
<br>
</font></span></blockquote></div><br></div></div>