yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeSupport different SPIRV versions. (#4254)c5a453e56

master
708 B22 linesraw
1//TEST:SIMPLE(filecheck=SPV16): -target spirv -profile spirv_1_6
2//TEST:SIMPLE(filecheck=SPV15): -target spirv -profile spirv_1_5
3//TEST:SIMPLE(filecheck=SPV14): -target spirv -profile spirv_1_4+SPV_EXT_demote_to_helper_invocation
4
5uniform int a;
6
7// Test that we translate `discard` to OpDemoateToHelperInvocation
8// when targeting SPIRV 1.6, and to OpKill when targeting SPIRV 1.5.
9// If the user explicitly specified SPV_EXT_demote_to_helper_invocation
10// in the profile, we will also emit OpDemoteToHelperInvocation.
11
12//SPV16: OpDemoteToHelperInvocation
13//SPV15: OpKill
14//SPV14: OpDemoteToHelperInvocation
15
16[shader("fragment")]
17float4 frag() : SV_Target
18{
19    if (a == 0)
20        discard;
21    return 0;
22}