fix the spelling in whole piglit
[piglit.git] / tests / spec / glsl-1.50 / execution / compatibility / clipping / vs-gs-clip-vertex-enables.shader_test
blobc427b446154901e7d572e3fbf438c6946fc20d05
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
7 # chosen such that:
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.
17 [require]
18 GL COMPAT >= 3.2
19 GLSL >= 1.50
21 [vertex shader]
22 #version 150 compatibility
24 out gl_PerVertex {
25         vec4 gl_Position;
26         vec4 gl_ClipVertex;
29 void main(void)
31         gl_Position = gl_Vertex;
33         gl_ClipVertex = gl_Position;
36 [geometry shader]
37 #version 150 compatibility
39 layout(triangles) in;
40 layout(triangle_strip, max_vertices = 3) out;
42 in gl_PerVertex {
43         vec4 gl_Position;
44         vec4 gl_ClipVertex;
45 } gl_in[];
47 void main()
49         for (int i = 0; i < 3; i++) {
50                 gl_Position = gl_in[i].gl_Position;
51                 gl_ClipVertex = gl_in[i].gl_ClipVertex;
53                 EmitVertex();
54         }
57 [fragment shader]
58 #version 120
59 void main(void)
61         gl_FragColor = vec4(1, 1, 1, 1);
64 [test]
65 clip plane 0 0 1 0 0.5
66 clip plane 1 -1 1 0 0.8
67 clip plane 2 -1 -1 0 0.8
68 clip plane 3 0 -1 0 0.5
69 clip plane 4 1 -1 0 0.8
70 clip plane 5 1 1 0 0.8
71 clear color 0.0 0.0 0.0 0.0
73 # Test with planes 0, 2, and 4 enabled.
74 enable GL_CLIP_PLANE0
75 disable GL_CLIP_PLANE1
76 enable GL_CLIP_PLANE2
77 disable GL_CLIP_PLANE3
78 enable GL_CLIP_PLANE4
79 disable GL_CLIP_PLANE5
80 clear
81 draw rect -1 -1 2 2
83 # Test points inside each hexagon edge
84 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
85 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
86 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
87 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
88 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
89 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
91 # Test points outside each hexagon edge
92 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
93 relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
94 relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
95 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
96 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
97 relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
99 # Test with planes 0, 1, 4, and 5 enabled.
100 enable GL_CLIP_PLANE0
101 enable GL_CLIP_PLANE1
102 disable GL_CLIP_PLANE2
103 disable GL_CLIP_PLANE3
104 enable GL_CLIP_PLANE4
105 enable GL_CLIP_PLANE5
106 clear
107 draw rect -1 -1 2 2
109 # Test points inside each hexagon edge
110 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
111 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
112 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
113 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
114 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
115 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
117 # Test points outside each hexagon edge
118 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
119 relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
120 relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
121 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
122 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
123 relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5
125 # Test with planes 0, 1, 2, and 3 enabled.
126 enable GL_CLIP_PLANE0
127 enable GL_CLIP_PLANE1
128 enable GL_CLIP_PLANE2
129 enable GL_CLIP_PLANE3
130 disable GL_CLIP_PLANE4
131 disable GL_CLIP_PLANE5
132 clear
133 draw rect -1 -1 2 2
135 # Test points inside each hexagon edge
136 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
137 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
138 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
139 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
140 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
141 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
143 # Test points outside each hexagon edge
144 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
145 relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
146 relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
147 relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) # clipped by plane 3
148 relative probe rgba (0.2, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 4
149 relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
151 # Test with planes 4 and 5 enabled.
152 disable GL_CLIP_PLANE0
153 disable GL_CLIP_PLANE1
154 disable GL_CLIP_PLANE2
155 disable GL_CLIP_PLANE3
156 enable GL_CLIP_PLANE4
157 enable GL_CLIP_PLANE5
158 clear
159 draw rect -1 -1 2 2
161 # Test points inside each hexagon edge
162 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
163 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
164 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
165 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
166 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
167 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
169 # Test points outside each hexagon edge
170 relative probe rgba (0.5, 0.2) (1.0, 1.0, 1.0, 1.0) # clipped by plane 0
171 relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
172 relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
173 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
174 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
175 relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5