John Kessenich | 68546c6 | 2014-01-08 23:25:18 +0000 | [diff] [blame] | 1 | #version 440
|
| 2 |
|
| 3 | // Note 'location'-only tests for enhanced layouts are in 330.frag
|
| 4 | // Generic 'component' tests are in 440.vert
|
| 5 |
|
| 6 | // a consumes components 2 and 3 of location 4
|
| 7 | layout(location = 4, component = 2) in vec2 a;
|
| 8 |
|
| 9 | // b consumes component 1 of location 4
|
| 10 | layout(location = 4, component = 1) in float b;
|
| 11 | layout(location = 4, component = 2) in vec2 h; // ERROR, component overlap not okay for fragment in
|
| 12 |
|
| 13 | layout(location = 3, component = 2) in vec3 c; // ERROR: c overflows components 2 and 3
|
| 14 |
|
| 15 | // e consumes beginning (components 0, 1 and 2) of each of 6 slots
|
| 16 | layout(location = 20, component = 0) in vec3 e[6];
|
| 17 |
|
| 18 | // f consumes last component of the same 6 slots
|
| 19 | layout(location = 20, component = 3) in float f[6];
|
| 20 |
|
| 21 | layout(location = 30, component = 3) out int be;
|
| 22 | layout(location = 30, component = 0) out vec3 bf; // ERROR, not the same basic type
|
John Kessenich | 04b1c6e | 2014-01-28 21:13:59 +0000 | [diff] [blame] | 23 |
|
| 24 | writeonly uniform; // ERROR
|
| 25 | readonly in; // ERROR
|
| 26 | flat out; // ERROR
|
| 27 | mediump uniform;
|
| 28 |
|
| 29 | layout(offset=12) uniform; // ERROR
|
| 30 | layout(offset=12) in; // ERROR
|
| 31 | layout(offset=12) out; // ERROR
|
| 32 |
|
| 33 | layout(align=16) uniform; // ERROR
|
| 34 | layout(align=16) in; // ERROR
|
| 35 | layout(align=16) out; // ERROR
|
| 36 |
|
| 37 | layout(offset=12) uniform ubl1 { int a; } inst1; // ERROR
|
| 38 | layout(offset=12) in inbl2 { int a; } inst2; // ERROR
|
| 39 | layout(offset=12) out inbl3 { int a; } inst3; // ERROR
|
| 40 |
|
| 41 | layout(align=16, std140) uniform ubl4 { int a; } inst4;
|
| 42 | layout(align=16) uniform ubl8 { int a; } inst8; // ERROR, no packing
|
| 43 | layout(align=16) in inbl5 { int a; } inst5; // ERROR
|
| 44 | layout(align=16) out inbl6 { int a; } inst6; // ERROR
|
| 45 |
|
| 46 | layout(offset=12) uniform vec4 v1; // ERROR
|
| 47 | layout(offset=12) in vec4 v2; // ERROR
|
| 48 | layout(offset=12) out vec4 v3; // ERROR
|
| 49 |
|
| 50 | layout(align=16) uniform vec4 v4; // ERROR
|
| 51 | layout(align=16) in vec4 v5; // ERROR
|
| 52 | layout(align=16) out vec4 v6; // ERROR
|
| 53 |
|
| 54 | layout(std140) in; // ERROR
|
| 55 | layout(std140) uniform vec4 v7; // ERROR
|
| 56 |
|
| 57 | layout(align=48) uniform ubl7 { // ERROR, not power of 2
|
| 58 | layout(offset=12, align=4) float f; // ERROR, no packing
|
| 59 | } inst7;
|
| 60 |
|
| 61 | in ibl10 {
|
| 62 | layout(offset=12) float f; // ERROR
|
| 63 | layout(align=4) float g; // ERROR
|
| 64 | } inst10;
|
| 65 |
|
| 66 | layout(std430) uniform;
|
| 67 |
|
| 68 | layout(align=32) uniform ubl9 {
|
| 69 | float e;
|
| 70 | layout(offset=12, align=4) float f;
|
| 71 | layout(offset=20) float g;
|
| 72 | float h;
|
| 73 | } inst9;
|
| 74 |
|
| 75 | uniform ubl11 {
|
| 76 | layout(offset=12, align=4) float f;
|
| 77 | float g;
|
| 78 | } inst11;
|
| 79 |
|
| 80 | layout(std140) uniform block {
|
| 81 | vec4 a; // a takes offsets 0-15
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 82 | layout(offset = 32) vec3 b; // b takes offsets 32-43
|
John Kessenich | 04b1c6e | 2014-01-28 21:13:59 +0000 | [diff] [blame] | 83 | layout(offset = 40) vec2 c; // ERROR, lies within previous member
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 84 | layout(align = 6) double g; // ERROR, 6 is not a power of 2
|
| 85 | layout(offset=68) double h; // ERROR, offset not aligned
|
| 86 | } specExampleErrors;
|
| 87 |
|
| 88 | layout(std140) uniform block2 {
|
| 89 | vec4 a; // a takes offsets 0-15
|
| 90 | layout(offset = 32) vec3 b; // b takes offsets 32-43
|
John Kessenich | 04b1c6e | 2014-01-28 21:13:59 +0000 | [diff] [blame] | 91 | layout(offset = 48) vec2 d; // d takes offsets 48-55
|
| 92 | layout(align = 16) float e; // e takes offsets 64-67
|
| 93 | layout(align = 2) double f; // f takes offsets 72-79
|
John Kessenich | 04b1c6e | 2014-01-28 21:13:59 +0000 | [diff] [blame] | 94 | layout(offset = 80) float h; // h takes offsets 80-83
|
| 95 | layout(align = 64) dvec3 i; // i takes offsets 128-151
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 96 | layout(offset = 164, align = 8) float j; // j takes offsets 168-171
|
John Kessenich | 04b1c6e | 2014-01-28 21:13:59 +0000 | [diff] [blame] | 97 | } specExample;
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 98 |
|
John Kessenich | dd6ca17 | 2015-12-06 18:10:27 -0700 | [diff] [blame] | 99 | layout(std430) buffer block430 {
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 100 | vec4 a; // a takes offsets 0-15
|
| 101 | layout(offset = 32) vec3 b; // b takes offsets 32-43
|
| 102 | layout(offset = 40) vec2 c; // ERROR, lies within previous member
|
| 103 | layout(align = 6) double g; // ERROR, 6 is not a power of 2
|
| 104 | layout(offset=68) double h; // ERROR, offset not aligned
|
John Kessenich | 837c638 | 2015-04-08 15:51:14 +0000 | [diff] [blame] | 105 | layout(align = 0) double i; // ERROR, 0 not a power of 2
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 106 | } specExampleErrors430;
|
| 107 |
|
John Kessenich | dd6ca17 | 2015-12-06 18:10:27 -0700 | [diff] [blame] | 108 | layout(std430) buffer block2430 {
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 109 | vec4 a; // a takes offsets 0-15
|
| 110 | layout(offset = 32) vec3 b; // b takes offsets 32-43
|
| 111 | layout(offset = 48) vec2 d; // d takes offsets 48-55
|
| 112 | layout(align = 16) float e; // e takes offsets 64-67
|
| 113 | layout(align = 2) double f; // f takes offsets 72-79
|
| 114 | layout(offset = 80) float h; // h takes offsets 80-83
|
| 115 | layout(align = 64) dvec3 i; // i takes offsets 128-151
|
| 116 | layout(offset = 164, align = 8) float j; // j takes offsets 168-171
|
| 117 | } specExample430;
|
| 118 |
|
John Kessenich | dd6ca17 | 2015-12-06 18:10:27 -0700 | [diff] [blame] | 119 | layout(std430, align = 128) buffer block24300 {
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 120 | vec4 a;
|
| 121 | vec3 b;
|
| 122 | vec2 d;
|
| 123 | float e;
|
| 124 | double f;
|
| 125 | float h;
|
| 126 | dvec3 i;
|
| 127 | } specExample4300;
|
| 128 |
|
John Kessenich | dd6ca17 | 2015-12-06 18:10:27 -0700 | [diff] [blame] | 129 | layout(std430, align = 128) buffer block24301 {
|
John Kessenich | ac1e188 | 2014-01-31 02:40:19 +0000 | [diff] [blame] | 130 | vec4 a;
|
| 131 | vec3 b;
|
| 132 | vec2 d;
|
| 133 | layout(offset=388) float e;
|
| 134 | layout(align=8) double f;
|
| 135 | float h;
|
| 136 | dvec3 i;
|
| 137 | } specExample4301;
|
John Kessenich | 4094630 | 2014-02-03 16:28:23 +0000 | [diff] [blame] | 138 |
|
| 139 | int aconst[gl_MaxTransformFeedbackBuffers];
|
| 140 | int bconst[gl_MaxTransformFeedbackInterleavedComponents];
|
John Kessenich | 0fc4338 | 2015-08-22 01:21:47 -0600 | [diff] [blame] | 141 |
|
| 142 | sample in vec3 sampInArray[4];
|
| 143 |
|
| 144 | void interp()
|
| 145 | {
|
| 146 | interpolateAtCentroid(sampInArray[2].xy);
|
John Kessenich | d6c37b1 | 2015-08-22 16:54:35 -0600 | [diff] [blame] | 147 | interpolateAtSample(sampInArray[2].x.x, 2);
|
John Kessenich | 0fc4338 | 2015-08-22 01:21:47 -0600 | [diff] [blame] | 148 | }
|
Rex Xu | e553ace | 2015-12-07 19:07:17 +0800 | [diff] [blame] | 149 |
|
| 150 | int layer()
|
| 151 | {
|
| 152 | return gl_Layer;
|
| 153 | }
|