summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/invalid-vector-element-count.slang15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/diagnostics/invalid-vector-element-count.slang b/tests/diagnostics/invalid-vector-element-count.slang
new file mode 100644
index 000000000..b801dfd07
--- /dev/null
+++ b/tests/diagnostics/invalid-vector-element-count.slang
@@ -0,0 +1,15 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target spirv
+
+RWStructuredBuffer<vector<float, 8>> bufferIn1;
+RWStructuredBuffer<vector<float, 0>> bufferIn2;
+RWStructuredBuffer<float> resultOut;
+
+[shader("compute")]
+[numthreads(32,1,1)]
+void computeMain(uint3 threadId : SV_DispatchThreadID)
+{
+ // CHECK: error 38203: vector has invalid element count '0', valid values are between '1' and '4' inclusive
+ // CHECK: error 38203: vector has invalid element count '8', valid values are between '1' and '4' inclusive
+ uint index = threadId.x;
+ resultOut[index] = bufferIn1[index][0] + bufferIn2[index][0];
+}