fix the spelling in whole piglit
[piglit.git] / tests / spec / glsl-1.30 / execution / clipping / vs-clip-distance-all-planes-enabled.shader_test
blob3a9abcc1fb5ed07944ea7e3d7bc673f146663c40
1 # [description]
2 # Use all 8 gl_ClipDistance values to clip a rectangle to an octagon shape.
4 # The octagon is centered at (0.5, 0.5), and has a small radius
5 # (distance from center to perpendicular edge) of 0.4.
7 [require]
8 GLSL >= 1.30
10 [vertex shader]
11 #version 130
13 out float gl_ClipDistance[8];
15 void main(void)
17         gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
19         // Compute 2D coordinates relative to a center point of (0.5,
20         // 0.5).
21         vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
23         for (int i = 0; i < 8; ++i) {
24                 // Compute a unit vector in the direction i*45deg from
25                 // the x axis.
26                 float angle = i*(3.141592653589793/4);
27                 vec2 u = vec2(cos(angle), sin(angle));
29                 // Reject points whose 2D coordinate, projected onto
30                 // that unit vector, is greater than 0.4.
31                 gl_ClipDistance[i] = 0.4 - dot(u, coord);
32         }
35 [fragment shader]
36 #version 130
37 void main(void)
39         gl_FragColor = vec4(1, 1, 1, 1);
42 [test]
43 clear color 0.0 0.0 0.0 0.0
44 clear
45 ortho 0 1 0 1
46 enable GL_CLIP_PLANE0
47 enable GL_CLIP_PLANE1
48 enable GL_CLIP_PLANE2
49 enable GL_CLIP_PLANE3
50 enable GL_CLIP_PLANE4
51 enable GL_CLIP_PLANE5
52 enable GL_CLIP_PLANE6
53 enable GL_CLIP_PLANE7
54 draw rect 0.0 0.0 1.0 1.0
56 # Test points inside each hexagon edge
57 relative probe rgba (0.850, 0.500) (1.0, 1.0, 1.0, 1.0)
58 relative probe rgba (0.747, 0.747) (1.0, 1.0, 1.0, 1.0)
59 relative probe rgba (0.500, 0.850) (1.0, 1.0, 1.0, 1.0)
60 relative probe rgba (0.253, 0.747) (1.0, 1.0, 1.0, 1.0)
61 relative probe rgba (0.150, 0.500) (1.0, 1.0, 1.0, 1.0)
62 relative probe rgba (0.253, 0.253) (1.0, 1.0, 1.0, 1.0)
63 relative probe rgba (0.500, 0.150) (1.0, 1.0, 1.0, 1.0)
64 relative probe rgba (0.747, 0.253) (1.0, 1.0, 1.0, 1.0)
66 # Test points outside each hexagon edge
67 relative probe rgba (0.950, 0.500) (0.0, 0.0, 0.0, 0.0)
68 relative probe rgba (0.818, 0.818) (0.0, 0.0, 0.0, 0.0)
69 relative probe rgba (0.500, 0.950) (0.0, 0.0, 0.0, 0.0)
70 relative probe rgba (0.182, 0.818) (0.0, 0.0, 0.0, 0.0)
71 relative probe rgba (0.050, 0.500) (0.0, 0.0, 0.0, 0.0)
72 relative probe rgba (0.182, 0.182) (0.0, 0.0, 0.0, 0.0)
73 relative probe rgba (0.500, 0.050) (0.0, 0.0, 0.0, 0.0)
74 relative probe rgba (0.818, 0.182) (0.0, 0.0, 0.0, 0.0)