summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/glslang/src/Test/spv.shortCircuit.frag
blob: ca031c2d00c3dd49bd62c6c6ae71e6b0fcfadbcf (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
45
46
47
48
49
50
#version 400

flat in ivec4 uiv4;
in vec4 uv4;
bool ub;
bool uba;
bvec4 ub41, ub42;
in float uf;
flat in int ui;

out float of1;
out vec4  of4;

bool foo() { ++of1; return of1 > 10.0; }

void main()
{
    of1 = 0.0;
    of4 = vec4(0.0);

    if (ub || ui > 2)  // not worth short circuiting
        ++of1;

    if (ub && !uba)  // not worth short circuiting
        ++of1;

    if (ub || foo())   // must short circuit
        ++of1;

    if (ub && foo())   // must short circuit
        ++of1;

    if (foo() || ub)   // not worth short circuiting
        ++of1;

    if (foo() && ub)   // not worth short circuiting
        ++of1;

    if (ub || ++of1 > 1.0)   // must short circuit
        ++of4;

    if (++of1 > 1.0 || ub)   // not worth short circuiting
        ++of4;

    if (ub || sin(uf) * 4.0 > of1)  // worth short circuiting
        ++of1;

    if (ub && sin(uf) * 4.0 > of1)  // worth short circuiting
        ++of1;
}