summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/glslang/src/Test/functionCall.frag
blob: ca2866271c6e60023b17cdaf676871c50c048ab9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#version 130

uniform vec4 bigColor;
varying vec4 BaseColor;
uniform float d;

float h = 0.0;

float foo(vec4 bar)
{
    return bar.x + bar.y;
}

void bar()
{
}

float unreachableReturn()
{
    if (d < 4.2)
        return 1.2;
    else
        return 4.5;
    // might be another return inserted here by builders, has to be correct type
}

float missingReturn()
{
    if (d < 4.5) {
        h = d;
        return 3.9;
    }
}

void main()
{
    vec4 color = vec4(foo(BaseColor));

    bar();
    float f = unreachableReturn();
    float g = missingReturn();
    
    gl_FragColor = color * f * h;
}