summaryrefslogtreecommitdiff
path: root/tests/diagnostics
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-06-08 05:12:49 -0700
committerGitHub <noreply@github.com>2024-06-08 05:12:49 -0700
commit9a23a9aab3721828526c921db1e779008e133e8f (patch)
treeb49448075cdffe278fd6760e2879bc061eb8e0af /tests/diagnostics
parentbc680e74bd8a0c415cab5ed6fe00b762c26b8b8d (diff)
SPIRV `Block` decoration fixes. (#4303)
* SPIRV `Block` decoration fixes. - SPIRV does not allow duplicate `Block` decorations. So we shouldn't be generating them. - Also fixes duplication of OpName. - SPIRV and HLSL do not allow ConstantBuffer with trailing unsized arrays. Added a check in the front-end against such code. * Convert failing cross-compile tests to filecheck. --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/constant-buffer-unsized.slang21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/diagnostics/constant-buffer-unsized.slang b/tests/diagnostics/constant-buffer-unsized.slang
new file mode 100644
index 000000000..25644e803
--- /dev/null
+++ b/tests/diagnostics/constant-buffer-unsized.slang
@@ -0,0 +1,21 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+struct T2 {
+ float4 _m0;
+};
+
+[[vk::binding(0)]]
+cbuffer ubo : register(b0)
+{
+ int in_val;
+ // CHECK: ([[# @LINE+1]]): error 31215
+ T2 _z0[]; // error 31215: cannot use unsized type 'T2[]' in a constant buffer.
+}
+
+[shader("fragment")]
+float4 main() : SV_TARGET
+{
+ uint x = in_val;
+ float4 data = _z0[x]._m0;
+ return data;
+} \ No newline at end of file