1 # This test sets up 6 clipping planes using gl_ClipVertex, which clip
2 # a rectangle to a hexagon shape. Then it tests various combinations
3 # of enables for the 6 clipping planes, and verifies that they all
4 # create the correct shape.
6 # To verify that each enable works, the combinations of enables were
8 # - Every plane is enabled at least once and disabled at least once.
9 # - Every plane is enabled and disabled in a different pattern.
11 # Note: Some implementations have bugs related to improper coordinate
12 # transformations of clip planes (which are already adequately tested
13 # by the clip-plane-transformation test), so to avoid those bugs
14 # contaminating the results of this test, we don't do any coordinate
15 # transformation in this test.
26 gl_Position = gl_Vertex;
30 #version 150 compatibility
33 layout(triangle_strip, max_vertices = 3) out;
37 for (int i = 0; i < 3; i++) {
38 gl_Position = gl_in[i].gl_Position;
39 gl_ClipVertex = gl_in[i].gl_Position;
49 gl_FragColor = vec4(1, 1, 1, 1);
53 clip plane 0 0 1 0 0.5
54 clip plane 1 -1 1 0 0.8
55 clip plane 2 -1 -1 0 0.8
56 clip plane 3 0 -1 0 0.5
57 clip plane 4 1 -1 0 0.8
58 clip plane 5 1 1 0 0.8
59 clear color 0.0 0.0 0.0 0.0
61 # Test with planes 0, 2, and 4 enabled.
63 disable GL_CLIP_PLANE1
65 disable GL_CLIP_PLANE3
67 disable GL_CLIP_PLANE5
71 # Test points inside each hexagon edge
72 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
73 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
74 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
75 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
76 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
77 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
79 # Test points outside each hexagon edge
80 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
81 relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
82 relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
83 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
84 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
85 relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
87 # Test with planes 0, 1, 4, and 5 enabled.
90 disable GL_CLIP_PLANE2
91 disable GL_CLIP_PLANE3
97 # Test points inside each hexagon edge
98 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
99 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
100 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
101 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
102 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
103 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
105 # Test points outside each hexagon edge
106 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
107 relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
108 relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
109 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
110 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
111 relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5
113 # Test with planes 0, 1, 2, and 3 enabled.
114 enable GL_CLIP_PLANE0
115 enable GL_CLIP_PLANE1
116 enable GL_CLIP_PLANE2
117 enable GL_CLIP_PLANE3
118 disable GL_CLIP_PLANE4
119 disable GL_CLIP_PLANE5
123 # Test points inside each hexagon edge
124 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
125 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
126 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
127 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
128 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
129 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
131 # Test points outside each hexagon edge
132 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
133 relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
134 relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
135 relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) # clipped by plane 3
136 relative probe rgba (0.2, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 4
137 relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
139 # Test with planes 4 and 5 enabled.
140 disable GL_CLIP_PLANE0
141 disable GL_CLIP_PLANE1
142 disable GL_CLIP_PLANE2
143 disable GL_CLIP_PLANE3
144 enable GL_CLIP_PLANE4
145 enable GL_CLIP_PLANE5
149 # Test points inside each hexagon edge
150 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
151 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
152 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
153 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
154 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
155 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
157 # Test points outside each hexagon edge
158 relative probe rgba (0.5, 0.2) (1.0, 1.0, 1.0, 1.0) # clipped by plane 0
159 relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
160 relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
161 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
162 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
163 relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5