Home | History | Annotate | Download | only in es32
      1 # -------------------------------------------------
      2 # drawElements Quality Program OpenGL ES 3.2 Module
      3 # -------------------------------------------------
      4 #
      5 # Copyright 2016 The Android Open Source Project
      6 #
      7 # Licensed under the Apache License, Version 2.0 (the "License");
      8 # you may not use this file except in compliance with the License.
      9 # You may obtain a copy of the License at
     10 #
     11 #      http://www.apache.org/licenses/LICENSE-2.0
     12 #
     13 # Unless required by applicable law or agreed to in writing, software
     14 # distributed under the License is distributed on an "AS IS" BASIS,
     15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 # See the License for the specific language governing permissions and
     17 # limitations under the License.
     18 
     19 
     20 case mismatch_number_of_declarations
     21 	version 320 es
     22 	desc "Shader io block mismatch: different number of declarations"
     23 	expect link_fail
     24 	vertex ""
     25 		#version 320 es
     26 		${VERTEX_DECLARATIONS}
     27 		out IOBlockName
     28 		{
     29 			mediump float variable1;
     30 		};
     31 
     32 		void main()
     33 		{
     34 			variable1 = float(gl_VertexID);
     35 			${VERTEX_OUTPUT}
     36 		}
     37 	""
     38 	fragment ""
     39 		#version 320 es
     40 		precision mediump float;
     41 		${FRAGMENT_DECLARATIONS}
     42 		in IOBlockName
     43 		{
     44 			mediump float variable1;
     45 			mediump float variable2;
     46 		};
     47 
     48 		void main()
     49 		{
     50 			${FRAG_COLOR} = vec4(variable1 + variable2);
     51 		}
     52 	""
     53 end
     54 
     55 case mismatch_order
     56 	version 320 es
     57 	desc "Shader io block mismatch: different member declaration order"
     58 	expect link_fail
     59 	vertex ""
     60 		#version 320 es
     61 		${VERTEX_DECLARATIONS}
     62 		out IOBlockName
     63 		{
     64 			mediump float variable1;
     65 			mediump float variable2;
     66 		};
     67 
     68 		void main()
     69 		{
     70 			variable1 = float(gl_VertexID);
     71 			${VERTEX_OUTPUT}
     72 		}
     73 	""
     74 	fragment ""
     75 		#version 320 es
     76 		precision mediump float;
     77 		${FRAGMENT_DECLARATIONS}
     78 		in IOBlockName
     79 		{
     80 			mediump float variable2;
     81 			mediump float variable1;
     82 		};
     83 
     84 		void main()
     85 		{
     86 			${FRAG_COLOR} = vec4(variable1 + variable2);
     87 		}
     88 	""
     89 end
     90 
     91 case mismatch_type
     92 	version 320 es
     93 	desc "Shader io block mismatch: different member type"
     94 	expect link_fail
     95 	vertex ""
     96 		#version 320 es
     97 		${VERTEX_DECLARATIONS}
     98 		out IOBlockName
     99 		{
    100 			mediump vec2 variable;
    101 		};
    102 
    103 		void main()
    104 		{
    105 			variable.x = float(gl_VertexID);
    106 			variable.y = float(gl_InstanceID);
    107 			${VERTEX_OUTPUT}
    108 		}
    109 	""
    110 	fragment ""
    111 		#version 320 es
    112 		precision mediump float;
    113 		${FRAGMENT_DECLARATIONS}
    114 		in IOBlockName
    115 		{
    116 			mediump float variable;
    117 		};
    118 
    119 		void main()
    120 		{
    121 			${FRAG_COLOR} = vec4(variable);
    122 		}
    123 	""
    124 end
    125 
    126 case mismatch_member_name
    127 	version 320 es
    128 	desc "Shader io block mismatch: different member name"
    129 	expect link_fail
    130 	vertex ""
    131 		#version 320 es
    132 		${VERTEX_DECLARATIONS}
    133 		out IOBlockName
    134 		{
    135 			mediump float variable1;
    136 		};
    137 
    138 		void main()
    139 		{
    140 			variable1 = float(gl_VertexID);
    141 			${VERTEX_OUTPUT}
    142 		}
    143 	""
    144 	fragment ""
    145 		#version 320 es
    146 		precision mediump float;
    147 		${FRAGMENT_DECLARATIONS}
    148 		in IOBlockName
    149 		{
    150 			mediump float variable2;
    151 		};
    152 
    153 		void main()
    154 		{
    155 			${FRAG_COLOR} = vec4(variable2);
    156 		}
    157 	""
    158 end
    159 
    160 case mismatch_member_array_size
    161 	version 320 es
    162 	desc "Shader io block mismatch: different member array size"
    163 	expect link_fail
    164 	vertex ""
    165 		#version 320 es
    166 		${VERTEX_DECLARATIONS}
    167 		out IOBlockName
    168 		{
    169 			mediump float variable[1];
    170 		};
    171 
    172 		void main()
    173 		{
    174 			variable[0] = float(gl_VertexID);
    175 			${VERTEX_OUTPUT}
    176 		}
    177 	""
    178 	fragment ""
    179 		#version 320 es
    180 		precision mediump float;
    181 		${FRAGMENT_DECLARATIONS}
    182 		in IOBlockName
    183 		{
    184 			mediump float variable[2];
    185 		};
    186 
    187 		void main()
    188 		{
    189 			${FRAG_COLOR} = vec4(variable[0] + variable[1]);
    190 		}
    191 	""
    192 end
    193 
    194 case with_and_without_instance_name
    195 	version 320 es
    196 	desc "Shader io block: with and without instance name"
    197 	values
    198 	{
    199 		input float in0 = 1.0;
    200 		output float out0 = 1.0;
    201 	}
    202 	vertex ""
    203 		#version 320 es
    204 		${VERTEX_DECLARATIONS}
    205 		out IOBlockName
    206 		{
    207 			mediump float variable;
    208 		} instanceName;
    209 
    210 		void main()
    211 		{
    212 			instanceName.variable = in0;
    213 			${VERTEX_OUTPUT}
    214 		}
    215 	""
    216 	fragment ""
    217 		#version 320 es
    218 		precision mediump float;
    219 		${FRAGMENT_DECLARATIONS}
    220 		in IOBlockName
    221 		{
    222 			mediump float variable;
    223 		};
    224 
    225 		void main()
    226 		{
    227 			out0 = variable;
    228 			${FRAGMENT_OUTPUT}
    229 		}
    230 	""
    231 end
    232 
    233 case mismatch_block_array_size
    234 	version 320 es
    235 	desc "Shader io block mismatch: different array size"
    236 	expect link_fail
    237 	vertex ""
    238 		#version 320 es
    239 		${VERTEX_DECLARATIONS}
    240 		out IOBlockName
    241 		{
    242 			mediump float variable;
    243 		} instanceName[1];
    244 
    245 		void main()
    246 		{
    247 			instanceName[0].variable = float(gl_VertexID);
    248 			${VERTEX_OUTPUT}
    249 		}
    250 	""
    251 	fragment ""
    252 		#version 320 es
    253 		precision mediump float;
    254 		${FRAGMENT_DECLARATIONS}
    255 		in IOBlockName
    256 		{
    257 			mediump float variable;
    258 		} instanceName[2];
    259 
    260 		void main()
    261 		{
    262 			${FRAG_COLOR} = vec4(instanceName[0].variable + instanceName[1].variable);
    263 		}
    264 	""
    265 end
    266 
    267 case missing_output_block
    268 	version 320 es
    269 	desc "Shader io block mismatch: missing output block"
    270 	expect link_fail
    271 	vertex ""
    272 		#version 320 es
    273 		${VERTEX_DECLARATIONS}
    274 		void main()
    275 		{
    276 			${VERTEX_OUTPUT}
    277 		}
    278 	""
    279 	fragment ""
    280 		#version 320 es
    281 		precision mediump float;
    282 		${FRAGMENT_DECLARATIONS}
    283 		in IOBlockName
    284 		{
    285 			mediump float variable;
    286 		};
    287 
    288 		void main()
    289 		{
    290 			${FRAG_COLOR} = vec4(variable);
    291 		}
    292 	""
    293 end
    294 
    295 case ambiguous_variable_name_1
    296 	version 320 es
    297 	desc "Unnamed io block variable and global variable with identical names"
    298 	expect compile_or_link_fail
    299 	vertex ""
    300 		#version 320 es
    301 		${VERTEX_DECLARATIONS}
    302 		float variable;
    303 		out IOBlockName
    304 		{
    305 			mediump float variable;
    306 		};
    307 
    308 		void main()
    309 		{
    310 			variable = float(gl_VertexID);
    311 			${VERTEX_OUTPUT}
    312 		}
    313 	""
    314 	fragment ""
    315 		#version 320 es
    316 		precision mediump float;
    317 		${FRAGMENT_DECLARATIONS}
    318 		in IOBlockName
    319 		{
    320 			mediump float variable;
    321 		};
    322 
    323 		void main()
    324 		{
    325 			${FRAG_COLOR} = vec4(variable);
    326 		}
    327 	""
    328 end
    329 
    330 case ambiguous_variable_name_2
    331 	version 320 es
    332 	desc "Two unnamed io blocks with variables with identical names"
    333 	expect compile_or_link_fail
    334 	vertex ""
    335 		#version 320 es
    336 		${VERTEX_DECLARATIONS}
    337 		out IOBlockNameA
    338 		{
    339 			mediump float variable;
    340 		};
    341 		out IOBlockNameB
    342 		{
    343 			mediump float variable;
    344 		};
    345 
    346 		void main()
    347 		{
    348 			variable = float(gl_VertexID);
    349 			${VERTEX_OUTPUT}
    350 		}
    351 	""
    352 	fragment ""
    353 		#version 320 es
    354 		precision mediump float;
    355 		${FRAGMENT_DECLARATIONS}
    356 		in IOBlockNameA
    357 		{
    358 			mediump float variable;
    359 		};
    360 		in IOBlockNameB
    361 		{
    362 			mediump float variable;
    363 		};
    364 
    365 		void main()
    366 		{
    367 			${FRAG_COLOR} = vec4(variable);
    368 		}
    369 	""
    370 end
    371