From 6b63ff0265ee9bdb8229bb12c71c223c00de0ffa Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 5 Feb 2025 22:35:36 -0800 Subject: Allow tuples to work with initializer list. (#6301) * Allow tuples to work with initiailizer list. * Update definition of C-Style types. --- tests/initializer-list/tuple.slang | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/initializer-list/tuple.slang (limited to 'tests/initializer-list') 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 createTuple() { + return {}; +} + +// We should also enable the following use of initialization list: + +Tuple createTuple2() { + return {false, 1.0}; +} + + +//TEST_INPUT: set output = out ubuffer(data=[0 0 0 0], stride=4) +RWStructuredBuffer 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 -- cgit v1.2.3