summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/get-vertex-attribute.slang13
-rw-r--r--tests/spirv/get-vertex-attribute.slang15
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/diagnostics/get-vertex-attribute.slang b/tests/diagnostics/get-vertex-attribute.slang
new file mode 100644
index 000000000..613a5a7c8
--- /dev/null
+++ b/tests/diagnostics/get-vertex-attribute.slang
@@ -0,0 +1,13 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+struct VertexOutput
+{
+ float color;
+}
+
+[shader("fragment")]
+float4 fsmain(VertexOutput vout) : SV_Target
+{
+ // CHECK: ([[# @LINE+1]]): error 39027
+ return GetAttributeAtVertex(vout.color, 0); // error: color must be decorated with `nointerpolation`.
+}
diff --git a/tests/spirv/get-vertex-attribute.slang b/tests/spirv/get-vertex-attribute.slang
new file mode 100644
index 000000000..655b7ad03
--- /dev/null
+++ b/tests/spirv/get-vertex-attribute.slang
@@ -0,0 +1,15 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-via-glsl
+
+// CHECK: OpDecorate %vout_vertexID{{.*}} PerVertexKHR
+
+struct VertexOutput
+{
+ nointerpolation int vertexID;
+}
+
+[shader("fragment")]
+float4 fsmain(VertexOutput vout) : SV_Target
+{
+ return GetAttributeAtVertex(vout.vertexID, 0);
+}