diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-04-23 14:40:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-23 14:40:01 -0400 |
| commit | 6f5c250b19b03a8eb4b6a9254613ce8539769a23 (patch) | |
| tree | fad6585589f143838a831f94ff07ec9a556ab7d2 /prelude | |
| parent | 806ab08f64c76e961ecdf40ecaf9499c5a88ac5f (diff) | |
Small improvements around atomics (#1333)
* Use the original value in the test.
Run test on VK.
* Added RWBuffer and Buffer types to C++ prelude.
* Add vk to atomics.slang tests
* Update target-compatibility around atomics.
When tests disabled in atomics-buffer.slang explained why.
* tabs -> spaces.
* Small docs improvement.
Diffstat (limited to 'prelude')
| -rw-r--r-- | prelude/slang-cpp-types.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/prelude/slang-cpp-types.h b/prelude/slang-cpp-types.h index 415d7f941..d57ac0e09 100644 --- a/prelude/slang-cpp-types.h +++ b/prelude/slang-cpp-types.h @@ -116,6 +116,29 @@ struct StructuredBuffer size_t count; }; + +template <typename T> +struct RWBuffer +{ + SLANG_FORCE_INLINE T& operator[](size_t index) const { SLANG_PRELUDE_ASSERT(index < count); return data[index]; } + const T& Load(size_t index) const { SLANG_PRELUDE_ASSERT(index < count); return data[index]; } + void GetDimensions(uint32_t& outCount) { outCount = uint32_t(count); } + + T* data; + size_t count; +}; + +template <typename T> +struct Buffer +{ + SLANG_FORCE_INLINE const T& operator[](size_t index) const { SLANG_PRELUDE_ASSERT(index < count); return data[index]; } + const T& Load(size_t index) const { SLANG_PRELUDE_ASSERT(index < count); return data[index]; } + void GetDimensions(uint32_t& outCount) { outCount = uint32_t(count); } + + T* data; + size_t count; +}; + // Missing Load(_In_ int Location, _Out_ uint Status); struct ByteAddressBuffer { |
