diff options
| author | Yong He <yonghe@outlook.com> | 2025-02-05 22:35:36 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-05 22:35:36 -0800 |
| commit | 6b63ff0265ee9bdb8229bb12c71c223c00de0ffa (patch) | |
| tree | 8010accc99d1f5f20465e8eeb2012f37a6f5534f /tests/initializer-list | |
| parent | 78f26f076d406a3818800b57afe4d0c2eb166269 (diff) | |
Allow tuples to work with initializer list. (#6301)
* Allow tuples to work with initiailizer list.
* Update definition of C-Style types.
Diffstat (limited to 'tests/initializer-list')
| -rw-r--r-- | tests/initializer-list/tuple.slang | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/initializer-list/tuple.slang b/tests/initializer-list/tuple.slang new file mode 100644 index 000000000..4da73c0b2 --- /dev/null +++ b/tests/initializer-list/tuple.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-output-using-type + +Tuple<bool, float> createTuple() { + return {}; +} + +// We should also enable the following use of initialization list: + +Tuple<bool, float> createTuple2() { + return {false, 1.0}; +} + + +//TEST_INPUT: set output = out ubuffer(data=[0 0 0 0], stride=4) +RWStructuredBuffer<float> output; + +[numthreads(1, 1, 1)] +void computeMain() +{ + let hit = createTuple(); + output[0] = hit._1 + 1.0; + + let hit2 = createTuple2(); + output[1] = hit2._1 + 1.0; + // CHECK: 1.0 + // CHECK: 2.0 +}
\ No newline at end of file |
