diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-01-28 12:41:09 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-28 12:41:09 -0500 |
| commit | b3e0b0d491c55bfdc1c40d26a421910103c1b9f2 (patch) | |
| tree | 27f58dc4bdf49cd786644adda6d59fbe333a1a4a /prelude | |
| parent | 5c6ab6d5198ebff276da9cb8d3024802f22ba9f3 (diff) | |
Synthesizing CUDA tests (#1183)
* When using setUniform clamp the amount of data written to the buffer size.
* CUDA implement StructuredBuffer/ByteAddressBuffer as pointer/count as is on CPU.
Allow bounds check to zero index.
Update docs.
* Synthesize tests.
* Fix bug in CUDA output.
* Fixing more tests to run on CUDA.
* Added BaseType for layout of Vector and Matrix - as they are held as int32_t vector array types.
* Enable unbound array support on CUDA.
* Added unsized array support for CUDA documentation.
Diffstat (limited to 'prelude')
| -rw-r--r-- | prelude/slang-cuda-prelude.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/prelude/slang-cuda-prelude.h b/prelude/slang-cuda-prelude.h index 63388c7f3..7e6e5957d 100644 --- a/prelude/slang-cuda-prelude.h +++ b/prelude/slang-cuda-prelude.h @@ -38,6 +38,18 @@ struct FixedArray T m_data[SIZE]; }; +// An array that has no specified size, becomes a 'Array'. This stores the size so it can potentially +// do bounds checking. +template <typename T> +struct Array +{ + SLANG_CUDA_CALL const T& operator[](size_t index) const { SLANG_CUDA_BOUND_CHECK(index, count); return data[index]; } + SLANG_CUDA_CALL T& operator[](size_t index) { SLANG_CUDA_BOUND_CHECK(index, count); return data[index]; } + + T* data; + size_t count; +}; + // Typically defined in cuda.h, but we can't ship/rely on that, so just define here typedef unsigned long long CUtexObject; typedef unsigned long long CUsurfObject; @@ -49,6 +61,11 @@ typedef unsigned long long CUsurfObject; struct SamplerStateUnused; typedef SamplerStateUnused* SamplerState; + +// TODO(JS): Not clear yet if this can be handled on CUDA, by just ignoring. +// For now, just map to the index type. +typedef size_t NonUniformResourceIndex; + // Code generator will generate the specific type template <typename T, int ROWS, int COLS> struct Matrix; |
