vtn_foreach_decoration(b, val, handle_workgroup_size_decoration_cb, NULL);
}
-SpvMemorySemanticsMask
-vtn_storage_class_to_memory_semantics(SpvStorageClass sc)
-{
- switch (sc) {
- case SpvStorageClassStorageBuffer:
- case SpvStorageClassPhysicalStorageBuffer:
- return SpvMemorySemanticsUniformMemoryMask;
- case SpvStorageClassWorkgroup:
- return SpvMemorySemanticsWorkgroupMemoryMask;
- default:
- return SpvMemorySemanticsMaskNone;
- }
-}
-
static void
vtn_split_barrier_semantics(struct vtn_builder *b,
SpvMemorySemanticsMask semantics,
/* Atomic ordering operations will implicitly apply to the atomic operation
* storage class, so include that too.
*/
- semantics |= vtn_storage_class_to_memory_semantics(ptr->ptr_type->storage_class);
+ semantics |= vtn_mode_to_memory_semantics(ptr->mode);
SpvMemorySemanticsMask before_semantics;
SpvMemorySemanticsMask after_semantics;
return true;
}
+SpvMemorySemanticsMask
+vtn_mode_to_memory_semantics(enum vtn_variable_mode mode)
+{
+ switch (mode) {
+ case vtn_variable_mode_ssbo:
+ case vtn_variable_mode_phys_ssbo:
+ return SpvMemorySemanticsUniformMemoryMask;
+ case vtn_variable_mode_workgroup:
+ return SpvMemorySemanticsWorkgroupMemoryMask;
+ case vtn_variable_mode_cross_workgroup:
+ return SpvMemorySemanticsCrossWorkgroupMemoryMask;
+ case vtn_variable_mode_atomic_counter:
+ return SpvMemorySemanticsAtomicCounterMemoryMask;
+ case vtn_variable_mode_image:
+ return SpvMemorySemanticsImageMemoryMask;
+ case vtn_variable_mode_output:
+ return SpvMemorySemanticsOutputMemoryMask;
+ default:
+ return SpvMemorySemanticsMaskNone;
+ }
+}
+
void
vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
const uint32_t *w, unsigned count)
if (access & SpvMemoryAccessMakePointerVisibleMask) {
SpvMemorySemanticsMask semantics =
SpvMemorySemanticsMakeVisibleMask |
- vtn_storage_class_to_memory_semantics(src->ptr_type->storage_class);
+ vtn_mode_to_memory_semantics(src->mode);
vtn_emit_memory_barrier(b, scope, semantics);
}
if (access & SpvMemoryAccessMakePointerAvailableMask) {
SpvMemorySemanticsMask semantics =
SpvMemorySemanticsMakeAvailableMask |
- vtn_storage_class_to_memory_semantics(dest->ptr_type->storage_class);
+ vtn_mode_to_memory_semantics(dest->mode);
vtn_emit_memory_barrier(b, scope, semantics);
}
break;