<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2018-02-03 11:26 GMT+01:00 Erik Faye-Lund <span dir="ltr"><<a href="mailto:kusmabite@gmail.com" target="_blank">kusmabite@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div class="h5"><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" target="_blank">airlied@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_-6184960508352562674quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Dave Airlie <<a href="mailto:airlied@redhat.com" target="_blank">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" target="_blank">airlied@redhat.com</a>><br>
---<br>
src/compiler/glsl/lower_<wbr>64bit.cpp | 38 ++++++++++++++++++++++++++++++<wbr>++++----<br>
1 file changed, 34 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/compiler/glsl/lower_64bi<wbr>t.cpp b/src/compiler/glsl/lower_64bi<wbr>t.cpp<br>
index ac62d1db1e..c7c6d1cb31 100644<br>
--- a/src/compiler/glsl/lower_64bi<wbr>t.cpp<br>
+++ b/src/compiler/glsl/lower_64bi<wbr>t.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_factor<wbr>y &,<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(i<wbr>r_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_src<wbr>[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_funct<wbr>ion_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_64b<wbr>it())<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></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></blockquote><div><br></div><div>Hi, just passing by.</div><div><br></div><div>Though they look very similarly, one is ex-pand-_source and the other is ex-tract-_source.</div><div><br></div><div>Regards,</div><div>Gustaw Smolarczyk</div></div></div></div>