summaryrefslogtreecommitdiff
path: root/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-bitCount.shader_test
blob: a3a0db5a5a1fd937b55201df08a0dd551b5d9406 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
[require]
GLSL >= 1.50
GL_ARB_gpu_shader5

[vertex shader]
#extension GL_ARB_gpu_shader5 : enable

in vec4 vertex;
out vec4 color;

uniform ivec4 bits;
uniform ivec4 iinput;
uniform uvec4 uinput;

void main() {
	gl_Position = vertex;

	/* Green if both pass. */
	color = vec4(0.0, 1.0, 0.0, 1.0);

	if (bits != bitCount(iinput))
		/* Red if bitCount(ivec4) fails. */
		color = vec4(1.0, 0.0, 0.0, 1.0);
	else if (bits != bitCount(uinput))
		/* Blue if bitCount(uvec4) fails. */
		color = vec4(0.0, 0.0, 1.0, 1.0);
}

[fragment shader]
in vec4 color;
out vec4 frag_color;

void main()
{
	frag_color = color;
}

[vertex data]
vertex/float/2
-1.0 -1.0
 1.0 -1.0
 1.0  1.0
-1.0  1.0

[test]
uniform ivec4 bits 0 0 0 0
uniform ivec4 iinput 0 0 0 0
uniform uvec4 uinput 0 0 0 0
draw arrays GL_TRIANGLE_FAN 0 4
probe all rgba 0.0 1.0 0.0 1.0

uniform ivec4 bits 1 1 1 1
uniform ivec4 iinput 1 2 4 8
uniform uvec4 uinput 1 2 4 8
draw arrays GL_TRIANGLE_FAN 0 4
probe all rgba 0.0 1.0 0.0 1.0

uniform ivec4 bits 1 2 3 4
uniform ivec4 iinput 1 3 7 15
uniform uvec4 uinput 1 3 7 15
draw arrays GL_TRIANGLE_FAN 0 4
probe all rgba 0.0 1.0 0.0 1.0

uniform ivec4 bits 6 6 3 5
uniform ivec4 iinput 783 111 385 484
uniform uvec4 uinput 783 111 385 484
draw arrays GL_TRIANGLE_FAN 0 4
probe all rgba 0.0 1.0 0.0 1.0

uniform ivec4 bits 32 31 31 30
uniform ivec4 iinput -1 -2 -3 -4
uniform uvec4 uinput 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD 0xFFFFFFFC
draw arrays GL_TRIANGLE_FAN 0 4
probe all rgba 0.0 1.0 0.0 1.0