EndStreamPrimitive not supported when there is #extension GL_ARB_gpu_shader5
[platform/upstream/glslang.git] / Test / 150.geom
1 #version 150 core\r
2 \r
3 in fromVertex {\r
4     in vec3 color;\r
5 } fromV[];\r
6 \r
7 out toFragment {\r
8     out vec3 color;\r
9 } toF;\r
10 \r
11 out fromVertex {  // okay to reuse a block name for another block name\r
12     vec3 color;\r
13 };\r
14 \r
15 out fooB {\r
16     vec2 color;\r
17 } fromVertex;     // ERROR, cannot reuse block name as block instance\r
18 \r
19 int fromVertex;   // ERROR, cannot reuse a block name for something else\r
20 \r
21 out fooC {\r
22     vec2 color;\r
23 } fooC;           // ERROR, cannot have same name for block and instance name\r
24 \r
25 void main()\r
26 {\r
27     EmitVertex();\r
28     EndPrimitive();\r
29     EmitStreamVertex(1);    // ERROR\r
30     EndStreamPrimitive(0);  // ERROR\r
31 \r
32     color = fromV[0].color;\r
33     gl_ClipDistance[3] = gl_in[1].gl_ClipDistance[2];\r
34     gl_Position = gl_in[0].gl_Position;\r
35     gl_PointSize = gl_in[3].gl_PointSize;\r
36     gl_PrimitiveID = gl_PrimitiveIDIn;\r
37     gl_Layer = 2;\r
38 }\r
39 \r
40 out vec4 ov0;  // stream should be 0\r
41 layout(stream = 4) out vec4 ov4;\r
42 out vec4 o1v0;  // stream should be 0\r
43 \r
44 layout(stream = 3) uniform;        // ERROR\r
45 layout(stream = 3) in;             // ERROR\r
46 layout(stream = 3) uniform int ua; // ERROR\r
47 layout(stream = 3) uniform ubb { int ua; } ibb; // ERROR\r
48 \r
49 layout(line_strip, points, triangle_strip, stream = 3, points, triangle_strip) out;  // just means "stream = 3, triangle_strip"\r
50 layout(stream = 3, triangle_strip) out;\r
51 out vec4 ov3;  // stream should be 3\r
52 \r
53 layout(stream = 6) out ooutb { vec4 a; } ouuaa6;\r
54 \r
55 layout(stream = 6) out ooutb2 {\r
56     layout(stream = 6) vec4 a;\r
57 } ouua6;\r
58 \r
59 layout(stream = 7) out ooutb3 {\r
60     layout(stream = 6) vec4 a;  // ERROR\r
61 } ouua7;\r
62 \r
63 out vec4 ov2s3;  // stream should be 3\r
64 \r
65 layout(max_vertices = 200) out;\r
66 layout(max_vertices = 300) out;   // ERROR, too big\r
67 void foo(layout(max_vertices = 4) int a)  // ERROR\r
68 {\r
69     ouuaa6.a = vec4(1.0);\r
70 }\r
71 \r
72 layout(line_strip, points, triangle_strip, stream = 3, points) out;  // ERROR, changing output primitive\r
73 layout(line_strip, points, stream = 3) out; // ERROR, changing output primitive\r
74 layout(triangle_strip) in; // ERROR, not an input primitive\r
75 layout(triangle_strip) uniform; // ERROR\r
76 layout(triangle_strip) out vec4 badv4;  // ERROR, not on a variable\r
77 layout(triangle_strip) in vec4 bad2v4[];  // ERROR, not on a variable or input\r
78 layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0\r
79 out outbn2 {\r
80     layout(invocations = 3)  int a; // 2 ERRORs, not on a block member, not until 4.0\r
81     layout(max_vertices = 3) int b; // ERROR, not on a block member\r
82     layout(triangle_strip)   int c; // ERROR, not on a block member\r
83 } outbi;\r
84 \r
85 layout(lines) out;  // ERROR, not on output\r
86 layout(lines_adjacency) in;\r
87 layout(triangles) in;             // ERROR, can't change it\r
88 layout(triangles_adjacency) in;   // ERROR, can't change it\r
89 layout(invocations = 4) in;       // ERROR, not until 4.0\r
90 \r
91 in inbn {\r
92     layout(stream = 2) int a;     // ERROR, stream on input\r
93 } inbi[];\r
94 \r
95 in sameName {\r
96     int a15;\r
97 } insn[];\r
98 \r
99 out sameName {\r
100     float f15;\r
101 };\r
102 \r
103 uniform sameName {\r
104     bool b15;\r
105 };\r
106 \r
107 float summ = gl_MaxVertexAttribs +\r
108              gl_MaxVertexUniformComponents +\r
109              gl_MaxVaryingFloats +\r
110              gl_MaxVaryingComponents +\r
111              gl_MaxVertexOutputComponents  +\r
112              gl_MaxGeometryInputComponents  +\r
113              gl_MaxGeometryOutputComponents  +\r
114              gl_MaxFragmentInputComponents  +\r
115              gl_MaxVertexTextureImageUnits +\r
116              gl_MaxCombinedTextureImageUnits +\r
117              gl_MaxTextureImageUnits +\r
118              gl_MaxFragmentUniformComponents +\r
119              gl_MaxDrawBuffers +\r
120              gl_MaxClipDistances  +\r
121              gl_MaxGeometryTextureImageUnits +\r
122              gl_MaxGeometryOutputVertices +\r
123              gl_MaxGeometryTotalOutputComponents  +\r
124              gl_MaxGeometryUniformComponents  +\r
125              gl_MaxGeometryVaryingComponents;\r
126 \r
127 void fooe1()\r
128 {\r
129     gl_ViewportIndex = gl_MaxViewports - 1;\r
130 }\r
131 \r
132 #extension GL_ARB_viewport_array : enable\r
133 \r
134 void fooe2()\r
135 {\r
136     gl_ViewportIndex = gl_MaxViewports - 1;\r
137 }\r
138 \r
139 out int gl_ViewportIndex;\r