summaryrefslogtreecommitdiffstats
path: root/tests/spirv/discard.slang
blob: e0859371e1253104b311441ea7362bbfb6ba2cf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//TEST:SIMPLE(filecheck=SPV16): -target spirv -profile spirv_1_6
//TEST:SIMPLE(filecheck=SPV15): -target spirv -profile spirv_1_5
//TEST:SIMPLE(filecheck=SPV14): -target spirv -profile spirv_1_4+SPV_EXT_demote_to_helper_invocation

uniform int a;

// Test that we translate `discard` to OpDemoateToHelperInvocation
// when targeting SPIRV 1.6, and to OpKill when targeting SPIRV 1.5.
// If the user explicitly specified SPV_EXT_demote_to_helper_invocation
// in the profile, we will also emit OpDemoteToHelperInvocation.

//SPV16: OpDemoteToHelperInvocation
//SPV15: OpKill
//SPV14: OpDemoteToHelperInvocation

[shader("fragment")]
float4 frag() : SV_Target
{
    if (a == 0)
        discard;
    return 0;
}