diff options
Diffstat (limited to 'tests/cooperative-vector/subscript-in-func.slang')
| -rw-r--r-- | tests/cooperative-vector/subscript-in-func.slang | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/cooperative-vector/subscript-in-func.slang b/tests/cooperative-vector/subscript-in-func.slang new file mode 100644 index 000000000..74c7f86c3 --- /dev/null +++ b/tests/cooperative-vector/subscript-in-func.slang @@ -0,0 +1,26 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -xslang -skip-spirv-validation + +// CHECK: type: float +// CHECK-NEXT: 1.000000 +// CHECK-NEXT: 4.000000 +// CHECK-NEXT: 9.000000 +// CHECK-NEXT: 16.000000 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<float> outputBuffer; + +void squareCoopVecElements(CoopVec<float, 4> vec) +{ + for (int i = 0; i < 4; ++i) + { + vec[i] = vec[i] * vec[i]; + } + vec.store(outputBuffer, 0); +} + +[numthreads(1, 1, 1)] +void computeMain() +{ + CoopVec<float, 4> vec = CoopVec<float, 4>(1.0, 2.0, 3.0, 4.0); + squareCoopVecElements(vec); +} |
