blob: 7b22eef2270a8546ded1c703e07054881c9ba29d [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct atomic_compare_exchange_result_i32 {
int old_value;
bool exchanged;
};
atomic_compare_exchange_result_i32 atomicCompareExchangeWeak_1(device atomic_int* atomic, int compare, int value) {
int old_value = compare;
bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed);
return {old_value, exchanged};
}
struct tint_private_vars_struct {
bool tint_discarded;
};
struct tint_symbol_2 {
float4 value [[color(0)]];
};
float4 tint_symbol_inner(thread tint_private_vars_struct* const tint_private_vars, device atomic_int* const tint_symbol_4) {
if (false) {
(*(tint_private_vars)).tint_discarded = true;
}
atomic_compare_exchange_result_i32 tint_symbol_3 = {};
if (!((*(tint_private_vars)).tint_discarded)) {
tint_symbol_3 = atomicCompareExchangeWeak_1(tint_symbol_4, 0, 1);
}
atomic_compare_exchange_result_i32 const tint_symbol_1 = tint_symbol_3;
int const old_value = tint_symbol_1.old_value;
return float4(float(old_value));
}
fragment tint_symbol_2 tint_symbol(device atomic_int* tint_symbol_5 [[buffer(0)]]) {
thread tint_private_vars_struct tint_private_vars = {};
tint_private_vars.tint_discarded = false;
float4 const inner_result = tint_symbol_inner(&(tint_private_vars), tint_symbol_5);
tint_symbol_2 wrapper_result = {};
wrapper_result.value = inner_result;
if (tint_private_vars.tint_discarded) {
discard_fragment();
}
return wrapper_result;
}