summaryrefslogtreecommitdiff
path: root/tests/language-feature
diff options
context:
space:
mode:
Diffstat (limited to 'tests/language-feature')
-rw-r--r--tests/language-feature/types/conditional-varying.slang23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/language-feature/types/conditional-varying.slang b/tests/language-feature/types/conditional-varying.slang
new file mode 100644
index 000000000..674ae96e7
--- /dev/null
+++ b/tests/language-feature/types/conditional-varying.slang
@@ -0,0 +1,23 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+//TEST:SIMPLE(filecheck=HLSL): -target hlsl -entry fragMain -profile ps_6_0
+
+// CHECK: OpEntryPoint
+// HLSL: float4 fragMain() : SV_TARGET
+
+extern static const bool enableConditional = false;
+
+struct Vertex
+{
+ Conditional<float3, enableConditional> color : COLOR;
+}
+
+[shader("fragment")]
+float4 fragMain(Vertex v) : SV_Target
+{
+ if (let c = v.color.get())
+ {
+ // This block should not be executed.
+ return float4(c, 1.0f);
+ }
+ return float4(0.0f, 0.0f, 0.0f, 1.0f);
+} \ No newline at end of file