summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi/tex1d/texture1d.frag
blob: e5e0f3a6cad73b5c279c0367a18461937b667267 (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 440

layout(location = 0) in vec2 v_texcoord;

layout(location = 0) out vec4 fragColor;

layout(std140, binding = 0) uniform buf {
    int idx;
} ubuf;

layout(binding = 1) uniform sampler1D tex;
layout(binding = 2) uniform sampler1DArray texArray;
layout(binding = 3) uniform sampler1D texA;
layout(binding = 4) uniform sampler1DArray texArrayA;
layout(binding = 5) uniform sampler1D texB;
layout(binding = 6) uniform sampler1D texC;
layout(binding = 7) uniform sampler1DArray texArrayB;

void main()
{
    vec4 c = vec4(v_texcoord, 0, 1);

    vec2 coord = vec2(v_texcoord.x, floor(v_texcoord.y*2));

    switch((ubuf.idx/(60*2))%7) {
    case 0:
        c = textureLod(tex, v_texcoord.x, float((ubuf.idx/30)%4));
        break;
    case 1:
        c = textureLod(texArray, coord, float((ubuf.idx/30)%4));
        break;
    case 2:
        c = textureLod(texA, v_texcoord.x, float((ubuf.idx/30)%4));
        break;
    case 3:
        c = textureLod(texArrayA, coord, float((ubuf.idx/30)%4));
        break;
    case 4:
        c = texture(texB, v_texcoord.x);
        break;
    case 5:
        c = texture(texC, v_texcoord.x);
        break;
    case 6:
        c = texture(texArrayB, coord);
        break;
    }

    fragColor = vec4(c.rgb*c.a, c.a);

}