summaryrefslogtreecommitdiffstats
path: root/tests/metal/discard.slang
blob: b670e462aa7a5ec3ecde8e846ac66936af806b58 (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=METAL): -target metal
//TEST:SIMPLE(filecheck=METALLIB): -target metallib

// METAL: discard_fragment();

// METALLIB: define {{.*}} @main_fragment1

struct VOut
{
    float4 position : SV_Position;
    float4 vertexColor;
    float2 vertexUV;
    float3 vertexNormal : NORMAL;
}

[shader("fragment")]
float4 main_fragment1(VOut fragmentIn)
{
    if (fragmentIn.vertexColor.x == 0.0)
        discard;
    return fragmentIn.vertexColor;
}