]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/geometry_passthrough.glsl
Allocate locations to interface variables
[libs/gl.git] / tests / glsl / geometry_passthrough.glsl
1 uniform sampler2D tex;
2
3 #pragma MSP stage(vertex)
4 layout(location=0) in vec4 position;
5 void main()
6 {
7         out vec2 texcoord = position.xy*0.5+0.5;
8         gl_Position = position;
9 }
10
11 #pragma MSP stage(geometry)
12 layout(triangles) in;
13 layout(triangle_strip, max_vertices=3) out;
14 void main()
15 {
16         for(int i=0; i<3; ++i)
17         {
18                 passthrough[i];
19                 EmitVertex();
20         }
21 }
22
23 #pragma MSP stage(fragment)
24 layout(location=0) out vec4 frag_color;
25 void main()
26 {
27         frag_color = texture(tex, texcoord);
28 }
29
30 /* Expected output: vertex
31 layout(location=0) in vec4 position;
32 layout(location=0) out vec2 texcoord;
33 void main()
34 {
35         texcoord = position.xy*0.5+0.5;
36         gl_Position = position;
37 }
38 */
39
40 /* Expected output: geometry
41 layout(triangles) in;
42 layout(triangle_strip, max_vertices=3) out;
43 layout(location=0) in vec2 texcoord[];
44 layout(location=0) out vec2 _gs_out_texcoord;
45 void main()
46 {
47         for(int i = 0; i<3; ++i)
48         {
49                 gl_Position = gl_in[i].gl_Position;
50                 _gs_out_texcoord = texcoord[i];
51                 EmitVertex();
52         }
53 }
54 */
55
56 /* Expected output: fragment
57 layout(location=0) uniform sampler2D tex;
58 layout(location=0) out vec4 frag_color;
59 layout(location=0) in vec2 _gs_out_texcoord;
60 void main()
61 {
62         frag_color = texture(tex, _gs_out_texcoord);
63 }
64 */