1#version 320 es
2
3precision mediump float;
4
5in fromVertex {
6    in vec3 color;
7} fromV[];
8
9in vec4 nonBlockUnsized[];
10
11out toFragment {
12    out vec3 color;
13} toF;
14
15out fromVertex {  // okay to reuse a block name for another block name
16    vec3 color;
17};
18
19out fooB {        // ERROR, cannot reuse block name as block instance
20    vec2 color;
21} fromVertex;
22
23int fromVertex;   // ERROR, cannot reuse a block name for something else
24
25out fooC {        // ERROR, cannot have same name for block and instance name
26    vec2 color;
27} fooC;
28
29void main()
30{
31    EmitVertex();
32    EndPrimitive();
33    EmitStreamVertex(1);    // ERROR
34    EndStreamPrimitive(0);  // ERROR
35
36    color = fromV[0].color;
37    gl_ClipDistance[3] =              // ERROR, no ClipDistance
38        gl_in[1].gl_ClipDistance[2];  // ERROR, no ClipDistance
39    gl_Position = gl_in[0].gl_Position;
40
41    gl_PrimitiveID = gl_PrimitiveIDIn;
42    gl_Layer = 2;
43}
44
45layout(stream = 4) out vec4 ov4; // ERROR, no streams
46
47layout(line_strip, points, triangle_strip, points, triangle_strip) out;  // just means triangle_strip"
48
49out ooutb { vec4 a; } ouuaa6;
50
51layout(max_vertices = 200) out;
52layout(max_vertices = 300) out;   // ERROR, too big
53void foo(layout(max_vertices = 4) int a)  // ERROR
54{
55    ouuaa6.a = vec4(1.0);
56}
57
58layout(line_strip, points, triangle_strip, points) out;  // ERROR, changing output primitive
59layout(line_strip, points) out; // ERROR, changing output primitive
60layout(triangle_strip) in; // ERROR, not an input primitive
61layout(triangle_strip) uniform; // ERROR
62layout(triangle_strip) out vec4 badv4;  // ERROR, not on a variable
63layout(triangle_strip) in vec4 bad2v4[];  // ERROR, not on a variable or input
64layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
65out outbn2 {
66    layout(invocations = 3)  int a; // 2 ERRORs, not on a block member, not until 4.0
67    layout(max_vertices = 3) int b; // ERROR, not on a block member
68    layout(triangle_strip)   int c; // ERROR, not on a block member
69} outbi;
70
71layout(lines) out;  // ERROR, not on output
72layout(lines_adjacency) in;
73layout(triangles) in;             // ERROR, can't change it
74layout(triangles_adjacency) in;   // ERROR, can't change it
75layout(invocations = 4) in;
76
77in sameName {
78    int a15;
79} insn[];
80
81out sameName {
82    float f15;
83};
84
85uniform sameName {
86    bool b15;
87};
88
89const int summ = gl_MaxVertexAttribs +
90             gl_MaxGeometryInputComponents +
91             gl_MaxGeometryOutputComponents +
92             gl_MaxGeometryImageUniforms +
93             gl_MaxGeometryTextureImageUnits +
94             gl_MaxGeometryOutputVertices +
95             gl_MaxGeometryTotalOutputComponents +
96             gl_MaxGeometryUniformComponents +
97             gl_MaxGeometryAtomicCounters +
98             gl_MaxGeometryAtomicCounterBuffers +
99             gl_MaxVertexTextureImageUnits +
100             gl_MaxCombinedTextureImageUnits +
101             gl_MaxTextureImageUnits +
102             gl_MaxDrawBuffers;
103
104void fooe1()
105{
106    gl_ViewportIndex;  // ERROR, not in ES
107    gl_MaxViewports;   // ERROR, not in ES
108    insn.length();     // 4: lines_adjacency
109    int inv = gl_InvocationID;
110}
111
112in vec4 explArray[4];
113in vec4 explArrayBad[5];  // ERROR, wrong size
114in vec4 nonArrayed;       // ERROR, not an array
115flat out vec3 myColor1;
116centroid out vec3 myColor2;
117centroid in vec3 centr[];
118sample out vec4 perSampleColor;  // ERROR without sample extensions
119
120layout(max_vertices = 200) out;  // matching redecl
121
122layout(location = 7, component = 2) in float comp[];  // ERROR, es has no component
123
124void notHere()
125{
126    gl_MaxGeometryVaryingComponents;  // ERROR, not in ES
127    gl_VerticesIn;                    // ERROR, not in ES
128}
129
130void pointSize2()
131{
132    highp float ps = gl_in[3].gl_PointSize;  // ERROR, need extension
133    gl_PointSize = ps;                       // ERROR, need extension
134}
135