summaryrefslogtreecommitdiff
path: root/tests/spirv/flat.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-06-10 12:32:17 -0700
committerGitHub <noreply@github.com>2024-06-10 12:32:17 -0700
commit38c0baccac70ca36a2c90218d6a92b8c036b1a5e (patch)
tree0bc29bad69dc988777e1275b707c1d92737dcd7f /tests/spirv/flat.slang
parentb5cdd8322bd51603c217dfb7662306628b144c78 (diff)
Fix SPIRV emit for `Flat` decoration and TessLevel builtin. (#4318)
Diffstat (limited to 'tests/spirv/flat.slang')
-rw-r--r--tests/spirv/flat.slang27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/spirv/flat.slang b/tests/spirv/flat.slang
new file mode 100644
index 000000000..660f61216
--- /dev/null
+++ b/tests/spirv/flat.slang
@@ -0,0 +1,27 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+// Check that we don't emit duplicate Flat decorations for the same variable.
+
+// CHECK: OpDecorate %vo_a Flat
+// CHECK-NOT: OpDecorate %vo_a Flat
+
+struct VertexOutput
+{
+ nointerpolation int a : SOME_VALUE;
+ float4 b : SV_Position;
+};
+
+[shader("vertex")]
+VertexOutput Vertex()
+{
+ VertexOutput out;
+ out.a = 0;
+ out.b = float4(0, 0, 0, 1);
+ return out;
+}
+
+[shader("fragment")]
+float4 Fragment(in VertexOutput vo)
+{
+ return float4(float(vo.a), 0, 0, 1);
+} \ No newline at end of file