summaryrefslogtreecommitdiff
path: root/tests/shaders/glsl-fs-functions-samplers.shader_test
blob: c4fd69aad62c6ddc9cb4cdf6420ea72a013cc092 (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
[require]
GLSL >= 1.10

[vertex shader]
varying vec2 tc1;
varying vec2 tc2;

void main()
{
	gl_Position = gl_Vertex;
	tc1 = (gl_Vertex.xy + 1.0) / 2.0;
	tc2 = tc1.yx;
}

[fragment shader]
varying vec2 tc1;
varying vec2 tc2;
uniform sampler2D tex1;
uniform sampler2D tex2;

vec4 blend_textures(sampler2D t1, vec2 tc1, sampler2D t2, vec2 tc2, float mixFactor)
{
	return mix(texture2D(t1, tc1), texture2D(t2, tc2), mixFactor);
}

void main()
{
	gl_FragColor = blend_textures(tex1, tc1, tex2, tc2, 0.5);
}

[test]
uniform int tex1 0
uniform int tex2 1
texture rgbw 0 (8, 8)
texture rgbw 1 (8, 8)
draw rect -1 -1 2 2
relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0)
relative probe rgb (0.75, 0.25) (0.0, 0.5, 0.5)
relative probe rgb (0.25, 0.75) (0.0, 0.5, 0.5)
relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0)