diff options
| author | Yong He <yonghe@outlook.com> | 2024-10-17 20:14:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-17 20:14:22 -0700 |
| commit | a618b8c5e249b0f20e6c0c95f9da1b5cbfdbf08b (patch) | |
| tree | d583c373d574a265fefe7f288a96c4b382e259b8 /prelude | |
| parent | 11e1ecafa09396a3559fe245d729b40ce4f25d52 (diff) | |
Cleanup atomic intrinsics. (#5324)
* Cleanup atomic intrinsics.
* Fix.
* Fix glsl.
* Remove hacky intrinsic expansion logic for glsl image atomics.
* Fix all tests.
* Fix.
* Add `InterlockedAddF16Emulated`.
* Fix glsl intrinsic.
* Fix.
Diffstat (limited to 'prelude')
| -rw-r--r-- | prelude/slang-cuda-prelude.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/prelude/slang-cuda-prelude.h b/prelude/slang-cuda-prelude.h index 96ef22dd1..a6c8fd17b 100644 --- a/prelude/slang-cuda-prelude.h +++ b/prelude/slang-cuda-prelude.h @@ -1261,7 +1261,14 @@ struct ByteAddressBuffer memcpy(&data, ((const char*)this->data) + index, sizeof(T)); return data; } - + template<typename T> + SLANG_CUDA_CALL StructuredBuffer<T> asStructuredBuffer() const + { + StructuredBuffer<T> rs; + rs.data = (T*)data; + rs.count = sizeInBytes / sizeof(T); + return rs; + } const uint32_t* data; size_t sizeInBytes; //< Must be multiple of 4 }; @@ -1348,7 +1355,14 @@ struct RWByteAddressBuffer SLANG_BOUND_CHECK_BYTE_ADDRESS(index, sizeof(T), sizeInBytes); return (T*)(((char*)data) + index); } - + template<typename T> + SLANG_CUDA_CALL RWStructuredBuffer<T> asStructuredBuffer() const + { + RWStructuredBuffer<T> rs; + rs.data = (T*)data; + rs.count = sizeInBytes / sizeof(T); + return rs; + } uint32_t* data; size_t sizeInBytes; //< Must be multiple of 4 }; |
