spirv: add vtn_emit_make_{visible,available}_barrier helpers
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>
This commit is contained in:
@@ -2500,6 +2500,30 @@ vtn_mode_to_memory_semantics(enum vtn_variable_mode mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vtn_emit_make_visible_barrier(struct vtn_builder *b, SpvMemoryAccessMask access,
|
||||||
|
SpvScope scope, enum vtn_variable_mode mode)
|
||||||
|
{
|
||||||
|
if (!(access & SpvMemoryAccessMakePointerVisibleMask))
|
||||||
|
return;
|
||||||
|
|
||||||
|
vtn_emit_memory_barrier(b, scope, SpvMemorySemanticsMakeVisibleMask |
|
||||||
|
SpvMemorySemanticsAcquireMask |
|
||||||
|
vtn_mode_to_memory_semantics(mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vtn_emit_make_available_barrier(struct vtn_builder *b, SpvMemoryAccessMask access,
|
||||||
|
SpvScope scope, enum vtn_variable_mode mode)
|
||||||
|
{
|
||||||
|
if (!(access & SpvMemoryAccessMakePointerAvailableMask))
|
||||||
|
return;
|
||||||
|
|
||||||
|
vtn_emit_memory_barrier(b, scope, SpvMemorySemanticsMakeAvailableMask |
|
||||||
|
SpvMemorySemanticsReleaseMask |
|
||||||
|
vtn_mode_to_memory_semantics(mode));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
|
vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
|
||||||
const uint32_t *w, unsigned count)
|
const uint32_t *w, unsigned count)
|
||||||
@@ -2617,13 +2641,8 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
|
|||||||
SpvMemoryAccessMask access;
|
SpvMemoryAccessMask access;
|
||||||
SpvScope scope;
|
SpvScope scope;
|
||||||
vtn_get_mem_operands(b, w, count, &idx, &access, &alignment, NULL, &scope);
|
vtn_get_mem_operands(b, w, count, &idx, &access, &alignment, NULL, &scope);
|
||||||
if (access & SpvMemoryAccessMakePointerVisibleMask) {
|
|
||||||
SpvMemorySemanticsMask semantics =
|
vtn_emit_make_visible_barrier(b, access, scope, src->mode);
|
||||||
SpvMemorySemanticsMakeVisibleMask |
|
|
||||||
SpvMemorySemanticsAcquireMask |
|
|
||||||
vtn_mode_to_memory_semantics(src->mode);
|
|
||||||
vtn_emit_memory_barrier(b, scope, semantics);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtn_push_ssa_value(b, w[2], vtn_variable_load(b, src));
|
vtn_push_ssa_value(b, w[2], vtn_variable_load(b, src));
|
||||||
break;
|
break;
|
||||||
@@ -2667,13 +2686,7 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
|
|||||||
struct vtn_ssa_value *src = vtn_ssa_value(b, w[2]);
|
struct vtn_ssa_value *src = vtn_ssa_value(b, w[2]);
|
||||||
vtn_variable_store(b, src, dest);
|
vtn_variable_store(b, src, dest);
|
||||||
|
|
||||||
if (access & SpvMemoryAccessMakePointerAvailableMask) {
|
vtn_emit_make_available_barrier(b, access, scope, dest->mode);
|
||||||
SpvMemorySemanticsMask semantics =
|
|
||||||
SpvMemorySemanticsMakeAvailableMask |
|
|
||||||
SpvMemorySemanticsReleaseMask |
|
|
||||||
vtn_mode_to_memory_semantics(dest->mode);
|
|
||||||
vtn_emit_memory_barrier(b, scope, semantics);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user