File: vs-tcs-tes-clip-vertex-enables.shader_test

package info (click to toggle)
piglit 0~git20220119-124bca3c9-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 109,012 kB
  • sloc: ansic: 273,511; xml: 46,666; python: 33,098; lisp: 20,392; cpp: 12,480; sh: 22; makefile: 22; pascal: 5
file content (194 lines) | stat: -rw-r--r-- 6,492 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# This test sets up 6 clipping planes using gl_ClipVertex, which clip
# a rectangle to a hexagon shape.  Then it tests various combinations
# of enables for the 6 clipping planes, and verifies that they all
# create the correct shape.
#
# To verify that each enable works, the combinations of enables were
# chosen such that:
# - Every plane is enabled at least once and disbled at least once.
# - Every plane is enabled and disabled in a different pattern.
#
# Note: Some implementations have bugs related to improper coordinate
# transformations of clip planes (which are already adequately tested
# by the clip-plane-transformation test), so to avoid those bugs
# contaminating the results of this test, we don't do any coordinate
# transformation in this test.

[require]
GL COMPAT >= 3.2
GLSL >= 1.50
GL_ARB_tessellation_shader

[vertex shader]
#version 150 compatibility

in vec4 piglit_vertex;

void main(void)
{
	gl_Position = piglit_vertex;

	gl_ClipVertex = gl_Position;
}

[tessellation control shader]
#version 150 compatibility
#extension GL_ARB_tessellation_shader: require

layout(vertices = 3) out;

void main() {
	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
	gl_out[gl_InvocationID].gl_ClipVertex = gl_in[gl_InvocationID].gl_ClipVertex;
	gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
	gl_TessLevelInner = float[2](0.0, 0.0);
}

[tessellation evaluation shader]
#version 150 compatibility
#extension GL_ARB_tessellation_shader: require

layout(triangles) in;

void main() {
	gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
	            + gl_in[1].gl_Position * gl_TessCoord[1]
	            + gl_in[2].gl_Position * gl_TessCoord[2];

	gl_ClipVertex = gl_in[0].gl_ClipVertex * gl_TessCoord[0]
	            + gl_in[1].gl_ClipVertex * gl_TessCoord[1]
	            + gl_in[2].gl_ClipVertex * gl_TessCoord[2];
}

[fragment shader]
#version 120
void main(void)
{
	gl_FragColor = vec4(1, 1, 1, 1);
}

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

[test]
clip plane 0 0 1 0 0.5
clip plane 1 -1 1 0 0.8
clip plane 2 -1 -1 0 0.8
clip plane 3 0 -1 0 0.5
clip plane 4 1 -1 0 0.8
clip plane 5 1 1 0 0.8
clear color 0.0 0.0 0.0 0.0

# Test with planes 0, 2, and 4 enabled.
enable GL_CLIP_PLANE0
disable GL_CLIP_PLANE1
enable GL_CLIP_PLANE2
disable GL_CLIP_PLANE3
enable GL_CLIP_PLANE4
disable GL_CLIP_PLANE5
clear
patch parameter vertices 3
draw arrays GL_PATCHES 0 6

# Test points inside each hexagon edge
relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)

# Test points outside each hexagon edge
relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5

# Test with planes 0, 1, 4, and 5 enabled.
enable GL_CLIP_PLANE0
enable GL_CLIP_PLANE1
disable GL_CLIP_PLANE2
disable GL_CLIP_PLANE3
enable GL_CLIP_PLANE4
enable GL_CLIP_PLANE5
clear
patch parameter vertices 3
draw arrays GL_PATCHES 0 6

# Test points inside each hexagon edge
relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)

# Test points outside each hexagon edge
relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5

# Test with planes 0, 1, 2, and 3 enabled.
enable GL_CLIP_PLANE0
enable GL_CLIP_PLANE1
enable GL_CLIP_PLANE2
enable GL_CLIP_PLANE3
disable GL_CLIP_PLANE4
disable GL_CLIP_PLANE5
clear
patch parameter vertices 3
draw arrays GL_PATCHES 0 6

# Test points inside each hexagon edge
relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)

# Test points outside each hexagon edge
relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) # clipped by plane 3
relative probe rgba (0.2, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 4
relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5

# Test with planes 4 and 5 enabled.
disable GL_CLIP_PLANE0
disable GL_CLIP_PLANE1
disable GL_CLIP_PLANE2
disable GL_CLIP_PLANE3
enable GL_CLIP_PLANE4
enable GL_CLIP_PLANE5
clear
patch parameter vertices 3
draw arrays GL_PATCHES 0 6

# Test points inside each hexagon edge
relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)

# Test points outside each hexagon edge
relative probe rgba (0.5, 0.2) (1.0, 1.0, 1.0, 1.0) # clipped by plane 0
relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5