<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Sep 6, 2016 at 9:16 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:llandwerlin@gmail.com" target="_blank">llandwerlin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Fixes new CTS tests :<br>
<br>
dEQP-VK.spirv_assembly.<wbr>instruction.compute.opatomic.<wbr>load<br>
dEQP-VK.spirv_assembly.<wbr>instruction.compute.opatomic.<wbr>store<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
Cc: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
---<br>
src/compiler/spirv/spirv_to_<wbr>nir.c | 33 ++++++++++++++++++++++++++++++<wbr>+++<br>
1 file changed, 33 insertions(+)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index fda38f9..104b74f 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -1913,6 +1913,32 @@ vtn_handle_ssbo_or_shared_<wbr>atomic(struct vtn_builder *b, SpvOp opcode,<br>
nir_builder_instr_insert(&b-><wbr>nb, &atomic->instr);<br>
}<br>
<br>
+static void<br>
+vtn_handle_atomic_load_store(<wbr>struct vtn_builder *b, bool load,<br>
+ const uint32_t *w, unsigned count)<br>
+{<br>
+ struct vtn_access_chain *chain =<br>
+ load ?<br>
+ vtn_value(b, w[3], vtn_value_type_access_chain)-><wbr>access_chain :<br>
+ vtn_value(b, w[1], vtn_value_type_access_chain)-><wbr>access_chain;<br>
+<br>
+ switch (chain->var->mode) {<br>
+ case vtn_variable_mode_image:<br>
+ case vtn_variable_mode_ssbo:<br>
+ case vtn_variable_mode_ubo:<br>
+ if (load) {<br>
+ struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_ssa);<br>
+ val->ssa = vtn_variable_load(b, chain);<br>
+ } else {<br>
+ struct vtn_ssa_value *src = vtn_ssa_value(b, w[4]);<br>
+ vtn_variable_store(b, src, chain);<br></blockquote><div><br></div><div>This may work for UBOs and SSBOs but it will not work for images. They need to go through the image load store paths.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ }<br>
+ break;<br>
+ default:<br>
+ unreachable("invalid block variable");<br>
+ }<br>
+}<br>
+<br>
static nir_alu_instr *<br>
create_vec(nir_shader *shader, unsigned num_components, unsigned bit_size)<br>
{<br>
@@ -2649,6 +2675,13 @@ vtn_handle_body_instruction(<wbr>struct vtn_builder *b, SpvOp opcode,<br>
vtn_handle_variables(b, opcode, w, count);<br>
break;<br>
<br>
+ case SpvOpAtomicLoad:<br>
+ vtn_handle_atomic_load_store(<wbr>b, true, w, count);<br>
+ break;<br>
+ case SpvOpAtomicStore:<br>
+ vtn_handle_atomic_load_store(<wbr>b, false, w, count);<br>
+ break;<br>
+<br>
case SpvOpFunctionCall:<br>
vtn_handle_function_call(b, opcode, w, count);<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>