2021-07-09 16:50:14 +00:00
|
|
|
uint2 atomicCompareExchangeWeak_1(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) {
|
|
|
|
uint2 result = {0, 0};
|
|
|
|
buffer.InterlockedCompareExchange(offset, compare, value, result.x);
|
|
|
|
result.y = result.x == compare;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-06-18 18:56:13 +00:00
|
|
|
RWByteAddressBuffer sb_rw : register(u0, space0);
|
2021-06-18 18:56:13 +00:00
|
|
|
|
2021-06-18 18:56:13 +00:00
|
|
|
void atomicCompareExchangeWeak_6673da() {
|
2021-07-09 16:50:14 +00:00
|
|
|
uint2 res = atomicCompareExchangeWeak_1(sb_rw, 0u, 1u, 1u);
|
2021-06-18 18:56:13 +00:00
|
|
|
}
|
2021-06-18 18:56:13 +00:00
|
|
|
|
2021-06-18 18:56:13 +00:00
|
|
|
void fragment_main() {
|
|
|
|
atomicCompareExchangeWeak_6673da();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
[numthreads(1, 1, 1)]
|
|
|
|
void compute_main() {
|
|
|
|
atomicCompareExchangeWeak_6673da();
|
|
|
|
return;
|
|
|
|
}
|