mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-05 11:45:54 +00:00
This matches the term used in the WGSL spec. Change-Id: I4603332b828450c126ef806f1064ed54f372013f Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78787 Reviewed-by: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
24 lines
579 B
HLSL
24 lines
579 B
HLSL
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;
|
|
}
|
|
|
|
RWByteAddressBuffer sb_rw : register(u0, space0);
|
|
|
|
void atomicCompareExchangeWeak_6673da() {
|
|
uint2 res = atomicCompareExchangeWeak_1(sb_rw, 0u, 1u, 1u);
|
|
}
|
|
|
|
void fragment_main() {
|
|
atomicCompareExchangeWeak_6673da();
|
|
return;
|
|
}
|
|
|
|
[numthreads(1, 1, 1)]
|
|
void compute_main() {
|
|
atomicCompareExchangeWeak_6673da();
|
|
return;
|
|
}
|