John Kessenich | 68546c6 | 2014-01-08 23:25:18 +0000 | [diff] [blame] | 1 | #version 440
|
| 2 |
|
| 3 | // Note 'location' tests for enhanced layouts are in 330.frag
|
| 4 |
|
| 5 | layout(location = 2, component = 2) in vec2 a;
|
| 6 | layout(location = 2, component = 1) in float b;
|
| 7 |
|
| 8 | layout(location = 3, component = 2) in vec3 c; // ERROR: c overflows components 2 and 3
|
| 9 |
|
| 10 | layout(location = 0, component = 3) in float d[4];
|
| 11 |
|
| 12 | layout(location = 4, component = 0) in vec3 e[5];
|
| 13 | layout(location = 4, component = 3) in float f[5];
|
| 14 |
|
| 15 | layout(location = 9, component = 4) in float g[6]; // ERROR, component too big
|
| 16 |
|
| 17 | layout(location = 4, component = 2) in vec2 h; // component overlap okay for vertex in
|
| 18 |
|
| 19 | layout(location = 3, component = 2) out vec2 i;
|
| 20 | layout(location = 3, component = 0) out vec2 j;
|
| 21 |
|
| 22 | layout(location = 4, component = 2) out vec2 k;
|
| 23 | layout(location = 4, component = 2) out vec2 m; // ERROR, component overlap
|
| 24 |
|
| 25 | layout(location = 2, component = 2) out vec2 n;
|
| 26 | layout(location = 2, component = 0) out vec3 p; // ERROR, component overlap
|
| 27 |
|
| 28 | layout(location = 10, component = 3) out float q[6];
|
| 29 | layout(location = 10, component = 0) out vec3 r[6];
|
| 30 |
|
| 31 | layout(location = 15, component = 3) out float s; // ERROR, overlap
|
| 32 | layout(location = 10, component = 1) out float t; // ERROR, overlap
|
| 33 |
|
| 34 | layout(location = 20, component = 2) out float u;
|
| 35 | layout(location = 20, component = 0) out float v;
|
| 36 | layout(location = 20, component = 3) out float w;
|
| 37 | layout(location = 20, component = 1) out vec2 x; // ERROR, overlap
|
| 38 |
|
| 39 | layout(location = 30, component = 3) out vec2 y; // ERROR, goes to component 4
|
| 40 | layout(location = 31, component = 1) out vec4 z; // ERROR, goes to component 4
|
| 41 |
|
| 42 | layout(location = 32, component = 1) out mat4 ba; // ERROR
|
| 43 | layout(location = 33, component = 1) out struct S {int a;} Ss; // ERROR
|
| 44 | layout(location = 34, component = 1) out bn { int a;} bb; // ERROR
|
| 45 |
|
| 46 | layout(component = 1) out float bc; // ERROR, no location
|
| 47 |
|
| 48 | out blockname {
|
| 49 | layout(location = 40, component = 2) out float u;
|
| 50 | layout(location = 40, component = 0) out float v;
|
| 51 | layout(location = 40, component = 3) out float w;
|
| 52 | layout(location = 40, component = 1) out vec2 x; // ERROR, overlap
|
| 53 |
|
| 54 | layout(location = 41, component = 3) out vec2 y; // ERROR, goes to component 4
|
| 55 | layout(location = 42, component = 1) out vec4 z; // ERROR, goes to component 4
|
| 56 |
|
| 57 | layout(location = 42, component = 1) out mat4 ba; // ERROR
|
| 58 | layout(location = 43, component = 1) out S Ss; // ERROR
|
| 59 | } bd;
|
| 60 |
|
| 61 | layout(location = 1, component = 1) out; // ERROR, no global setting
|
| 62 |
|
| 63 | layout(location = 50, component = 3) out int be;
|
| 64 | layout(location = 50, component = 0) out vec3 bf;
|
John Kessenich | 44b807e | 2014-01-21 04:43:23 +0000 | [diff] [blame] | 65 |
|
| 66 | out bblck1 {
|
| 67 | vec4 bbv;
|
| 68 | } bbinst1;
|
| 69 |
|
| 70 | out bblck2 {
|
John Kessenich | c7776ec | 2014-01-26 01:37:13 +0000 | [diff] [blame] | 71 | layout(xfb_offset=64) vec4 bbv;
|
John Kessenich | 44b807e | 2014-01-21 04:43:23 +0000 | [diff] [blame] | 72 | } bbinst2;
|
| 73 |
|
John Kessenich | c7776ec | 2014-01-26 01:37:13 +0000 | [diff] [blame] | 74 | layout(xfb_buffer = 3, xfb_stride = 64) out; // default buffer is 3
|
John Kessenich | 44b807e | 2014-01-21 04:43:23 +0000 | [diff] [blame] | 75 |
|
| 76 | out bblck3 {
|
John Kessenich | c7776ec | 2014-01-26 01:37:13 +0000 | [diff] [blame] | 77 | layout(xfb_offset=16) vec4 bbv; // in xfb_buffer 3
|
John Kessenich | 44b807e | 2014-01-21 04:43:23 +0000 | [diff] [blame] | 78 | } bbinst3;
|
| 79 |
|
| 80 | uniform ubblck3 {
|
John Kessenich | c7776ec | 2014-01-26 01:37:13 +0000 | [diff] [blame] | 81 | layout(xfb_offset=16) vec4 bbv; // ERROR, not in a uniform
|
John Kessenich | 44b807e | 2014-01-21 04:43:23 +0000 | [diff] [blame] | 82 | } ubbinst3;
|
| 83 |
|
John Kessenich | c7776ec | 2014-01-26 01:37:13 +0000 | [diff] [blame] | 84 | layout(xfb_buffer=2, xfb_offset=48, xfb_stride=80) out vec4 bg;
|
John Kessenich | 44b807e | 2014-01-21 04:43:23 +0000 | [diff] [blame] | 85 | layout( xfb_offset=32, xfb_stride=64) out vec4 bh;
|
| 86 |
|
| 87 | layout(xfb_offset=48) out; // ERROR
|
| 88 |
|
John Kessenich | c7776ec | 2014-01-26 01:37:13 +0000 | [diff] [blame] | 89 | layout(xfb_stride=80, xfb_buffer=2, xfb_offset=16) out bblck4 {
|
John Kessenich | 44b807e | 2014-01-21 04:43:23 +0000 | [diff] [blame] | 90 | vec4 bbv1;
|
| 91 | vec4 bbv2;
|
| 92 | } bbinst4;
|
| 93 |
|
| 94 | out bblck5 {
|
| 95 | layout(xfb_offset=0) vec4 bbv1;
|
John Kessenich | c7776ec | 2014-01-26 01:37:13 +0000 | [diff] [blame] | 96 | layout(xfb_stride=64, xfb_buffer=3, xfb_offset=48) vec4 bbv2;
|
John Kessenich | 44b807e | 2014-01-21 04:43:23 +0000 | [diff] [blame] | 97 | layout(xfb_buffer=2) vec4 bbv3; // ERROR, wrong buffer
|
| 98 | } bbinst5;
|
John Kessenich | c7776ec | 2014-01-26 01:37:13 +0000 | [diff] [blame] | 99 |
|
| 100 | out layout(xfb_buffer=2) bblck6 {
|
| 101 | layout(xfb_offset=0) vec4 bbv1;
|
| 102 | layout(xfb_stride=64, xfb_buffer=3, xfb_offset=32) vec4 bbv2; // ERROR, overlap 32 from bh, and buffer contradiction
|
| 103 | layout(xfb_buffer=2, xfb_offset=0) vec4 bbv3; // ERROR, overlap 0 from bbinst5
|
| 104 | layout(xfb_buffer=2) vec4 bbv5;
|
| 105 | layout(xfb_offset=24) float bbf6; // ERROR, overlap 24 from bbv1 in bbinst4
|
| 106 | } bbinst6;
|
| 107 |
|
| 108 | layout(xfb_stride=48) out; // ERROR, stride of buffer 3
|
| 109 |
|
| 110 | layout(xfb_buffer=1) out; // default buffer is 1
|
| 111 | layout(xfb_offset=4) out float bj;
|
| 112 | layout(xfb_offset=0) out ivec2 bk; // ERROR, overlap 4
|
| 113 |
|
| 114 | layout(xfb_buffer=3, xfb_stride=48) out; // ERROR, stride of buffer 3 (default is now 3)
|
| 115 | layout(xfb_stride=48) out float bl; // ERROR, stride of buffer 3
|
| 116 |
|
| 117 | layout(xfb_stride=48) out bblck7 { // ERROR, stride of buffer 3
|
| 118 | layout(xfb_stride=64) vec4 bbv1;
|
| 119 | layout(xfb_stride=32) vec4 bbv2; // ERROR, stride of buffer 3
|
| 120 | } bbinst7;
|
| 121 |
|
| 122 | struct S5 {
|
| 123 | int i; // 4 bytes plus 4 byte hole
|
| 124 | double d; // 8 bytes
|
| 125 | float f; // 4 bytes
|
| 126 | }; // total size = 20
|
| 127 |
|
| 128 | struct T {
|
| 129 | bool b; // 4 plus 4 byte hole
|
| 130 | S5 s; // 20
|
| 131 | vec2 v2; // 8
|
| 132 | }; // total size = 36
|
| 133 |
|
| 134 | out layout(xfb_buffer=0, xfb_offset=0, xfb_stride=92) bblck8 { // ERROR, stride not multiple of 8
|
| 135 | bool b; // offset 0
|
| 136 | T t; // offset 8, size 40
|
| 137 | int i; // offset 40 + 4 = 48
|
| 138 | mat3x3 m3; // offset 52
|
| 139 | float f; // offset 52 + 9*4 = 88
|
| 140 | float g; // ERROR, overflow stride
|
| 141 | } bbinst8;
|
| 142 |
|
| 143 | out layout(xfb_buffer=4) bblck9 {
|
| 144 | layout(xfb_offset=1) bool b; // ERROR
|
| 145 | layout(xfb_offset=12) T t; // ERROR
|
| 146 | layout(xfb_offset=52) mat3x3 m3; // non-multiple of 8 okay
|
| 147 | layout(xfb_offset=90) int i; // ERROR
|
| 148 | layout(xfb_offset=98) double d; // ERROR
|
| 149 | layout(xfb_offset=108) S s; // non-multiple of 8 okay
|
| 150 | } bbinst9;
|
| 151 |
|
| 152 | layout(xfb_buffer=5, xfb_stride=6) out; // link ERROR, stride not multiple of 4
|
| 153 | layout(xfb_offset=0) out float bm;
|
| 154 |
|
| 155 | layout(xfb_buffer=6, xfb_stride=2000) out; // ERROR, stride too big
|
| 156 |
|
| 157 | out layout(xfb_buffer=7, xfb_offset=0) bblck10 { // link ERROR, implicit stride too big
|
| 158 | dmat4x4 m1;
|
| 159 | dmat4x4 m2;
|
| 160 | float f;
|
| 161 | } bbinst10;
|
John Kessenich | da581a2 | 2015-10-14 14:10:30 -0600 | [diff] [blame^] | 162 |
|
| 163 | int drawParamsBad()
|
| 164 | {
|
| 165 | return gl_BaseVertexARB + gl_BaseInstanceARB + gl_DrawIDARB; // ERROR, extension not requested
|
| 166 | }
|
| 167 |
|
| 168 | #extension GL_ARB_shader_draw_parameters: enable
|
| 169 |
|
| 170 | int drawParams()
|
| 171 | {
|
| 172 | return gl_BaseVertexARB + gl_BaseInstanceARB + gl_DrawIDARB;
|
| 173 | gl_BaseVertexARB = 3; // ERROR, can't write to shader 'in'
|
| 174 | gl_BaseInstanceARB = 3; // ERROR, can't write to shader 'in'
|
| 175 | gl_DrawIDARB = 3; // ERROR, can't write to shader 'in'
|
| 176 | glBaseInstanceARB; // ERROR, not defined
|
| 177 | }
|