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