mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-13 08:36:08 +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
441 B
HLSL
23 lines
441 B
HLSL
uint atomicSub_1(RWByteAddressBuffer buffer, uint offset, uint value) {
|
|
uint original_value = 0;
|
|
buffer.InterlockedAdd(offset, -value, original_value);
|
|
return original_value;
|
|
}
|
|
|
|
RWByteAddressBuffer sb_rw : register(u0, space0);
|
|
|
|
void atomicSub_15bfc9() {
|
|
uint res = atomicSub_1(sb_rw, 0u, 1u);
|
|
}
|
|
|
|
void fragment_main() {
|
|
atomicSub_15bfc9();
|
|
return;
|
|
}
|
|
|
|
[numthreads(1, 1, 1)]
|
|
void compute_main() {
|
|
atomicSub_15bfc9();
|
|
return;
|
|
}
|