dawn-cmake/test/tint/statements/discard/atomic_cmpxchg.wgsl
James Price 8cd34f8425 tint: Fix DemoteToHelper for atomicCmpXchgWeak
We cannot explicitly name the result type of this builtin, so we have
to redeclare it manually.

Fixed: oss-fuzz:53347, oss-fuzz:53343
Change-Id: I23816b8b35eb20ae91472143ab30668b573d65bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110160
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
2022-11-14 20:30:38 +00:00

13 lines
252 B
WebGPU Shading Language

@group(0) @binding(0) var<storage, read_write> a : atomic<i32>;
@fragment
fn foo() -> @location(0) i32 {
discard;
var x = 0;
let result = atomicCompareExchangeWeak(&a, 0, 1);
if (result.exchanged) {
x = result.old_value;
}
return x;
}