Commit Graph

4 Commits

Author SHA1 Message Date
Ben Clayton e027e81bf2 writer/hlsl: Emit helper functions for storage class atomic intrinsics
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>
2021-07-09 16:50:14 +00:00
Ben Clayton 1843c0b8d7 [writer/hlsl]: Fix order of atomic method arguments.
Change-Id: Ice1b07c748bc6502a51b29690dfc00466a684c12
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57461
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-09 12:35:54 +00:00
Ben Clayton e6d171ac66 writer/hlsl: Implement atomics
Storage buffers are emitted as `ByteAddressBuffer`s in HLSL, so we have to jump through hoops to support atomic ops on storage buffer atomics.
Workgroup atomics are far more conventional, but very little code can be shared between these two code paths.

Bug: tint:892
Change-Id: If10ea866e3b67a093e87aca689d34065fd49b705
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54651
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-18 18:56:13 +00:00
Ben Clayton 6a77236d8c intrinsics.def: Add atomic intrinsics
Change-Id: I26a9ce9e1978aa2542ce2b3f17c9f5861e556a8a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54657
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-06-18 18:56:13 +00:00