John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 1 | #version 310 es
|
| 2 |
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 3 | #ifdef GL_EXT_geometry_shader
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 4 | #extension GL_EXT_geometry_shader : enable
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 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
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 12 |
|
| 13 | precision mediump float;
|
| 14 |
|
| 15 | in fromVertex {
|
| 16 | in vec3 color;
|
| 17 | } fromV[];
|
| 18 |
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 19 | in vec4 nonBlockUnsized[];
|
| 20 |
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 21 | out toFragment {
|
| 22 | out vec3 color;
|
| 23 | } toF;
|
| 24 |
|
| 25 | out fromVertex { // okay to reuse a block name for another block name
|
| 26 | vec3 color;
|
| 27 | };
|
| 28 |
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 29 | out fooB { // ERROR, cannot reuse block name as block instance
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 30 | vec2 color;
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 31 | } fromVertex;
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 32 |
|
| 33 | int fromVertex; // ERROR, cannot reuse a block name for something else
|
| 34 |
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 35 | out fooC { // ERROR, cannot have same name for block and instance name
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 36 | vec2 color;
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 37 | } fooC;
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 38 |
|
| 39 | void main()
|
| 40 | {
|
| 41 | EmitVertex();
|
| 42 | EndPrimitive();
|
| 43 | EmitStreamVertex(1); // ERROR
|
| 44 | EndStreamPrimitive(0); // ERROR
|
| 45 |
|
| 46 | color = fromV[0].color;
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 47 | gl_ClipDistance[3] = // ERROR, no ClipDistance
|
| 48 | gl_in[1].gl_ClipDistance[2]; // ERROR, no ClipDistance
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 49 | gl_Position = gl_in[0].gl_Position;
|
John Kessenich | b61b821 | 2015-06-23 04:14:00 +0000 | [diff] [blame] | 50 |
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 51 | gl_PrimitiveID = gl_PrimitiveIDIn;
|
| 52 | gl_Layer = 2;
|
| 53 | }
|
| 54 |
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 55 | layout(stream = 4) out vec4 ov4; // ERROR, no streams
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 56 |
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 57 | layout(line_strip, points, triangle_strip, points, triangle_strip) out; // just means triangle_strip"
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 58 |
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 59 | out ooutb { vec4 a; } ouuaa6;
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 60 |
|
| 61 | layout(max_vertices = 200) out;
|
| 62 | layout(max_vertices = 300) out; // ERROR, too big
|
| 63 | void foo(layout(max_vertices = 4) int a) // ERROR
|
| 64 | {
|
| 65 | ouuaa6.a = vec4(1.0);
|
| 66 | }
|
| 67 |
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 68 | layout(line_strip, points, triangle_strip, points) out; // ERROR, changing output primitive
|
| 69 | layout(line_strip, points) out; // ERROR, changing output primitive
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 70 | layout(triangle_strip) in; // ERROR, not an input primitive
|
| 71 | layout(triangle_strip) uniform; // ERROR
|
| 72 | layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
|
| 73 | layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
|
| 74 | layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
|
| 75 | out 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 |
|
| 81 | layout(lines) out; // ERROR, not on output
|
| 82 | layout(lines_adjacency) in;
|
| 83 | layout(triangles) in; // ERROR, can't change it
|
| 84 | layout(triangles_adjacency) in; // ERROR, can't change it
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 85 | layout(invocations = 4) in;
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 86 |
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 87 | in sameName {
|
| 88 | int a15;
|
| 89 | } insn[];
|
| 90 |
|
| 91 | out sameName {
|
| 92 | float f15;
|
| 93 | };
|
| 94 |
|
| 95 | uniform sameName {
|
| 96 | bool b15;
|
| 97 | };
|
| 98 |
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 99 | const 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 +
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 109 | gl_MaxVertexTextureImageUnits +
|
| 110 | gl_MaxCombinedTextureImageUnits +
|
| 111 | gl_MaxTextureImageUnits +
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 112 | gl_MaxDrawBuffers;
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 113 |
|
| 114 | void fooe1()
|
| 115 | {
|
John Kessenich | f6deb62 | 2015-06-14 21:36:44 +0000 | [diff] [blame] | 116 | gl_ViewportIndex; // ERROR, not in ES
|
| 117 | gl_MaxViewports; // ERROR, not in ES
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 118 | insn.length(); // 4: lines_adjacency
|
| 119 | int inv = gl_InvocationID;
|
John Kessenich | 453bb26 | 2015-06-12 05:01:25 +0000 | [diff] [blame] | 120 | }
|
John Kessenich | 105704e | 2015-06-19 06:28:59 +0000 | [diff] [blame] | 121 |
|
| 122 | in vec4 explArray[4];
|
| 123 | in vec4 explArrayBad[5]; // ERROR, wrong size
|
| 124 | in vec4 nonArrayed; // ERROR, not an array
|
| 125 | flat out vec3 myColor1;
|
| 126 | centroid out vec3 myColor2;
|
| 127 | centroid in vec3 centr[];
|
| 128 | sample out vec4 perSampleColor; // ERROR without sample extensions
|
| 129 |
|
| 130 | layout(max_vertices = 200) out; // matching redecl
|
| 131 |
|
| 132 | layout(location = 7, component = 2) in float comp[]; // ERROR, es has no component
|
| 133 |
|
| 134 | void notHere()
|
| 135 | {
|
| 136 | gl_MaxGeometryVaryingComponents; // ERROR, not in ES
|
| 137 | gl_VerticesIn; // ERROR, not in ES
|
| 138 | }
|
| 139 |
|
John Kessenich | b61b821 | 2015-06-23 04:14:00 +0000 | [diff] [blame] | 140 | void 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 |
|
| 148 | void pointSize2()
|
| 149 | {
|
| 150 | highp float ps = gl_in[3].gl_PointSize;
|
| 151 | gl_PointSize = ps;
|
| 152 | }
|