<div dir="auto"><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Feb 1, 2018 04:35, "Dave Airlie" <<a href="mailto:airlied@gmail.com">airlied@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
<br>
In order to deal with conversions properly we need to extract<br>
non-64bit sources from vectors instead of expanding them as<br>
the 64-bit code does.<br>
<br>
We need non-64bit sources for the 32->64 conversion functions.<br>
<br>
Signed-off-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
---<br>
 src/compiler/glsl/lower_64bit.<wbr>cpp | 38 ++++++++++++++++++++++++++++++<wbr>++++----<br>
 1 file changed, 34 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/compiler/glsl/lower_<wbr>64bit.cpp b/src/compiler/glsl/lower_<wbr>64bit.cpp<br>
index ac62d1db1e..c7c6d1cb31 100644<br>
--- a/src/compiler/glsl/lower_<wbr>64bit.cpp<br>
+++ b/src/compiler/glsl/lower_<wbr>64bit.cpp<br>
@@ -52,6 +52,7 @@ using namespace ir_builder;<br>
<br>
 namespace lower_64bit {<br>
 void expand_source(ir_factory &, ir_rvalue *val, ir_variable **expanded_src);<br>
+void extract_source(ir_factory &, ir_rvalue *val, ir_variable **extracted_src);<br>
<br>
 ir_dereference_variable *compact_destination(ir_<wbr>factory &,<br>
                                              const glsl_type *type,<br>
@@ -226,6 +227,25 @@ lower_64bit::expand_source(ir_<wbr>factory &body,<br>
       expanded_src[i] = expanded_src[0];<br>
 }<br>
<br>
+void<br>
+lower_64bit::extract_source(<wbr>ir_factory &body,<br>
+                            ir_rvalue *val,<br>
+                            ir_variable **extracted_src)<br>
+{<br>
+   ir_variable *const temp = body.make_temp(val->type, "tmp");<br>
+<br>
+   body.emit(assign(temp, val));<br>
+   unsigned i;<br>
+   for (i = 0; i < val->type->vector_elements; i++) {<br>
+      extracted_src[i] = body.make_temp(val->type->get_<wbr>scalar_type(), "extracted_source");<br>
+<br>
+      body.emit(assign(extracted_<wbr>src[i], swizzle(temp, i, 1)));<br>
+   }<br>
+<br>
+   for (/* empty */; i < 4; i++)<br>
+      extracted_src[i] = extracted_src[0];<br>
+}<br>
+<br>
 /**<br>
  * Convert a series of uvec2 results into a single 64-bit integer vector<br>
  */<br>
@@ -262,14 +282,24 @@ lower_64bit::lower_op_to_<wbr>function_call(ir_instruction *base_ir,<br>
    void *const mem_ctx = ralloc_parent(ir);<br>
    exec_list instructions;<br>
    unsigned source_components = 0;<br>
-   const glsl_type *const result_type =<br>
-      ir->type->base_type == GLSL_TYPE_UINT64<br>
-      ? glsl_type::uvec2_type : glsl_type::ivec2_type;<br>
+   const glsl_type *result_type;<br>
+<br>
+   if (ir->type->is_64bit()) {<br>
+      if (ir->type->base_type == GLSL_TYPE_UINT64 ||<br>
+          ir->type->base_type == GLSL_TYPE_DOUBLE)<br>
+         result_type = glsl_type::uvec2_type;<br>
+      else<br>
+         result_type = glsl_type::ivec2_type;<br>
+   } else<br>
+      result_type = ir->type->get_scalar_type();<br>
<br>
    ir_factory body(&instructions, mem_ctx);<br>
<br>
    for (unsigned i = 0; i < num_operands; i++) {<br>
-      expand_source(body, ir->operands[i], src[i]);<br>
+      if (ir->operands[i]->type->is_<wbr>64bit())<br>
+         expand_source(body, ir->operands[i], src[i]);<br>
+      else<br>
+         extract_source(body, ir->operands[i], src[i]);<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">This change looks like a nop to me. Was the different sides of the else supposed to do different things?</div></div>