<div dir="ltr">If you don't mind rebasing on it, my "get rid of nir_constant_data" patch should let you drop most of this and patch 5.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 25, 2016 at 12:52 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>
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 | 24 +++++++++++++++++-------<br>
1 file changed, 17 insertions(+), 7 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 dadf7fc..8569bc8 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -98,14 +98,19 @@ vtn_const_ssa_value(struct vtn_builder *b, nir_constant *constant,<br>
case GLSL_TYPE_UINT:<br>
case GLSL_TYPE_BOOL:<br>
case GLSL_TYPE_FLOAT:<br>
- case GLSL_TYPE_DOUBLE:<br>
+ case GLSL_TYPE_DOUBLE: {<br>
+ int bit_size = glsl_get_bit_size(type);<br>
if (glsl_type_is_vector_or_<wbr>scalar(type)) {<br>
unsigned num_components = glsl_get_vector_elements(val-><wbr>type);<br>
nir_load_const_instr *load =<br>
- nir_load_const_instr_create(b-<wbr>>shader, num_components, 32);<br>
+ nir_load_const_instr_create(b-<wbr>>shader, num_components, bit_size);<br>
<br>
- for (unsigned i = 0; i < num_components; i++)<br>
- load->value.u32[i] = constant->value.u[i];<br>
+ for (unsigned i = 0; i < num_components; i++) {<br>
+ if (bit_size == 64)<br>
+ load->value.f64[i] = constant->value.d[i];<br>
+ else<br>
+ load->value.u32[i] = constant->value.u[i];<br>
+ }<br>
<br>
nir_instr_insert_before_cf_<wbr>list(&b->impl->body, &load->instr);<br>
val->def = &load->def;<br>
@@ -119,10 +124,14 @@ vtn_const_ssa_value(struct vtn_builder *b, nir_constant *constant,<br>
struct vtn_ssa_value *col_val = rzalloc(b, struct vtn_ssa_value);<br>
col_val->type = glsl_get_column_type(val-><wbr>type);<br>
nir_load_const_instr *load =<br>
- nir_load_const_instr_create(b-<wbr>>shader, rows, 32);<br>
+ nir_load_const_instr_create(b-<wbr>>shader, rows, bit_size);<br>
<br>
- for (unsigned j = 0; j < rows; j++)<br>
- load->value.u32[j] = constant->value.u[rows * i + j];<br>
+ for (unsigned j = 0; j < rows; j++) {<br>
+ if (bit_size == 64)<br>
+ load->value.f64[j] = constant->value.d[rows * i + j];<br>
+ else<br>
+ load->value.u32[j] = constant->value.u[rows * i + j];<br>
+ }<br>
<br>
nir_instr_insert_before_cf_<wbr>list(&b->impl->body, &load->instr);<br>
col_val->def = &load->def;<br>
@@ -131,6 +140,7 @@ vtn_const_ssa_value(struct vtn_builder *b, nir_constant *constant,<br>
}<br>
}<br>
break;<br>
+ }<br>
<br>
case GLSL_TYPE_ARRAY: {<br>
unsigned elems = glsl_get_length(val->type);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<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>