<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 16, 2016 at 6:48 AM, Juan A. Suarez Romero <span dir="ltr"><<a href="mailto:jasuarez@igalia.com" target="_blank">jasuarez@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
<br>
We need to pick two 32-bit values per component to perform the right shuffle operation.<br>
<br>
Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
---<br>
src/compiler/spirv/spirv_to_<wbr>nir.c | 25 +++++++++++++++++++++----<br>
1 file changed, 21 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index 5303a94..5126dc9 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -1073,18 +1073,35 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,<br>
unsigned len0 = glsl_get_vector_elements(v0-><wbr>const_type);<br>
unsigned len1 = glsl_get_vector_elements(v1-><wbr>const_type);<br>
<br>
- uint32_t u[8];<br>
+ if (glsl_get_bit_size(v0->const_<wbr>type) == 64)<br>
+ len0 *= 2;<br>
+ if (glsl_get_bit_size(v1->const_<wbr>type) == 64)<br>
+ len1 *= 2;<br>
+<br>
+ /* Allocate space for two dvec4s */<br>
+ uint32_t u[16];<br>
+ assert(len0 + len1 < 16);<br>
for (unsigned i = 0; i < len0; i++)<br>
u[i] = v0->constant->values[0].u32[i]<wbr>;<br>
for (unsigned i = 0; i < len1; i++)<br>
u[len0 + i] = v1->constant->values[0].u32[i]<wbr>;<br>
<br>
- for (unsigned i = 0; i < count - 6; i++) {<br>
+ unsigned bit_size = glsl_get_bit_size(val->const_<wbr>type);<br></blockquote><div><br></div><div>It wouldn't hurt to assert that all of the values have the same bit size. In fact, they're all required to have the same base type and bit width. The only thing allowed to vary between the three is the number of components.<br><br></div><div>In light of that, does it make sense to do as 16 uint32_t's or would it work better just to assert that all the bit sizes are the same and switch on bit size once?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ for (unsigned i = 0, j = 0; i < count - 6; i++, j++) {<br>
uint32_t comp = w[i + 6];<br>
+ /* In case of doubles, we need to pick two 32-bit values,<br>
+ * then we duplicate the component to pick the right values.<br>
+ */<br>
+ if (bit_size == 64)<br>
+ comp *= 2;<br>
if (comp == (uint32_t)-1) {<br>
- val->constant->values[0].u32[<wbr>i] = 0xdeadbeef;<br>
+ val->constant->values[0].u32[<wbr>j] = 0xdeadbeef;<br>
+ if (bit_size == 64)<br>
+ val->constant->values[0].u32[+<wbr>+j] = 0xdeadbeef;<br>
} else {<br>
- val->constant->values[0].u32[<wbr>i] = u[comp];<br>
+ val->constant->values[0].u32[<wbr>j] = u[comp];<br>
+ if (bit_size == 64)<br>
+ val->constant->values[0].u32[+<wbr>+j] = u[comp + 1];<br>
}<br>
}<br>
break;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>