21 lines
656 B
Plaintext
21 lines
656 B
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
|
|
struct atomic_compare_exchange_resultu32 {
|
|
uint old_value;
|
|
bool exchanged;
|
|
};
|
|
atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device atomic_uint* atomic, uint compare, uint value) {
|
|
uint old_value = compare;
|
|
bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed);
|
|
return {old_value, exchanged};
|
|
}
|
|
|
|
kernel void tint_symbol(device atomic_uint* tint_symbol_1 [[buffer(0)]]) {
|
|
uint value = 42u;
|
|
atomic_compare_exchange_resultu32 const result = atomicCompareExchangeWeak_1(tint_symbol_1, 0u, value);
|
|
return;
|
|
}
|
|
|