summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-05-14 03:01:47 -0400
committerGitHub <noreply@github.com>2025-05-14 07:01:47 +0000
commiteb5648b41d0718648477cbcf941fb3c6edf6dfc7 (patch)
tree73f19cd4b4f66d0ce6fbbd61c9a1253969cc3139 /tests/diagnostics
parent04ba87e23435e76583c05d4530d63686f9af712f (diff)
Error out on invalid vector sizes (#7076)
* Error out on invalid vector sizes * Remove unnecessary include * Fix incorrect assert * Add test
Diffstat (limited to 'tests/diagnostics')
-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];
+}