mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 06:30:10 +01:00
spirv: implement Volatile memory semantic
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:
parent
23bfba8663
commit
2ba3ffa76c
1 changed files with 13 additions and 3 deletions
|
|
@ -2152,7 +2152,8 @@ vtn_split_barrier_semantics(struct vtn_builder *b,
|
|||
SpvMemorySemanticsOutputMemoryMask);
|
||||
|
||||
const SpvMemorySemanticsMask other_semantics =
|
||||
semantics & ~(order_semantics | av_vis_semantics | storage_semantics);
|
||||
semantics & ~(order_semantics | av_vis_semantics | storage_semantics |
|
||||
SpvMemorySemanticsVolatileMask);
|
||||
|
||||
if (other_semantics)
|
||||
vtn_warn("Ignoring unhandled memory semantics: %u\n", other_semantics);
|
||||
|
|
@ -3089,6 +3090,9 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
|
|||
vtn_fail_with_opcode("Invalid image opcode", opcode);
|
||||
}
|
||||
|
||||
if (semantics & SpvMemorySemanticsVolatileMask)
|
||||
access |= ACCESS_VOLATILE;
|
||||
|
||||
nir_intrinsic_op op;
|
||||
switch (opcode) {
|
||||
#define OP(S, N) case SpvOp##S: op = nir_intrinsic_image_deref_##N; break;
|
||||
|
|
@ -3353,6 +3357,7 @@ vtn_handle_atomics(struct vtn_builder *b, SpvOp opcode,
|
|||
|
||||
SpvScope scope = SpvScopeInvocation;
|
||||
SpvMemorySemanticsMask semantics = 0;
|
||||
enum gl_access_qualifier access = 0;
|
||||
|
||||
switch (opcode) {
|
||||
case SpvOpAtomicLoad:
|
||||
|
|
@ -3386,6 +3391,9 @@ vtn_handle_atomics(struct vtn_builder *b, SpvOp opcode,
|
|||
vtn_fail_with_opcode("Invalid SPIR-V atomic", opcode);
|
||||
}
|
||||
|
||||
if (semantics & SpvMemorySemanticsVolatileMask)
|
||||
access |= ACCESS_VOLATILE;
|
||||
|
||||
/* uniform as "atomic counter uniform" */
|
||||
if (ptr->mode == vtn_variable_mode_atomic_counter) {
|
||||
nir_deref_instr *deref = vtn_pointer_to_deref(b, ptr);
|
||||
|
|
@ -3432,7 +3440,7 @@ vtn_handle_atomics(struct vtn_builder *b, SpvOp opcode,
|
|||
nir_intrinsic_op op = get_ssbo_nir_atomic_op(b, opcode);
|
||||
atomic = nir_intrinsic_instr_create(b->nb.shader, op);
|
||||
|
||||
nir_intrinsic_set_access(atomic, ACCESS_COHERENT);
|
||||
nir_intrinsic_set_access(atomic, access | ACCESS_COHERENT);
|
||||
|
||||
int src = 0;
|
||||
switch (opcode) {
|
||||
|
|
@ -3486,7 +3494,9 @@ vtn_handle_atomics(struct vtn_builder *b, SpvOp opcode,
|
|||
atomic->src[0] = nir_src_for_ssa(&deref->dest.ssa);
|
||||
|
||||
if (ptr->mode != vtn_variable_mode_workgroup)
|
||||
nir_intrinsic_set_access(atomic, ACCESS_COHERENT);
|
||||
access |= ACCESS_COHERENT;
|
||||
|
||||
nir_intrinsic_set_access(atomic, access);
|
||||
|
||||
switch (opcode) {
|
||||
case SpvOpAtomicLoad:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue