mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-13 00:26:00 +00:00
Polyfill this for HLSL using an atomic add with the operand negated. Fixed: tint:1130 Change-Id: Ifa32d58973f1b48593ec0f6320f47f4358a5a3a9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/62760 Auto-Submit: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
23 lines
436 B
HLSL
23 lines
436 B
HLSL
int atomicSub_1(RWByteAddressBuffer buffer, uint offset, int value) {
|
|
int original_value = 0;
|
|
buffer.InterlockedAdd(offset, -value, original_value);
|
|
return original_value;
|
|
}
|
|
|
|
RWByteAddressBuffer sb_rw : register(u0, space0);
|
|
|
|
void atomicSub_051100() {
|
|
int res = atomicSub_1(sb_rw, 0u, 1);
|
|
}
|
|
|
|
void fragment_main() {
|
|
atomicSub_051100();
|
|
return;
|
|
}
|
|
|
|
[numthreads(1, 1, 1)]
|
|
void compute_main() {
|
|
atomicSub_051100();
|
|
return;
|
|
}
|