File: fs-texture-select.shader_test

package info (click to toggle)
piglit 0~git20200212-f4710c51b-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 106,972 kB
  • sloc: ansic: 263,763; xml: 48,941; python: 29,918; lisp: 19,789; cpp: 12,142; sh: 22; makefile: 20; pascal: 5
file content (39 lines) | stat: -rw-r--r-- 929 bytes parent folder | download | duplicates (2)
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
# Even columns fetch from tex0 (black), while odd columns fetch from tex1 (white).
# The shader inverts the color of even collumns to get make them white,
# so the final image should be completely white.
#
# At the moment, radeonsi miscompiles this shader and only fetches from tex0
# in both cases.

[require]
GLSL >= 1.10

[vertex shader]
void main()
{
	gl_Position = gl_Vertex;
	gl_TexCoord[0] = vec4(0.0);
}

[fragment shader]
uniform sampler2D tex0, tex1;

void main()
{
    bool pat = fract(gl_FragCoord.x / 2.0) < 0.5;
    gl_FragColor = pat ?
             texture2D(tex0, gl_TexCoord[0].xy) :
             texture2D(tex1, gl_TexCoord[0].xy);

    if (pat)
        gl_FragColor = vec4(1.0) - gl_FragColor;
}

[test]
texture checkerboard 0 0 (8, 8) (0, 0, 0, 0) (0, 0, 0, 0)
texture checkerboard 1 0 (8, 8) (1, 1, 1, 1) (1, 1, 1, 1)

uniform int tex0 0
uniform int tex1 1
draw rect -1 -1 2 2
probe all rgba 1.0 1.0 1.0 1.0