summaryrefslogtreecommitdiff
path: root/tests/spirv
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/spirv
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/spirv')
-rw-r--r--tests/spirv/block-decoration.slang18
-rw-r--r--tests/spirv/varying-out-index.slang6
2 files changed, 21 insertions, 3 deletions
diff --git a/tests/spirv/block-decoration.slang b/tests/spirv/block-decoration.slang
new file mode 100644
index 000000000..e6d350dcd
--- /dev/null
+++ b/tests/spirv/block-decoration.slang
@@ -0,0 +1,18 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+// Check that we don't produce duplicate `Block` decorations.
+
+// CHECK: OpDecorate %RWStructuredBuffer Block
+// CHECK-NOT: OpDecorate %RWStructuredBuffer Block
+
+struct Particle {
+ float4 _m0;
+};
+
+[[vk::binding(0)]]
+RWStructuredBuffer<Particle> particleOut;
+
+[shader("fragment")]
+float4 main() : SV_TARGET {
+ return particleOut[0]._m0;
+} \ No newline at end of file
diff --git a/tests/spirv/varying-out-index.slang b/tests/spirv/varying-out-index.slang
index 6448f2266..e4c4400f5 100644
--- a/tests/spirv/varying-out-index.slang
+++ b/tests/spirv/varying-out-index.slang
@@ -12,9 +12,9 @@ struct PS_OUTPUT
};
-// CHECK: OpDecorate %MainPS_vColor Location 0
-// CHECK: OpDecorate %MainPS_vColor2 Location 0
-// CHECK: OpDecorate %MainPS_vColor2 Index 1
+// CHECK: OpDecorate %{{.*}}MainPS_vColor Location 0
+// CHECK: OpDecorate %{{.*}}MainPS_vColor2 Location 0
+// CHECK: OpDecorate %{{.*}}MainPS_vColor2 Index 1
PS_OUTPUT MainPS()
{