Home | History | Annotate | Download | only in shaders
      1 case duplicate_location
      2 	expect compile_or_link_fail
      3 	version 310 es
      4 	values { output float out0 = 0.0; }
      5 
      6 	both ""
      7 		#version 310 es
      8 		precision highp float;
      9 		layout(location = 0) uniform float uni0;
     10 		layout(location = 0) uniform float uni1;
     11 		${DECLARATIONS}
     12 
     13 		void main()
     14 		{
     15 			out0 = uni0 + uni1;
     16 			${OUTPUT}
     17 		}
     18 	""
     19 end
     20 
     21 case duplicate_location_unused
     22 	expect compile_or_link_fail
     23 	version 310 es
     24 	values { output float out0 = 0.0; }
     25 
     26 	both ""
     27 		#version 310 es
     28 		precision highp float;
     29 		layout(location = 0) uniform float uni0;
     30 		layout(location = 0) uniform float uni1;
     31 		${DECLARATIONS}
     32 
     33 		void main()
     34 		{
     35 			out0 = 0.0;
     36 			${OUTPUT}
     37 		}
     38 	""
     39 end
     40 
     41 case duplicate_location_split
     42 	expect compile_or_link_fail
     43 	version 310 es
     44 	values{ output float out0 = 0.0; }
     45 
     46 	vertex ""
     47 		#version 310 es
     48 		precision highp float;
     49 		layout(location = 0) uniform float uni0;
     50 
     51 		in highp vec4 dEQP_Position;
     52 
     53 		void main()
     54 		{
     55 			gl_Position = dEQP_Position;
     56 		}
     57 	""
     58 
     59 	fragment ""
     60 		#version 310 es
     61 		precision highp float;
     62 		layout(location = 0) uniform float uni1;
     63 
     64 		layout(location = 0) out mediump vec4 dEQP_FragColor;
     65 
     66 		void main()
     67 		{
     68 			dEQP_FragColor = vec4(1);
     69 		}
     70 	""
     71 end
     72 
     73 case array_overlap
     74 	expect compile_or_link_fail
     75 	version 310 es
     76 	values { output float out0 = 0.0; }
     77 
     78 	both ""
     79 		#version 310 es
     80 		precision highp float;
     81 		layout(location = 0) uniform float uni0[8];
     82 		layout(location = 5) uniform float uni1;
     83 		${DECLARATIONS}
     84 
     85 		void main()
     86 		{
     87 			out0 = uni0[0] + uni1;
     88 			${OUTPUT}
     89 		}
     90 	""
     91 end
     92 
     93 case array_overlap_unused
     94 	expect compile_or_link_fail
     95 	version 310 es
     96 	values { output float out0 = 0.0; }
     97 
     98 	both ""
     99 		#version 310 es
    100 		precision highp float;
    101 		layout(location = 0) uniform float uni0[8];
    102 		layout(location = 5) uniform float uni1;
    103 		${DECLARATIONS}
    104 
    105 		void main()
    106 		{
    107 			out0 = 0.0;
    108 			${OUTPUT}
    109 		}
    110 	""
    111 end
    112 
    113 case array_overlap_split
    114 	expect compile_or_link_fail
    115 	version 310 es
    116 	values{ output float out0 = 0.0; }
    117 
    118 	vertex ""
    119 		#version 310 es
    120 		precision highp float;
    121 		layout(location = 0) uniform float uni0[8];
    122 
    123 		in highp vec4 dEQP_Position;
    124 
    125 		void main()
    126 		{
    127 			gl_Position = dEQP_Position;
    128 		}
    129 	""
    130 
    131 	fragment ""
    132 		#version 310 es
    133 		precision highp float;
    134 		layout(location = 7) uniform float uni1[4];
    135 
    136 		layout(location = 0) out mediump vec4 dEQP_FragColor;
    137 
    138 		void main()
    139 		{
    140 			dEQP_FragColor = vec4(1);
    141 		}
    142 	""
    143 end
    144 
    145 case struct_overlap
    146 	expect compile_or_link_fail
    147 	version 310 es
    148 	values { output float out0 = 0.0; }
    149 
    150 	both ""
    151 		#version 310 es
    152 		precision highp float;
    153 
    154 		struct S
    155 		{
    156 			vec4 a;
    157 			int  b;
    158 			mat4 c;
    159 		};
    160 
    161 		layout(location = 0) uniform S uni0;
    162 		layout(location = 2) uniform float uni1;
    163 		${DECLARATIONS}
    164 
    165 		void main()
    166 		{
    167 			out0 = uni0.a.x + uni1;
    168 			${OUTPUT}
    169 		}
    170 	""
    171 end
    172 
    173 case struct_overlap_unused
    174 	expect compile_or_link_fail
    175 	version 310 es
    176 	values { output float out0 = 0.0; }
    177 
    178 	both ""
    179 		#version 310 es
    180 		precision highp float;
    181 
    182 		struct S
    183 		{
    184 			vec4 a;
    185 			int  b;
    186 			mat4 c;
    187 		};
    188 
    189 		layout(location = 0) uniform S uni0;
    190 		layout(location = 2) uniform float uni1;
    191 		${DECLARATIONS}
    192 
    193 		void main()
    194 		{
    195 			out0 = 0.0;
    196 			${OUTPUT}
    197 		}
    198 	""
    199 end
    200 
    201 case struct_overlap_split
    202 	expect compile_or_link_fail
    203 	version 310 es
    204 	values{ output float out0 = 0.0; }
    205 
    206 	vertex ""
    207 		#version 310 es
    208 		precision highp float;
    209 
    210 		struct S
    211 		{
    212 			vec4 a;
    213 			int  b;
    214 			uint c;
    215 			vec2 d;
    216 		};
    217 
    218 		layout(location = 7) uniform S uni0;
    219 		layout(location = 12) uniform float uni2;
    220 
    221 		in highp vec4 dEQP_Position;
    222 
    223 		void main()
    224 		{
    225 			gl_Position = dEQP_Position;
    226 		}
    227 	""
    228 
    229 	fragment ""
    230 		#version 310 es
    231 		precision highp float;
    232 		layout(location = 9) uniform float uni1[4];
    233 
    234 		layout(location = 0) out mediump vec4 dEQP_FragColor;
    235 
    236 		void main()
    237 		{
    238 			dEQP_FragColor = vec4(1);
    239 		}
    240 	""
    241 end
    242 
    243 case complex_overlap
    244 	expect compile_or_link_fail
    245 	version 310 es
    246 	values { output float out0 = 0.0; }
    247 
    248 	both ""
    249 		#version 310 es
    250 		precision highp float;
    251 
    252 		struct S // size 2
    253 		{
    254 			vec3 a;
    255 			float b;
    256 		};
    257 
    258 		struct T // size 5
    259 		{
    260 			S s[2];
    261 			mat2 a;
    262 		};
    263 
    264 		struct U // size 6
    265 		{
    266 			S s;
    267 			float a[4];
    268 		};
    269 
    270 		layout(location = 0) uniform S  uni0; // good
    271 		layout(location = 1) uniform T  uni1; // bad
    272 		layout(location = 6) uniform T  uni2; // good
    273 		layout(location = 11) uniform U uni3[3]; // good
    274 		layout(location = 20) uniform S uni4; // bad
    275 		layout(location = 28) uniform int uni5; // bad
    276 		${DECLARATIONS}
    277 
    278 		void main()
    279 		{
    280 			out0 = 0.0;
    281 			${OUTPUT}
    282 		}
    283 	""
    284 end
    285 
    286 case atomic
    287 	# \todo [2014-02-14 otto] invalid layout qualifier is generally a compiler error but spec does not yet say that this should be an error. Verify & fix once final 3.1 spec is out
    288 	expect compile_fail
    289 	version 310 es
    290 	values { output float out0 = 0.0; }
    291 
    292 	both ""
    293 		#version 310 es
    294 		precision highp float;
    295 		layout(location = 3, binding = 0, offset = 0) uniform atomic_uint uni0;
    296 		${DECLARATIONS}
    297 
    298 		void main()
    299 		{
    300 			out0 = 0.0;
    301 			${OUTPUT}
    302 		}
    303 	""
    304 end
    305