arb_program_interface_query: set vs_input2[1][0] as valid name
[piglit.git] / tests / spec / arb_tessellation_shader / execution / compatibility / vs-tcs-tes-gs-clip-vertex-different-from-position.shader_test
blob0a8fafd60b8e3c289a8d07f9a0bbe281d2fbf014
1 # [description]
2 # Use all 6 clip planes to clip a rectangle to a hexagon shape.
4 # In this test, gl_Position and gl_ClipVertex are different to verify
5 # that gl_Position determines screen position and gl_ClipVertex
6 # determines clipping.
8 [require]
9 GL COMPAT >= 3.2
10 GLSL >= 1.50
11 GL_ARB_tessellation_shader
13 [vertex shader]
14 #version 150 compatibility
16 in vec4 piglit_vertex;
18 void main(void)
20         gl_Position = gl_ModelViewProjectionMatrix * piglit_vertex;
22         // Transform gl_ClipVertex in an arbitrary way so that
23         // we can verify it is being used for clipping instead of
24         // gl_Position.
25         gl_ClipVertex = piglit_vertex * vec4(10.0, 10.0, 1.0, 1.0);
28 [tessellation control shader]
29 #version 150 compatibility
30 #extension GL_ARB_tessellation_shader: require
32 layout(vertices = 3) out;
34 void main() {
35         gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
36         gl_out[gl_InvocationID].gl_ClipVertex = gl_in[gl_InvocationID].gl_ClipVertex;
37         gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
38         gl_TessLevelInner = float[2](0.0, 0.0);
41 [tessellation evaluation shader]
42 #version 150 compatibility
43 #extension GL_ARB_tessellation_shader: require
45 layout(triangles) in;
47 void main() {
48         gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
49                     + gl_in[1].gl_Position * gl_TessCoord[1]
50                     + gl_in[2].gl_Position * gl_TessCoord[2];
52         gl_ClipVertex = gl_in[0].gl_ClipVertex * gl_TessCoord[0]
53                     + gl_in[1].gl_ClipVertex * gl_TessCoord[1]
54                     + gl_in[2].gl_ClipVertex * gl_TessCoord[2];
57 [geometry shader]
58 #version 150 compatibility
60 layout(triangles) in;
61 layout(triangle_strip, max_vertices = 3) out;
63 void main()
65         for (int i = 0; i < 3; i++) {
66                 gl_Position = gl_in[i].gl_Position;
67                 gl_ClipVertex = gl_in[i].gl_ClipVertex;
69                 EmitVertex();
70         }
73 [fragment shader]
74 #version 120
75 void main(void)
77         gl_FragColor = vec4(1, 1, 1, 1);
80 [vertex data]
81 piglit_vertex/float/2
82  0.1  0.1
83  0.9  0.1
84  0.1  0.9
85  0.1  0.9
86  0.9  0.1
87  0.9  0.9
89 [test]
90 clear color 0.0 0.0 0.0 0.0
91 clear
92 ortho 0 1 0 1
93 clip plane 0 0 1 0 -2.5
94 clip plane 1 -1 1 0 4
95 clip plane 2 -1 -1 0 14
96 clip plane 3 0 -1 0 7.5
97 clip plane 4 1 -1 0 4
98 clip plane 5 1 1 0 -6
99 enable GL_CLIP_PLANE0
100 enable GL_CLIP_PLANE1
101 enable GL_CLIP_PLANE2
102 enable GL_CLIP_PLANE3
103 enable GL_CLIP_PLANE4
104 enable GL_CLIP_PLANE5
106 patch parameter vertices 3
107 draw arrays GL_PATCHES 0 6
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.2, 0.3) (0.0, 0.0, 0.0, 0.0)
119 relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0)
120 relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0)
121 relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0)
122 relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0)
123 relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0)