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