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