| #include <metal_stdlib> |
| |
| using namespace metal; |
| uint tint_workgroupUniformLoad(threadgroup uint* const p) { |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| uint const result = *(p); |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| return result; |
| } |
| |
| void tint_symbol_inner(uint3 global_id, uint3 local_id, uint local_invocation_index, threadgroup uint* const tint_symbol_1, device uint* const tint_symbol_2) { |
| if ((local_invocation_index < 1u)) { |
| *(tint_symbol_1) = 0u; |
| } |
| threadgroup_barrier(mem_flags::mem_threadgroup); |
| uint const failed = tint_workgroupUniformLoad(tint_symbol_1); |
| if ((local_id[0] == 0u)) { |
| *(tint_symbol_2) = failed; |
| } |
| } |
| |
| kernel void tint_symbol(device uint* tint_symbol_4 [[buffer(0)]], uint3 global_id [[thread_position_in_grid]], uint3 local_id [[thread_position_in_threadgroup]], uint local_invocation_index [[thread_index_in_threadgroup]]) { |
| threadgroup uint tint_symbol_3; |
| tint_symbol_inner(global_id, local_id, local_invocation_index, &(tint_symbol_3), tint_symbol_4); |
| return; |
| } |
| |