mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-12 16:15:55 +00:00
By generating a helper function for these, we can keep the atomic expression pre-statement-free. This can help prevent for-loops from being transformed into while loops, which can upset FXC. We can't do the same for workgroup storage atomics, as the InterlockedXXX() methods have the workgroup-storage expression as the first argument, and I'm not aware of any way to make a user-declared parameter be `groupshared`. Change-Id: I8669127a58dc9cae95ce316523029064b5c9b5fa Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57462 Commit-Queue: James Price <jrprice@google.com> Auto-Submit: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com>
22 lines
401 B
HLSL
22 lines
401 B
HLSL
void atomicStore_1(RWByteAddressBuffer buffer, uint offset, uint value) {
|
|
uint ignored;
|
|
buffer.InterlockedExchange(offset, value, ignored);
|
|
}
|
|
|
|
RWByteAddressBuffer sb_rw : register(u0, space0);
|
|
|
|
void atomicStore_cdc29e() {
|
|
atomicStore_1(sb_rw, 0u, 1u);
|
|
}
|
|
|
|
void fragment_main() {
|
|
atomicStore_cdc29e();
|
|
return;
|
|
}
|
|
|
|
[numthreads(1, 1, 1)]
|
|
void compute_main() {
|
|
atomicStore_cdc29e();
|
|
return;
|
|
}
|