summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/glslang/src/Test/spv.specConstant.vert
blob: 871220a2a1816df26d5950dbe227fc52543f154c (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
51
#version 400

layout(constant_id = 16) const int arraySize = 5;
in vec4 ucol[arraySize];

layout(constant_id = 17) const bool spBool = true;
layout(constant_id = 18) const float spFloat = 3.14;
layout(constant_id = 19) const double spDouble = 3.1415926535897932384626433832795;
layout(constant_id = 22) const uint scale = 2;

layout(constant_id = 24) gl_MaxImageUnits;

out vec4 color;
out int size;

// parameter should be considered same type as ucol
void foo(vec4 p[arraySize]);

void main()
{
    color = ucol[2];
    size = arraySize;
    if (spBool)
        color *= scale;
    color += float(spDouble / spFloat);

    foo(ucol);
}

layout(constant_id = 116) const int dupArraySize = 12;
in vec4 dupUcol[dupArraySize];

layout(constant_id = 117) const bool spDupBool = true;
layout(constant_id = 118) const float spDupFloat = 3.14;
layout(constant_id = 119) const double spDupDouble = 3.1415926535897932384626433832795;
layout(constant_id = 122) const uint dupScale = 2;

void foo(vec4 p[arraySize])
{
    color += dupUcol[2];
    size += dupArraySize;
    if (spDupBool)
        color *= dupScale;
    color += float(spDupDouble / spDupFloat);
}

int builtin_spec_constant()
{
    int result = gl_MaxImageUnits;
    return result;
}