fix the spelling in whole piglit
[piglit.git] / tests / spec / glsl-1.30 / execution / clipping / vs-clip-distance-enables.shader_test
blobc6e63e8af6ad32f92f8a6595c3be12cf6ae9fdab
1 # From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special
2 # Variables):
4 #   Values written into gl_ClipDistance for planes that are not
5 #   enabled have no effect.
7 # This test sets up 6 clipping planes using gl_ClipDistance, which
8 # clip a rectangle to a hexagon shape.  Then it tests various
9 # combinations of enables for the 6 clipping planes, and verifies that
10 # they all create the correct shape.
12 # To verify that each enable works, the combinations of enables were
13 # chosen such that:
14 # - Every plane is enabled at least once and disabled at least once.
15 # - Every plane is enabled and disabled in a different pattern.
17 [require]
18 GLSL >= 1.30
20 [vertex shader]
21 #version 130
22 void main(void)
24         gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
26         gl_ClipDistance[0] = gl_Vertex.y - 0.25;
27         gl_ClipDistance[1] = gl_Vertex.y - gl_Vertex.x + 0.4;
28         gl_ClipDistance[2] = 1.4 - gl_Vertex.x - gl_Vertex.y;
29         gl_ClipDistance[3] = 0.75 - gl_Vertex.y;
30         gl_ClipDistance[4] = gl_Vertex.x - gl_Vertex.y + 0.4;
31         gl_ClipDistance[5] = gl_Vertex.x + gl_Vertex.y - 0.6;
34 [fragment shader]
35 #version 130
36 void main(void)
38         gl_FragColor = vec4(1, 1, 1, 1);
41 [test]
42 ortho 0 1 0 1
43 clear color 0.0 0.0 0.0 0.0
45 # Test with planes 0, 2, and 4 enabled.
46 enable GL_CLIP_PLANE0
47 disable GL_CLIP_PLANE1
48 enable GL_CLIP_PLANE2
49 disable GL_CLIP_PLANE3
50 enable GL_CLIP_PLANE4
51 disable GL_CLIP_PLANE5
52 clear
53 draw rect 0.1 0.1 0.8 0.8
55 # Test points inside each hexagon edge
56 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
57 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
58 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
59 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
60 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
61 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
63 # Test points outside each hexagon edge
64 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
65 relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
66 relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
67 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
68 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
69 relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
71 # Test with planes 0, 1, 4, and 5 enabled.
72 enable GL_CLIP_PLANE0
73 enable GL_CLIP_PLANE1
74 disable GL_CLIP_PLANE2
75 disable GL_CLIP_PLANE3
76 enable GL_CLIP_PLANE4
77 enable GL_CLIP_PLANE5
78 clear
79 draw rect 0.1 0.1 0.8 0.8
81 # Test points inside each hexagon edge
82 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
83 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
84 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
85 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
86 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
87 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
89 # Test points outside each hexagon edge
90 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
91 relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
92 relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
93 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
94 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
95 relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5
97 # Test with planes 0, 1, 2, and 3 enabled.
98 enable GL_CLIP_PLANE0
99 enable GL_CLIP_PLANE1
100 enable GL_CLIP_PLANE2
101 enable GL_CLIP_PLANE3
102 disable GL_CLIP_PLANE4
103 disable GL_CLIP_PLANE5
104 clear
105 draw rect 0.1 0.1 0.8 0.8
107 # Test points inside each hexagon edge
108 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
109 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
110 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
111 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
112 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
113 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
115 # Test points outside each hexagon edge
116 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0
117 relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1
118 relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2
119 relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) # clipped by plane 3
120 relative probe rgba (0.2, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 4
121 relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5
123 # Test with planes 4 and 5 enabled.
124 disable GL_CLIP_PLANE0
125 disable GL_CLIP_PLANE1
126 disable GL_CLIP_PLANE2
127 disable GL_CLIP_PLANE3
128 enable GL_CLIP_PLANE4
129 enable GL_CLIP_PLANE5
130 clear
131 draw rect 0.1 0.1 0.8 0.8
133 # Test points inside each hexagon edge
134 relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0)
135 relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0)
136 relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0)
137 relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0)
138 relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0)
139 relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0)
141 # Test points outside each hexagon edge
142 relative probe rgba (0.5, 0.2) (1.0, 1.0, 1.0, 1.0) # clipped by plane 0
143 relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1
144 relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2
145 relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3
146 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4
147 relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5