spirv: implement MakePointerAvailable/MakePointerVisible for OpCopyMemory
authorRhys Perry <pendingchaos02@gmail.com>
Wed, 6 May 2020 14:04:14 +0000 (15:04 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 1 Sep 2020 17:15:22 +0000 (17:15 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6090>

src/compiler/spirv/vtn_variables.c

index b39483516708ce3424963c93146b9bb01949e603..6de4ceffb82ae2e63053f77490e3a02ec4dbe8b7 100644 (file)
@@ -2626,7 +2626,22 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
 
       vtn_assert_types_equal(b, opcode, dest->type->deref, src->type->deref);
 
+      unsigned idx = 3, dest_alignment, src_alignment;
+      SpvMemoryAccessMask dest_access, src_access;
+      SpvScope dest_scope, src_scope;
+      vtn_get_mem_operands(b, w, count, &idx, &dest_access, &dest_alignment,
+                           &dest_scope, &src_scope);
+      if (!vtn_get_mem_operands(b, w, count, &idx, &src_access, &src_alignment,
+                                NULL, &src_scope)) {
+         src_alignment = dest_alignment;
+         src_access = dest_access;
+      }
+
+      vtn_emit_make_visible_barrier(b, src_access, src_scope, src->pointer->mode);
+
       vtn_variable_copy(b, dest->pointer, src->pointer);
+
+      vtn_emit_make_available_barrier(b, dest_access, dest_scope, dest->pointer->mode);
       break;
    }