summaryrefslogtreecommitdiff
path: root/tests/spirv/optional-vertex-output.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-18 11:33:55 -0800
committerGitHub <noreply@github.com>2024-12-18 11:33:55 -0800
commitae04e604d43d169bcba7f24c8c23a0fdf4cbb483 (patch)
tree899c872ec5cc5c6ccc27930ef6971a0baf018569 /tests/spirv/optional-vertex-output.slang
parent41c627fd420a644f0ae86e36f4752e820e2d683c (diff)
Allow `Optional`, `Tuple` and `bool` to be used in varying input/output. (#5889)
* Allow `Optional` and `Tuple` to be used in varying input/output. * Fix. * format code * Fix. * Fix test. * Fix. * enhance test. * Fix. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/spirv/optional-vertex-output.slang')
-rw-r--r--tests/spirv/optional-vertex-output.slang26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/spirv/optional-vertex-output.slang b/tests/spirv/optional-vertex-output.slang
new file mode 100644
index 000000000..df15befa2
--- /dev/null
+++ b/tests/spirv/optional-vertex-output.slang
@@ -0,0 +1,26 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+// Test that we can use Optional<T> or bool types in varying input or outputs.
+
+// CHECK: OpDecorate %i_inA_value Location 0
+// CHECK: OpDecorate %i_inA_hasValue Location 1
+// CHECK: OpDecorate %entryPointParam_vertMain_a_value Location 0
+// CHECK: OpDecorate %entryPointParam_vertMain_a_hasValue Location 1
+
+struct VIn {
+ Optional<float> inA;
+}
+
+struct VSOut {
+ Optional<float> a;
+ bool outputValues[3];
+};
+
+[shader("vertex")]
+VSOut vertMain(VIn i)
+{
+ VSOut o;
+ o.a = i.inA;
+ o.outputValues = { true, false, true };
+ return o;
+} \ No newline at end of file