diff options
| author | Yong He <yonghe@outlook.com> | 2025-07-21 21:35:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-22 04:35:44 +0000 |
| commit | 9d47a352960efd71494c7dfa0918debd5b405077 (patch) | |
| tree | f0acf898cb5c4de8a1951ac8010168b119bf94ff /tests/language-feature/types | |
| parent | 9adac4069fbcc7ce5bea2c42d19c61eb1dcd7f25 (diff) | |
Fix Conditioanl<T, false> fields with a semantic. (#7855)
* Fix Conditioanl<T, false> fields with a semantic.
* Add unit test.
* Fix test.
Diffstat (limited to 'tests/language-feature/types')
| -rw-r--r-- | tests/language-feature/types/conditional-varying.slang | 23 |
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 |
