summaryrefslogtreecommitdiff
path: root/tests/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/vk-offset.slang34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/diagnostics/vk-offset.slang b/tests/diagnostics/vk-offset.slang
new file mode 100644
index 000000000..5dbd821c6
--- /dev/null
+++ b/tests/diagnostics/vk-offset.slang
@@ -0,0 +1,34 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -entry vertexMain -stage vertex
+
+// CHECK: error 31002: attribute 'vk_offset' is not valid here
+// CHECK-NEXT: [vk::offset(16)]] struct S1
+// CHECK: error 31002: attribute 'vk_offset' is not valid here
+// CHECK-NEXT: [vk::offset(8)]] VertexOutput output;
+
+[[vk::offset(16)]] struct S1
+{
+ [[vk::offset(32)]]
+ float2 a;
+
+ float3 b;
+
+ [[vk::offset(16)]]
+ float4 c;
+ }
+
+[[vk::push_constant]]
+S1 pc;
+
+struct VertexOutput
+{
+ float3 position : SV_Position;
+}
+
+[shader("vertex")]
+VertexOutput vertexMain()
+{
+ [[vk::offset(8)]] VertexOutput output;
+ output.position = float3(pc.a.x, pc.b.y, pc.c.z);
+ return output;
+}
+