Home | History | Annotate | Download | only in es31
      1 
      2 group varying "Varying linkage"
      3 	group rules "Rules"
      4 
      5 		case input_type_mismatch
      6 			version 310 es
      7 			desc "Tessellation control shader input type mismatch"
      8 			expect link_fail
      9 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
     10 			values
     11 			{
     12 				input float in0 = 1.0;
     13 				output float out0 = 1.0;
     14 			}
     15 			vertex ""
     16 				#version 310 es
     17 				${VERTEX_DECLARATIONS}
     18 				out mediump float tc_in;
     19 				void main()
     20 				{
     21 					tc_in = in0;
     22 					${VERTEX_OUTPUT}
     23 				}
     24 			""
     25 			tessellation_control ""
     26 				#version 310 es
     27 				${TESSELLATION_CONTROL_DECLARATIONS}
     28 				in mediump vec2 tc_in[];
     29 				out mediump float tc_out[];
     30 				void main()
     31 				{
     32 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID].x;
     33 					${TESSELLATION_CONTROL_OUTPUT}
     34 				}
     35 			""
     36 			tessellation_evaluation ""
     37 				#version 310 es
     38 				${TESSELLATION_EVALUATION_DECLARATIONS}
     39 				in mediump float tc_out[];
     40 				out mediump float te_out;
     41 				void main()
     42 				{
     43 					te_out = tc_out[2];
     44 					${TESSELLATION_EVALUATION_OUTPUT}
     45 				}
     46 			""
     47 			fragment ""
     48 				#version 310 es
     49 				precision mediump float;
     50 				${FRAGMENT_DECLARATIONS}
     51 				in mediump float te_out;
     52 				void main()
     53 				{
     54 					out0 = te_out;
     55 					${FRAGMENT_OUTPUT}
     56 				}
     57 			""
     58 		end
     59 
     60 		case output_type_mismatch
     61 			version 310 es
     62 			desc "Tessellation evaluation shader output type mismatch"
     63 			expect link_fail
     64 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
     65 			values
     66 			{
     67 				input float in0 = 1.0;
     68 				output float out0 = 1.0;
     69 			}
     70 			vertex ""
     71 				#version 310 es
     72 				${VERTEX_DECLARATIONS}
     73 				out mediump float tc_in;
     74 				void main()
     75 				{
     76 					tc_in = in0;
     77 					${VERTEX_OUTPUT}
     78 				}
     79 			""
     80 			tessellation_control ""
     81 				#version 310 es
     82 				${TESSELLATION_CONTROL_DECLARATIONS}
     83 				in mediump float tc_in[];
     84 				out mediump float tc_out[];
     85 				void main()
     86 				{
     87 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
     88 					${TESSELLATION_CONTROL_OUTPUT}
     89 				}
     90 			""
     91 			tessellation_evaluation ""
     92 				#version 310 es
     93 				${TESSELLATION_EVALUATION_DECLARATIONS}
     94 				in mediump float tc_out[];
     95 				out mediump float te_out;
     96 				void main()
     97 				{
     98 					te_out = tc_out[2];
     99 					${TESSELLATION_EVALUATION_OUTPUT}
    100 				}
    101 			""
    102 			fragment ""
    103 				#version 310 es
    104 				precision mediump float;
    105 				${FRAGMENT_DECLARATIONS}
    106 				in mediump vec2 te_out;
    107 				void main()
    108 				{
    109 					out0 = te_out.x + te_out.y;
    110 					${FRAGMENT_OUTPUT}
    111 				}
    112 			""
    113 		end
    114 
    115 		case internal_type_mismatch
    116 			version 310 es
    117 			desc "Tessellation control and evaluation shader varying type mismatch"
    118 			expect link_fail
    119 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    120 			values
    121 			{
    122 				input float in0 = 1.0;
    123 				output float out0 = 1.0;
    124 			}
    125 			vertex ""
    126 				#version 310 es
    127 				${VERTEX_DECLARATIONS}
    128 				out mediump float tc_in;
    129 				void main()
    130 				{
    131 					tc_in = in0;
    132 					${VERTEX_OUTPUT}
    133 				}
    134 			""
    135 			tessellation_control ""
    136 				#version 310 es
    137 				${TESSELLATION_CONTROL_DECLARATIONS}
    138 				in mediump float tc_in[];
    139 				out mediump float tc_out[];
    140 				void main()
    141 				{
    142 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    143 					${TESSELLATION_CONTROL_OUTPUT}
    144 				}
    145 			""
    146 			tessellation_evaluation ""
    147 				#version 310 es
    148 				${TESSELLATION_EVALUATION_DECLARATIONS}
    149 				in mediump vec2 tc_out[];
    150 				out mediump float te_out;
    151 				void main()
    152 				{
    153 					te_out = tc_out[2].x + tc_out[0].y;
    154 					${TESSELLATION_EVALUATION_OUTPUT}
    155 				}
    156 			""
    157 			fragment ""
    158 				#version 310 es
    159 				precision mediump float;
    160 				${FRAGMENT_DECLARATIONS}
    161 				in mediump float te_out;
    162 				void main()
    163 				{
    164 					out0 = te_out;
    165 					${FRAGMENT_OUTPUT}
    166 				}
    167 			""
    168 		end
    169 
    170 		case input_different_precision
    171 			version 310 es
    172 			desc "Tessellation control shader input precisions different"
    173 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    174 			values
    175 			{
    176 				input float in0 = 1.0;
    177 				output float out0 = 1.0;
    178 			}
    179 			vertex ""
    180 				#version 310 es
    181 				${VERTEX_DECLARATIONS}
    182 				out highp float tc_in;
    183 				void main()
    184 				{
    185 					tc_in = in0;
    186 					${VERTEX_OUTPUT}
    187 				}
    188 			""
    189 			tessellation_control ""
    190 				#version 310 es
    191 				${TESSELLATION_CONTROL_DECLARATIONS}
    192 				in lowp float tc_in[];
    193 				out mediump float tc_out[];
    194 				void main()
    195 				{
    196 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    197 					${TESSELLATION_CONTROL_OUTPUT}
    198 				}
    199 			""
    200 			tessellation_evaluation ""
    201 				#version 310 es
    202 				${TESSELLATION_EVALUATION_DECLARATIONS}
    203 				in mediump float tc_out[];
    204 				out mediump float te_out;
    205 				void main()
    206 				{
    207 					te_out = tc_out[2];
    208 					${TESSELLATION_EVALUATION_OUTPUT}
    209 				}
    210 			""
    211 			fragment ""
    212 				#version 310 es
    213 				precision mediump float;
    214 				${FRAGMENT_DECLARATIONS}
    215 				in mediump float te_out;
    216 				void main()
    217 				{
    218 					out0 = te_out;
    219 					${FRAGMENT_OUTPUT}
    220 				}
    221 			""
    222 		end
    223 
    224 		case output_different_precision
    225 			version 310 es
    226 			desc "Tessellation evaluation shader output precisions different"
    227 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    228 			values
    229 			{
    230 				input float in0 = 1.0;
    231 				output float out0 = 1.0;
    232 			}
    233 			vertex ""
    234 				#version 310 es
    235 				${VERTEX_DECLARATIONS}
    236 				out mediump float tc_in;
    237 				void main()
    238 				{
    239 					tc_in = in0;
    240 					${VERTEX_OUTPUT}
    241 				}
    242 			""
    243 			tessellation_control ""
    244 				#version 310 es
    245 				${TESSELLATION_CONTROL_DECLARATIONS}
    246 				in mediump float tc_in[];
    247 				out mediump float tc_out[];
    248 				void main()
    249 				{
    250 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    251 					${TESSELLATION_CONTROL_OUTPUT}
    252 				}
    253 			""
    254 			tessellation_evaluation ""
    255 				#version 310 es
    256 				${TESSELLATION_EVALUATION_DECLARATIONS}
    257 				in mediump float tc_out[];
    258 				out highp float te_out;
    259 				void main()
    260 				{
    261 					te_out = tc_out[2];
    262 					${TESSELLATION_EVALUATION_OUTPUT}
    263 				}
    264 			""
    265 			fragment ""
    266 				#version 310 es
    267 				precision mediump float;
    268 				${FRAGMENT_DECLARATIONS}
    269 				in lowp float te_out;
    270 				void main()
    271 				{
    272 					out0 = te_out;
    273 					${FRAGMENT_OUTPUT}
    274 				}
    275 			""
    276 		end
    277 
    278 		case internal_different_precision
    279 			version 310 es
    280 			desc "Tessellation control and evaluation shader varying precisions different"
    281 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    282 			values
    283 			{
    284 				input float in0 = 1.0;
    285 				output float out0 = 1.0;
    286 			}
    287 			vertex ""
    288 				#version 310 es
    289 				${VERTEX_DECLARATIONS}
    290 				out mediump float tc_in;
    291 				void main()
    292 				{
    293 					tc_in = in0;
    294 					${VERTEX_OUTPUT}
    295 				}
    296 			""
    297 			tessellation_control ""
    298 				#version 310 es
    299 				${TESSELLATION_CONTROL_DECLARATIONS}
    300 				in mediump float tc_in[];
    301 				out highp float tc_out[];
    302 				void main()
    303 				{
    304 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    305 					${TESSELLATION_CONTROL_OUTPUT}
    306 				}
    307 			""
    308 			tessellation_evaluation ""
    309 				#version 310 es
    310 				${TESSELLATION_EVALUATION_DECLARATIONS}
    311 				in lowp float tc_out[];
    312 				out mediump float te_out;
    313 				void main()
    314 				{
    315 					te_out = tc_out[2];
    316 					${TESSELLATION_EVALUATION_OUTPUT}
    317 				}
    318 			""
    319 			fragment ""
    320 				#version 310 es
    321 				precision mediump float;
    322 				${FRAGMENT_DECLARATIONS}
    323 				in mediump float te_out;
    324 				void main()
    325 				{
    326 					out0 = te_out;
    327 					${FRAGMENT_OUTPUT}
    328 				}
    329 			""
    330 		end
    331 
    332 		case input_no_declaration
    333 			version 310 es
    334 			desc "Tessellation control shader input with no matching output"
    335 			expect link_fail
    336 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    337 			values
    338 			{
    339 				input float in0 = 1.0;
    340 				output float out0 = 1.0;
    341 			}
    342 			vertex ""
    343 				#version 310 es
    344 				${VERTEX_DECLARATIONS}
    345 				void main()
    346 				{
    347 					${VERTEX_OUTPUT}
    348 				}
    349 			""
    350 			tessellation_control ""
    351 				#version 310 es
    352 				${TESSELLATION_CONTROL_DECLARATIONS}
    353 				in mediump float tc_in[];
    354 				out mediump float tc_out[];
    355 				void main()
    356 				{
    357 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    358 					${TESSELLATION_CONTROL_OUTPUT}
    359 				}
    360 			""
    361 			tessellation_evaluation ""
    362 				#version 310 es
    363 				${TESSELLATION_EVALUATION_DECLARATIONS}
    364 				in mediump float tc_out[];
    365 				out mediump float te_out;
    366 				void main()
    367 				{
    368 					te_out = tc_out[2];
    369 					${TESSELLATION_EVALUATION_OUTPUT}
    370 				}
    371 			""
    372 			fragment ""
    373 				#version 310 es
    374 				precision mediump float;
    375 				${FRAGMENT_DECLARATIONS}
    376 				in mediump float te_out;
    377 				void main()
    378 				{
    379 					out0 = te_out;
    380 					${FRAGMENT_OUTPUT}
    381 				}
    382 			""
    383 		end
    384 
    385 		case output_no_declaration
    386 			version 310 es
    387 			desc "Tessellation evaluation shader without output for an fragment shader input"
    388 			expect link_fail
    389 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    390 			values
    391 			{
    392 				output float out0 = 1.0;
    393 			}
    394 			vertex ""
    395 				#version 310 es
    396 				${VERTEX_DECLARATIONS}
    397 				void main()
    398 				{
    399 					${VERTEX_OUTPUT}
    400 				}
    401 			""
    402 			tessellation_control ""
    403 				#version 310 es
    404 				${TESSELLATION_CONTROL_DECLARATIONS}
    405 				void main()
    406 				{
    407 					${TESSELLATION_CONTROL_OUTPUT}
    408 				}
    409 			""
    410 			tessellation_evaluation ""
    411 				#version 310 es
    412 				${TESSELLATION_EVALUATION_DECLARATIONS}
    413 				void main()
    414 				{
    415 					${TESSELLATION_EVALUATION_OUTPUT}
    416 				}
    417 			""
    418 			fragment ""
    419 				#version 310 es
    420 				precision mediump float;
    421 				${FRAGMENT_DECLARATIONS}
    422 				in mediump float te_out;
    423 				void main()
    424 				{
    425 					out0 = te_out;
    426 					${FRAGMENT_OUTPUT}
    427 				}
    428 			""
    429 		end
    430 
    431 		case internal_no_declaration
    432 			version 310 es
    433 			desc "Tessellation evaluation shader input without matching output"
    434 			expect link_fail
    435 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    436 			values
    437 			{
    438 				output float out0 = 1.0;
    439 			}
    440 			vertex ""
    441 				#version 310 es
    442 				${VERTEX_DECLARATIONS}
    443 				void main()
    444 				{
    445 					${VERTEX_OUTPUT}
    446 				}
    447 			""
    448 			tessellation_control ""
    449 				#version 310 es
    450 				${TESSELLATION_CONTROL_DECLARATIONS}
    451 				void main()
    452 				{
    453 					${TESSELLATION_CONTROL_OUTPUT}
    454 				}
    455 			""
    456 			tessellation_evaluation ""
    457 				#version 310 es
    458 				${TESSELLATION_EVALUATION_DECLARATIONS}
    459 				in mediump float tc_out[];
    460 				out mediump float te_out;
    461 				void main()
    462 				{
    463 					te_out = tc_out[2];
    464 					${TESSELLATION_EVALUATION_OUTPUT}
    465 				}
    466 			""
    467 			fragment ""
    468 				#version 310 es
    469 				precision mediump float;
    470 				${FRAGMENT_DECLARATIONS}
    471 				in mediump float te_out;
    472 				void main()
    473 				{
    474 					out0 = te_out;
    475 					${FRAGMENT_OUTPUT}
    476 				}
    477 			""
    478 		end
    479 
    480 		case input_superfluous_declaration
    481 			version 310 es
    482 			desc "Tessellation control has no input for an output"
    483 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    484 			values
    485 			{
    486 				input float in0 = 1.0;
    487 				output float out0 = 1.0;
    488 			}
    489 			vertex ""
    490 				#version 310 es
    491 				${VERTEX_DECLARATIONS}
    492 				out mediump float tc_in;
    493 				out mediump float tc_in_unused;
    494 				void main()
    495 				{
    496 					tc_in = in0;
    497 					tc_in_unused = in0 + 1.0;
    498 					${VERTEX_OUTPUT}
    499 				}
    500 			""
    501 			tessellation_control ""
    502 				#version 310 es
    503 				${TESSELLATION_CONTROL_DECLARATIONS}
    504 				in mediump float tc_in[];
    505 				out mediump float tc_out[];
    506 				void main()
    507 				{
    508 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    509 					${TESSELLATION_CONTROL_OUTPUT}
    510 				}
    511 			""
    512 			tessellation_evaluation ""
    513 				#version 310 es
    514 				${TESSELLATION_EVALUATION_DECLARATIONS}
    515 				in mediump float tc_out[];
    516 				out mediump float te_out;
    517 				void main()
    518 				{
    519 					te_out = tc_out[2];
    520 					${TESSELLATION_EVALUATION_OUTPUT}
    521 				}
    522 			""
    523 			fragment ""
    524 				#version 310 es
    525 				precision mediump float;
    526 				${FRAGMENT_DECLARATIONS}
    527 				in mediump float te_out;
    528 				void main()
    529 				{
    530 					out0 = te_out;
    531 					${FRAGMENT_OUTPUT}
    532 				}
    533 			""
    534 		end
    535 
    536 		case output_superfluous_declaration
    537 			version 310 es
    538 			desc "Tessellation has an output without a matching input"
    539 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    540 			values
    541 			{
    542 				input float in0 = 1.0;
    543 				output float out0 = 1.0;
    544 			}
    545 			vertex ""
    546 				#version 310 es
    547 				${VERTEX_DECLARATIONS}
    548 				out mediump float tc_in;
    549 				void main()
    550 				{
    551 					tc_in = in0;
    552 					${VERTEX_OUTPUT}
    553 				}
    554 			""
    555 			tessellation_control ""
    556 				#version 310 es
    557 				${TESSELLATION_CONTROL_DECLARATIONS}
    558 				in mediump float tc_in[];
    559 				out mediump float tc_out[];
    560 				void main()
    561 				{
    562 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    563 					${TESSELLATION_CONTROL_OUTPUT}
    564 				}
    565 			""
    566 			tessellation_evaluation ""
    567 				#version 310 es
    568 				${TESSELLATION_EVALUATION_DECLARATIONS}
    569 				in mediump float tc_out[];
    570 				out mediump float te_out;
    571 				out mediump float te_out_unused;
    572 				void main()
    573 				{
    574 					te_out = tc_out[2];
    575 					te_out_unused = tc_out[0];
    576 					${TESSELLATION_EVALUATION_OUTPUT}
    577 				}
    578 			""
    579 			fragment ""
    580 				#version 310 es
    581 				precision mediump float;
    582 				${FRAGMENT_DECLARATIONS}
    583 				in mediump float te_out;
    584 				void main()
    585 				{
    586 					out0 = te_out;
    587 					${FRAGMENT_OUTPUT}
    588 				}
    589 			""
    590 		end
    591 
    592 		case internal_superfluous_declaration
    593 			version 310 es
    594 			desc "Tessellation control has an output without a matching input"
    595 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    596 			values
    597 			{
    598 				input float in0 = 1.0;
    599 				output float out0 = 1.0;
    600 			}
    601 			vertex ""
    602 				#version 310 es
    603 				${VERTEX_DECLARATIONS}
    604 				out mediump float tc_in;
    605 				void main()
    606 				{
    607 					tc_in = in0;
    608 					${VERTEX_OUTPUT}
    609 				}
    610 			""
    611 			tessellation_control ""
    612 				#version 310 es
    613 				${TESSELLATION_CONTROL_DECLARATIONS}
    614 				in mediump float tc_in[];
    615 				out mediump float tc_out[];
    616 				out mediump float tc_out_unused[];
    617 				void main()
    618 				{
    619 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    620 					tc_out_unused[gl_InvocationID] = tc_in[gl_InvocationID] + 1.0;
    621 					${TESSELLATION_CONTROL_OUTPUT}
    622 				}
    623 			""
    624 			tessellation_evaluation ""
    625 				#version 310 es
    626 				${TESSELLATION_EVALUATION_DECLARATIONS}
    627 				in mediump float tc_out[];
    628 				out mediump float te_out;
    629 				void main()
    630 				{
    631 					te_out = tc_out[2];
    632 					${TESSELLATION_EVALUATION_OUTPUT}
    633 				}
    634 			""
    635 			fragment ""
    636 				#version 310 es
    637 				precision mediump float;
    638 				${FRAGMENT_DECLARATIONS}
    639 				in mediump float te_out;
    640 				void main()
    641 				{
    642 					out0 = te_out;
    643 					${FRAGMENT_OUTPUT}
    644 				}
    645 			""
    646 		end
    647 
    648 		case vertex_fragment_same_varying_name_1
    649 			version 310 es
    650 			desc "Tessellation control has an output without a matching input"
    651 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    652 			values
    653 			{
    654 				input float in0 = 1.0;
    655 				output float out0 = 2.0;
    656 			}
    657 			vertex ""
    658 				#version 310 es
    659 				${VERTEX_DECLARATIONS}
    660 				out mediump float sharedVaringName;
    661 				void main()
    662 				{
    663 					sharedVaringName = in0;
    664 					${VERTEX_OUTPUT}
    665 				}
    666 			""
    667 			tessellation_control ""
    668 				#version 310 es
    669 				${TESSELLATION_CONTROL_DECLARATIONS}
    670 				in mediump float sharedVaringName[];
    671 				out mediump float tc_out[];
    672 				void main()
    673 				{
    674 					tc_out[gl_InvocationID] = sharedVaringName[gl_InvocationID];
    675 					${TESSELLATION_CONTROL_OUTPUT}
    676 				}
    677 			""
    678 			tessellation_evaluation ""
    679 				#version 310 es
    680 				${TESSELLATION_EVALUATION_DECLARATIONS}
    681 				in mediump float tc_out[];
    682 				out mediump float sharedVaringName;
    683 				void main()
    684 				{
    685 					sharedVaringName = 2.0 * tc_out[2];
    686 					${TESSELLATION_EVALUATION_OUTPUT}
    687 				}
    688 			""
    689 			fragment ""
    690 				#version 310 es
    691 				precision mediump float;
    692 				${FRAGMENT_DECLARATIONS}
    693 				in mediump float sharedVaringName;
    694 				void main()
    695 				{
    696 					out0 = sharedVaringName;
    697 					${FRAGMENT_OUTPUT}
    698 				}
    699 			""
    700 		end
    701 
    702 		case vertex_fragment_same_varying_name_2
    703 			version 310 es
    704 			desc "Tessellation control has an output without a matching input"
    705 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    706 			values
    707 			{
    708 				input vec2 in0 = vec2(1.0, 3.0);
    709 				output float out0 = 4.0;
    710 			}
    711 			vertex ""
    712 				#version 310 es
    713 				${VERTEX_DECLARATIONS}
    714 				out mediump vec2 sharedVaringName;
    715 				void main()
    716 				{
    717 					sharedVaringName = in0;
    718 					${VERTEX_OUTPUT}
    719 				}
    720 			""
    721 			tessellation_control ""
    722 				#version 310 es
    723 				${TESSELLATION_CONTROL_DECLARATIONS}
    724 				in mediump vec2 sharedVaringName[];
    725 				out mediump float tc_out[];
    726 				void main()
    727 				{
    728 					tc_out[gl_InvocationID] = sharedVaringName[gl_InvocationID].x + sharedVaringName[gl_InvocationID].y;
    729 					${TESSELLATION_CONTROL_OUTPUT}
    730 				}
    731 			""
    732 			tessellation_evaluation ""
    733 				#version 310 es
    734 				${TESSELLATION_EVALUATION_DECLARATIONS}
    735 				in mediump float tc_out[];
    736 				out mediump float sharedVaringName;
    737 				void main()
    738 				{
    739 					sharedVaringName = tc_out[2];
    740 					${TESSELLATION_EVALUATION_OUTPUT}
    741 				}
    742 			""
    743 			fragment ""
    744 				#version 310 es
    745 				precision mediump float;
    746 				${FRAGMENT_DECLARATIONS}
    747 				in mediump float sharedVaringName;
    748 				void main()
    749 				{
    750 					out0 = sharedVaringName;
    751 					${FRAGMENT_OUTPUT}
    752 				}
    753 			""
    754 		end
    755 
    756 		case invalid_vertex_index
    757 			version 310 es
    758 			desc "Tessellation control output not indexed with gl_InvocationID"
    759 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    760 			expect compile_or_link_fail
    761 			vertex ""
    762 				#version 310 es
    763 				${VERTEX_DECLARATIONS}
    764 				void main()
    765 				{
    766 					${VERTEX_OUTPUT}
    767 				}
    768 			""
    769 			tessellation_control ""
    770 				#version 310 es
    771 				${TESSELLATION_CONTROL_DECLARATIONS}
    772 				out mediump float tc_out[];
    773 				void main()
    774 				{
    775 					tc_out[2 - gl_InvocationID] = float(gl_InvocationID);
    776 					${TESSELLATION_CONTROL_OUTPUT}
    777 				}
    778 			""
    779 			tessellation_evaluation ""
    780 				#version 310 es
    781 				${TESSELLATION_EVALUATION_DECLARATIONS}
    782 				in mediump float tc_out[];
    783 				out mediump float te_out;
    784 				void main()
    785 				{
    786 					te_out = tc_out[2];
    787 					${TESSELLATION_EVALUATION_OUTPUT}
    788 				}
    789 			""
    790 			fragment ""
    791 				#version 310 es
    792 				precision mediump float;
    793 				${FRAGMENT_DECLARATIONS}
    794 				in mediump float te_out;
    795 				void main()
    796 				{
    797 					${FRAG_COLOR} = vec4(te_out);
    798 				}
    799 			""
    800 		end
    801 
    802 		case input_non_array
    803 			version 310 es
    804 			desc "Tessellation control input in not an array"
    805 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    806 			expect compile_or_link_fail
    807 			values
    808 			{
    809 				input float in0 = 1.0;
    810 				output float out0 = 1.0;
    811 			}
    812 			vertex ""
    813 				#version 310 es
    814 				${VERTEX_DECLARATIONS}
    815 				out mediump float tc_in;
    816 				void main()
    817 				{
    818 					tc_in = in0;
    819 					${VERTEX_OUTPUT}
    820 				}
    821 			""
    822 			tessellation_control ""
    823 				#version 310 es
    824 				${TESSELLATION_CONTROL_DECLARATIONS}
    825 				in mediump float tc_in;
    826 				out mediump float tc_out[];
    827 				void main()
    828 				{
    829 					tc_out[gl_InvocationID] = tc_in;
    830 					${TESSELLATION_CONTROL_OUTPUT}
    831 				}
    832 			""
    833 			tessellation_evaluation ""
    834 				#version 310 es
    835 				${TESSELLATION_EVALUATION_DECLARATIONS}
    836 				in mediump float tc_out[];
    837 				out mediump float te_out;
    838 				void main()
    839 				{
    840 					te_out = tc_out[2];
    841 					${TESSELLATION_EVALUATION_OUTPUT}
    842 				}
    843 			""
    844 			fragment ""
    845 				#version 310 es
    846 				precision mediump float;
    847 				${FRAGMENT_DECLARATIONS}
    848 				in mediump float te_out;
    849 				void main()
    850 				{
    851 					out0 = te_out;
    852 					${FRAGMENT_OUTPUT}
    853 				}
    854 			""
    855 		end
    856 
    857 		case output_non_array
    858 			version 310 es
    859 			desc "Tessellation control output out not an array"
    860 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    861 			expect compile_or_link_fail
    862 			values
    863 			{
    864 				input float in0 = 1.0;
    865 				output float out0 = 1.0;
    866 			}
    867 			vertex ""
    868 				#version 310 es
    869 				${VERTEX_DECLARATIONS}
    870 				out mediump float tc_in;
    871 				void main()
    872 				{
    873 					tc_in = in0;
    874 					${VERTEX_OUTPUT}
    875 				}
    876 			""
    877 			tessellation_control ""
    878 				#version 310 es
    879 				${TESSELLATION_CONTROL_DECLARATIONS}
    880 				in mediump float tc_in[];
    881 				out mediump float tc_out; // not an array
    882 				void main()
    883 				{
    884 					tc_out = tc_in[gl_InvocationID];
    885 					${TESSELLATION_CONTROL_OUTPUT}
    886 				}
    887 			""
    888 			tessellation_evaluation ""
    889 				#version 310 es
    890 				${TESSELLATION_EVALUATION_DECLARATIONS}
    891 				in mediump float tc_out[];
    892 				out mediump float te_out;
    893 				void main()
    894 				{
    895 					te_out = tc_out[2];
    896 					${TESSELLATION_EVALUATION_OUTPUT}
    897 				}
    898 			""
    899 			fragment ""
    900 				#version 310 es
    901 				precision mediump float;
    902 				${FRAGMENT_DECLARATIONS}
    903 				in mediump float te_out;
    904 				void main()
    905 				{
    906 					out0 = te_out;
    907 					${FRAGMENT_OUTPUT}
    908 				}
    909 			""
    910 		end
    911 
    912 		case input_array_size_mismatch
    913 			version 310 es
    914 			desc "Tessellation control input array size is not gl_MaxPatchVertices"
    915 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    916 			expect compile_or_link_fail
    917 			values
    918 			{
    919 				input float in0 = 1.0;
    920 				output float out0 = 1.0;
    921 			}
    922 			vertex ""
    923 				#version 310 es
    924 				${VERTEX_DECLARATIONS}
    925 				out mediump float tc_in;
    926 				void main()
    927 				{
    928 					tc_in = in0;
    929 					${VERTEX_OUTPUT}
    930 				}
    931 			""
    932 			tessellation_control ""
    933 				#version 310 es
    934 				${TESSELLATION_CONTROL_DECLARATIONS}
    935 				in mediump float tc_in[2]; // not gl_MaxPatchVertices
    936 				out mediump float tc_out[];
    937 				void main()
    938 				{
    939 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    940 					${TESSELLATION_CONTROL_OUTPUT}
    941 				}
    942 			""
    943 			tessellation_evaluation ""
    944 				#version 310 es
    945 				${TESSELLATION_EVALUATION_DECLARATIONS}
    946 				in mediump float tc_out[];
    947 				out mediump float te_out;
    948 				void main()
    949 				{
    950 					te_out = tc_out[2];
    951 					${TESSELLATION_EVALUATION_OUTPUT}
    952 				}
    953 			""
    954 			fragment ""
    955 				#version 310 es
    956 				precision mediump float;
    957 				${FRAGMENT_DECLARATIONS}
    958 				in mediump float te_out;
    959 				void main()
    960 				{
    961 					out0 = te_out;
    962 					${FRAGMENT_OUTPUT}
    963 				}
    964 			""
    965 		end
    966 
    967 		case internal_array_size_mismatch
    968 			version 310 es
    969 			desc "Tessellation control output array size is not consistent with layout qualifier"
    970 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
    971 			expect compile_or_link_fail
    972 			values
    973 			{
    974 				input float in0 = 1.0;
    975 				output float out0 = 1.0;
    976 			}
    977 			vertex ""
    978 				#version 310 es
    979 				${VERTEX_DECLARATIONS}
    980 				out mediump float tc_in;
    981 				void main()
    982 				{
    983 					tc_in = in0;
    984 					${VERTEX_OUTPUT}
    985 				}
    986 			""
    987 			tessellation_control ""
    988 				#version 310 es
    989 				${TESSELLATION_CONTROL_DECLARATIONS}
    990 				in mediump float tc_in[];
    991 				out mediump float tc_out[2]; // does not match output layout qualifier
    992 				void main()
    993 				{
    994 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
    995 					${TESSELLATION_CONTROL_OUTPUT}
    996 				}
    997 			""
    998 			tessellation_evaluation ""
    999 				#version 310 es
   1000 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1001 				in mediump float tc_out[2];
   1002 				out mediump float te_out;
   1003 				void main()
   1004 				{
   1005 					te_out = tc_out[1];
   1006 					${TESSELLATION_EVALUATION_OUTPUT}
   1007 				}
   1008 			""
   1009 			fragment ""
   1010 				#version 310 es
   1011 				precision mediump float;
   1012 				${FRAGMENT_DECLARATIONS}
   1013 				in mediump float te_out;
   1014 				void main()
   1015 				{
   1016 					out0 = te_out;
   1017 					${FRAGMENT_OUTPUT}
   1018 				}
   1019 			""
   1020 		end
   1021 
   1022 		case invalid_patch_in_usage
   1023 			version 310 es
   1024 			desc "Invalid use of the patch_in qualifier in a non-tessellation shader"
   1025 			expect compile_or_link_fail
   1026 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1027 			values
   1028 			{
   1029 				input float in0 = 1.0;
   1030 				output float out0 = 1.0;
   1031 			}
   1032 			vertex ""
   1033 				#version 310 es
   1034 				${VERTEX_DECLARATIONS}
   1035 				out mediump float frag_in;
   1036 				out mediump float var;
   1037 				void main()
   1038 				{
   1039 					frag_in = in0;
   1040 					var = 2.0;
   1041 					${VERTEX_OUTPUT}
   1042 				}
   1043 			""
   1044 			fragment ""
   1045 				#version 310 es
   1046 				precision mediump float;
   1047 				${FRAGMENT_DECLARATIONS}
   1048 				patch in mediump float var; // invalid use of patch_in
   1049 				in mediump float frag_in;
   1050 				void main()
   1051 				{
   1052 					out0 = frag_in * var;
   1053 					${FRAGMENT_OUTPUT}
   1054 				}
   1055 			""
   1056 		end
   1057 
   1058 		case invalid_patch_out_usage
   1059 			version 310 es
   1060 			desc "Invalid use of the patch_out qualifier in a non-tessellation shader"
   1061 			expect compile_or_link_fail
   1062 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1063 			values
   1064 			{
   1065 				input float in0 = 1.0;
   1066 				output float out0 = 1.0;
   1067 			}
   1068 			vertex ""
   1069 				#version 310 es
   1070 				${VERTEX_DECLARATIONS}
   1071 				out mediump float frag_in;
   1072 				patch out mediump float var;
   1073 				void main()
   1074 				{
   1075 					frag_in = in0;
   1076 					var = 2.0;
   1077 					${VERTEX_OUTPUT}
   1078 				}
   1079 			""
   1080 			fragment ""
   1081 				#version 310 es
   1082 				precision mediump float;
   1083 				${FRAGMENT_DECLARATIONS}
   1084 				in mediump float var; // invalid use of patch_out
   1085 				in mediump float frag_in;
   1086 				void main()
   1087 				{
   1088 					out0 = frag_in * var;
   1089 					${FRAGMENT_OUTPUT}
   1090 				}
   1091 			""
   1092 		end
   1093 
   1094 		case invalid_per_patch_qualifier_usage
   1095 			version 310 es
   1096 			desc "Invalid use of per-patch qualifier on input variable in tessellation control shader"
   1097 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1098 			expect compile_or_link_fail
   1099 			values
   1100 			{
   1101 				input float in0 = 1.0;
   1102 				output float out0 = 1.0;
   1103 			}
   1104 			vertex ""
   1105 				#version 310 es
   1106 				${VERTEX_DECLARATIONS}
   1107 				out mediump float tc_in;
   1108 				void main()
   1109 				{
   1110 					tc_in = in0;
   1111 					${VERTEX_OUTPUT}
   1112 				}
   1113 			""
   1114 			tessellation_control ""
   1115 				#version 310 es
   1116 				${TESSELLATION_CONTROL_DECLARATIONS}
   1117 				patch in mediump float tc_in; // patch in not allowed in TCS
   1118 				patch out mediump float tc_out;
   1119 				void main()
   1120 				{
   1121 					tc_out = tc_in;
   1122 					${TESSELLATION_CONTROL_OUTPUT}
   1123 				}
   1124 			""
   1125 			tessellation_evaluation ""
   1126 				#version 310 es
   1127 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1128 				patch in mediump float tc_out;
   1129 				out mediump float te_out;
   1130 				void main()
   1131 				{
   1132 					te_out = tc_out;
   1133 					${TESSELLATION_EVALUATION_OUTPUT}
   1134 				}
   1135 			""
   1136 			fragment ""
   1137 				#version 310 es
   1138 				precision mediump float;
   1139 				${FRAGMENT_DECLARATIONS}
   1140 				in mediump float te_out;
   1141 				void main()
   1142 				{
   1143 					out0 = te_out;
   1144 					${FRAGMENT_OUTPUT}
   1145 				}
   1146 			""
   1147 		end
   1148 
   1149 		case per_patch_qualifier_mismatch_1
   1150 			version 310 es
   1151 			desc "Tessellation control output is per-patch qualified, evaluation input is not"
   1152 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1153 			expect compile_or_link_fail
   1154 			values
   1155 			{
   1156 				input float in0 = 1.0;
   1157 				output float out0 = 1.0;
   1158 			}
   1159 			vertex ""
   1160 				#version 310 es
   1161 				${VERTEX_DECLARATIONS}
   1162 				out mediump float tc_in;
   1163 				void main()
   1164 				{
   1165 					tc_in = in0;
   1166 					${VERTEX_OUTPUT}
   1167 				}
   1168 			""
   1169 			tessellation_control ""
   1170 				#version 310 es
   1171 				${TESSELLATION_CONTROL_DECLARATIONS}
   1172 				in mediump float tc_in[];
   1173 				patch out mediump float tc_out[gl_MaxPatchVertices];
   1174 				void main()
   1175 				{
   1176 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   1177 					${TESSELLATION_CONTROL_OUTPUT}
   1178 				}
   1179 			""
   1180 			tessellation_evaluation ""
   1181 				#version 310 es
   1182 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1183 				in mediump float tc_out[gl_MaxPatchVertices];
   1184 				out mediump float te_out;
   1185 				void main()
   1186 				{
   1187 					te_out = tc_out[2];
   1188 					${TESSELLATION_EVALUATION_OUTPUT}
   1189 				}
   1190 			""
   1191 			fragment ""
   1192 				#version 310 es
   1193 				precision mediump float;
   1194 				${FRAGMENT_DECLARATIONS}
   1195 				in mediump float te_out;
   1196 				void main()
   1197 				{
   1198 					out0 = te_out;
   1199 					${FRAGMENT_OUTPUT}
   1200 				}
   1201 			""
   1202 		end
   1203 
   1204 		case per_patch_qualifier_mismatch_2
   1205 			version 310 es
   1206 			desc "Tessellation control output is not per-patch qualified, evaluation input is"
   1207 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1208 			expect compile_or_link_fail
   1209 			values
   1210 			{
   1211 				input float in0 = 1.0;
   1212 				output float out0 = 1.0;
   1213 			}
   1214 			vertex ""
   1215 				#version 310 es
   1216 				${VERTEX_DECLARATIONS}
   1217 				out mediump float tc_in;
   1218 				void main()
   1219 				{
   1220 					tc_in = in0;
   1221 					${VERTEX_OUTPUT}
   1222 				}
   1223 			""
   1224 			tessellation_control ""
   1225 				#version 310 es
   1226 				${TESSELLATION_CONTROL_DECLARATIONS}
   1227 				in mediump float tc_in[];
   1228 				out mediump float tc_out[gl_MaxPatchVertices];
   1229 				void main()
   1230 				{
   1231 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   1232 					${TESSELLATION_CONTROL_OUTPUT}
   1233 				}
   1234 			""
   1235 			tessellation_evaluation ""
   1236 				#version 310 es
   1237 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1238 				patch in mediump float tc_out[gl_MaxPatchVertices];
   1239 				out mediump float te_out;
   1240 				void main()
   1241 				{
   1242 					te_out = tc_out[2];
   1243 					${TESSELLATION_EVALUATION_OUTPUT}
   1244 				}
   1245 			""
   1246 			fragment ""
   1247 				#version 310 es
   1248 				precision mediump float;
   1249 				${FRAGMENT_DECLARATIONS}
   1250 				in mediump float te_out;
   1251 				void main()
   1252 				{
   1253 					out0 = te_out;
   1254 					${FRAGMENT_OUTPUT}
   1255 				}
   1256 			""
   1257 		end
   1258 
   1259 		case input_block
   1260 			version 310 es
   1261 			desc "Tessellation control shader input block"
   1262 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1263 			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
   1264 			values { output float out0 = 1.0; }
   1265 			vertex ""
   1266 				#version 310 es
   1267 				${VERTEX_DECLARATIONS}
   1268 				out IOBlockName
   1269 				{
   1270 					mediump float var;
   1271 				} outputInstanceName;
   1272 				void main()
   1273 				{
   1274 					outputInstanceName.var = 1.0;
   1275 					${VERTEX_OUTPUT}
   1276 				}
   1277 			""
   1278 			tessellation_control ""
   1279 				#version 310 es
   1280 				${TESSELLATION_CONTROL_DECLARATIONS}
   1281 				in IOBlockName
   1282 				{
   1283 					mediump float var;
   1284 				} inputInstanceName[];
   1285 				out mediump float tc_out[];
   1286 				void main()
   1287 				{
   1288 					tc_out[gl_InvocationID] = inputInstanceName[gl_InvocationID].var;
   1289 					${TESSELLATION_CONTROL_OUTPUT}
   1290 				}
   1291 			""
   1292 			tessellation_evaluation ""
   1293 				#version 310 es
   1294 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1295 				in mediump float tc_out[];
   1296 				out mediump float te_out;
   1297 				void main()
   1298 				{
   1299 					te_out = tc_out[2];
   1300 					${TESSELLATION_EVALUATION_OUTPUT}
   1301 				}
   1302 			""
   1303 			fragment ""
   1304 				#version 310 es
   1305 				precision mediump float;
   1306 				${FRAGMENT_DECLARATIONS}
   1307 				in mediump float te_out;
   1308 				void main()
   1309 				{
   1310 					out0 = te_out;
   1311 					${FRAGMENT_OUTPUT}
   1312 				}
   1313 			""
   1314 		end
   1315 
   1316 		case input_block_non_array
   1317 			version 310 es
   1318 			desc "Tessellation control shader input block without explicit array"
   1319 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1320 			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
   1321 			expect compile_or_link_fail
   1322 			values { output float out0 = 1.0; }
   1323 			vertex ""
   1324 				#version 310 es
   1325 				${VERTEX_DECLARATIONS}
   1326 				out IOBlockName
   1327 				{
   1328 					mediump float var;
   1329 				} outputInstanceName;
   1330 				void main()
   1331 				{
   1332 					outputInstanceName.var = 1.0;
   1333 					${VERTEX_OUTPUT}
   1334 				}
   1335 			""
   1336 			tessellation_control ""
   1337 				#version 310 es
   1338 				${TESSELLATION_CONTROL_DECLARATIONS}
   1339 				in IOBlockName
   1340 				{
   1341 					mediump float var;
   1342 				} inputInstanceName;
   1343 				out mediump float tc_out[];
   1344 				void main()
   1345 				{
   1346 					tc_out[gl_InvocationID] = inputInstanceName.var;
   1347 					${TESSELLATION_CONTROL_OUTPUT}
   1348 				}
   1349 			""
   1350 			tessellation_evaluation ""
   1351 				#version 310 es
   1352 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1353 				in mediump float tc_out[];
   1354 				out mediump float te_out;
   1355 				void main()
   1356 				{
   1357 					te_out = tc_out[2];
   1358 					${TESSELLATION_EVALUATION_OUTPUT}
   1359 				}
   1360 			""
   1361 			fragment ""
   1362 				#version 310 es
   1363 				precision mediump float;
   1364 				${FRAGMENT_DECLARATIONS}
   1365 				in mediump float geo_out;
   1366 				void main()
   1367 				{
   1368 					out0 = geo_out;
   1369 					${FRAGMENT_OUTPUT}
   1370 				}
   1371 			""
   1372 		end
   1373 
   1374 		case output_block_non_array
   1375 			version 310 es
   1376 			desc "Tessellation control shader output block without explicit array"
   1377 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1378 			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
   1379 			expect compile_or_link_fail
   1380 			values { output float out0 = 1.0; }
   1381 			vertex ""
   1382 				#version 310 es
   1383 				${VERTEX_DECLARATIONS}
   1384 				out mediump float tc_in;
   1385 				void main()
   1386 				{
   1387 					tc_in = 1.0;
   1388 					${VERTEX_OUTPUT}
   1389 				}
   1390 			""
   1391 			tessellation_control ""
   1392 				#version 310 es
   1393 				${TESSELLATION_CONTROL_DECLARATIONS}
   1394 				in mediump float tc_in[];
   1395 				out IOBlockName
   1396 				{
   1397 					mediump float var;
   1398 				} outputInstanceName; // not an array
   1399 				void main()
   1400 				{
   1401 					outputInstanceName.var = tc_in[gl_InvocationID];
   1402 					${TESSELLATION_CONTROL_OUTPUT}
   1403 				}
   1404 			""
   1405 			tessellation_evaluation ""
   1406 				#version 310 es
   1407 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1408 				in IOBlockName
   1409 				{
   1410 					mediump float var;
   1411 				} outputInstanceName[];
   1412 				out mediump float te_out;
   1413 				void main()
   1414 				{
   1415 					te_out = outputInstanceName[2].var;
   1416 					${TESSELLATION_EVALUATION_OUTPUT}
   1417 				}
   1418 			""
   1419 			fragment ""
   1420 				#version 310 es
   1421 				precision mediump float;
   1422 				${FRAGMENT_DECLARATIONS}
   1423 				in mediump float te_out;
   1424 				void main()
   1425 				{
   1426 					out0 = te_out;
   1427 					${FRAGMENT_OUTPUT}
   1428 				}
   1429 			""
   1430 		end
   1431 
   1432 		case input_block_array_size_mismatch
   1433 			version 310 es
   1434 			desc "Tessellation control shader input block array, size not gl_MaxPatchVertices"
   1435 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1436 			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
   1437 			expect compile_or_link_fail
   1438 			values { output float out0 = 1.0; }
   1439 			vertex ""
   1440 				#version 310 es
   1441 				${VERTEX_DECLARATIONS}
   1442 				out IOBlockName
   1443 				{
   1444 					mediump float var;
   1445 				} outputInstanceName;
   1446 				void main()
   1447 				{
   1448 					outputInstanceName.var = 1.0;
   1449 					${VERTEX_OUTPUT}
   1450 				}
   1451 			""
   1452 			tessellation_control ""
   1453 				#version 310 es
   1454 				${TESSELLATION_CONTROL_DECLARATIONS}
   1455 				in IOBlockName
   1456 				{
   1457 					mediump float var;
   1458 				} inputInstanceName[4]; // not gl_MaxPatchVertices
   1459 				out mediump float tc_out[];
   1460 				void main()
   1461 				{
   1462 					tc_out[gl_InvocationID] = inputInstanceName[gl_InvocationID + 1].var;
   1463 					${TESSELLATION_CONTROL_OUTPUT}
   1464 				}
   1465 			""
   1466 			tessellation_evaluation ""
   1467 				#version 310 es
   1468 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1469 				in mediump float tc_out[];
   1470 				out mediump float te_out;
   1471 				void main()
   1472 				{
   1473 					te_out = tc_out[2];
   1474 					${TESSELLATION_EVALUATION_OUTPUT}
   1475 				}
   1476 			""
   1477 			fragment ""
   1478 				#version 310 es
   1479 				precision mediump float;
   1480 				${FRAGMENT_DECLARATIONS}
   1481 				in mediump float geo_out;
   1482 				void main()
   1483 				{
   1484 					out0 = geo_out;
   1485 					${FRAGMENT_OUTPUT}
   1486 				}
   1487 			""
   1488 		end
   1489 
   1490 		case output_block
   1491 			version 310 es
   1492 			desc "Tessellation shader output block"
   1493 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1494 			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
   1495 			values { output float out0 = 1.0; }
   1496 			vertex ""
   1497 				#version 310 es
   1498 				${VERTEX_DECLARATIONS}
   1499 				void main()
   1500 				{
   1501 					${VERTEX_OUTPUT}
   1502 				}
   1503 			""
   1504 			tessellation_control ""
   1505 				#version 310 es
   1506 				${TESSELLATION_CONTROL_DECLARATIONS}
   1507 				void main()
   1508 				{
   1509 					${TESSELLATION_CONTROL_OUTPUT}
   1510 				}
   1511 			""
   1512 			tessellation_evaluation ""
   1513 				#version 310 es
   1514 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1515 				out IOBlockName
   1516 				{
   1517 					mediump float var;
   1518 				} outputInstanceName;
   1519 				void main()
   1520 				{
   1521 					outputInstanceName.var = 1.0;
   1522 					${TESSELLATION_EVALUATION_OUTPUT}
   1523 				}
   1524 			""
   1525 			fragment ""
   1526 				#version 310 es
   1527 				precision mediump float;
   1528 				${FRAGMENT_DECLARATIONS}
   1529 				in IOBlockName
   1530 				{
   1531 					mediump float var;
   1532 				} inputInstanceName;
   1533 				void main()
   1534 				{
   1535 					out0 = inputInstanceName.var;
   1536 					${FRAGMENT_OUTPUT}
   1537 				}
   1538 			""
   1539 		end
   1540 
   1541 		case output_block_array
   1542 			version 310 es
   1543 			desc "Tessellation shader output block array"
   1544 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1545 			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
   1546 			values { output float out0 = 1.0; }
   1547 			vertex ""
   1548 				#version 310 es
   1549 				${VERTEX_DECLARATIONS}
   1550 				void main()
   1551 				{
   1552 					${VERTEX_OUTPUT}
   1553 				}
   1554 			""
   1555 			tessellation_control ""
   1556 				#version 310 es
   1557 				${TESSELLATION_CONTROL_DECLARATIONS}
   1558 				void main()
   1559 				{
   1560 					${TESSELLATION_CONTROL_OUTPUT}
   1561 				}
   1562 			""
   1563 			tessellation_evaluation ""
   1564 				#version 310 es
   1565 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1566 				out IOBlockName
   1567 				{
   1568 					mediump float var;
   1569 				} outputInstanceName[2];
   1570 				void main()
   1571 				{
   1572 					outputInstanceName[0].var = 2.0;
   1573 					outputInstanceName[1].var = 1.0;
   1574 					${TESSELLATION_EVALUATION_OUTPUT}
   1575 				}
   1576 			""
   1577 			fragment ""
   1578 				#version 310 es
   1579 				precision mediump float;
   1580 				${FRAGMENT_DECLARATIONS}
   1581 				in IOBlockName
   1582 				{
   1583 					mediump float var;
   1584 				} inputInstanceName[2];
   1585 				void main()
   1586 				{
   1587 					out0 = inputInstanceName[0].var - inputInstanceName[1].var;
   1588 					${FRAGMENT_OUTPUT}
   1589 				}
   1590 			""
   1591 		end
   1592 
   1593 		case unspecified_vertex_count
   1594 			version 310 es
   1595 			desc "Tessellation shader unspecified vertex count"
   1596 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1597 			expect compile_or_link_fail
   1598 			vertex ""
   1599 				#version 310 es
   1600 				${VERTEX_DECLARATIONS}
   1601 				void main()
   1602 				{
   1603 					${VERTEX_OUTPUT}
   1604 				}
   1605 			""
   1606 			tessellation_control ""
   1607 				#version 310 es
   1608 				void main()
   1609 				{
   1610 					${TESSELLATION_CONTROL_OUTPUT}
   1611 				}
   1612 			""
   1613 			tessellation_evaluation ""
   1614 				#version 310 es
   1615 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1616 				void main()
   1617 				{
   1618 					${TESSELLATION_EVALUATION_OUTPUT}
   1619 				}
   1620 			""
   1621 			fragment ""
   1622 				#version 310 es
   1623 				precision mediump float;
   1624 				${FRAGMENT_DECLARATIONS}
   1625 				void main()
   1626 				{
   1627 					${FRAGMENT_OUTPUT}
   1628 				}
   1629 			""
   1630 		end
   1631 
   1632 		case unspecified_primitive_mode
   1633 			version 310 es
   1634 			desc "Tessellation shader unspecified vertex count"
   1635 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1636 			expect compile_or_link_fail
   1637 			vertex ""
   1638 				#version 310 es
   1639 				${VERTEX_DECLARATIONS}
   1640 				void main()
   1641 				{
   1642 					${VERTEX_OUTPUT}
   1643 				}
   1644 			""
   1645 			tessellation_control ""
   1646 				#version 310 es
   1647 				${TESSELLATION_CONTROL_DECLARATIONS}
   1648 				void main()
   1649 				{
   1650 					${TESSELLATION_CONTROL_OUTPUT}
   1651 				}
   1652 			""
   1653 			tessellation_evaluation ""
   1654 				#version 310 es
   1655 				void main()
   1656 				{
   1657 					${TESSELLATION_EVALUATION_OUTPUT}
   1658 				}
   1659 			""
   1660 			fragment ""
   1661 				#version 310 es
   1662 				precision mediump float;
   1663 				${FRAGMENT_DECLARATIONS}
   1664 				void main()
   1665 				{
   1666 					${FRAGMENT_OUTPUT}
   1667 				}
   1668 			""
   1669 		end
   1670 	end
   1671 
   1672 	group qualifiers "Varying qualifiers"
   1673 		case smooth
   1674 			version 310 es
   1675 			desc "Smooth varying"
   1676 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1677 			values
   1678 			{
   1679 				input float in0 = 1.0;
   1680 				output float out0 = 1.0;
   1681 			}
   1682 			vertex ""
   1683 				#version 310 es
   1684 				${VERTEX_DECLARATIONS}
   1685 				smooth out mediump float tc_in;
   1686 				void main()
   1687 				{
   1688 					tc_in = in0;
   1689 					${VERTEX_OUTPUT}
   1690 				}
   1691 			""
   1692 			tessellation_control ""
   1693 				#version 310 es
   1694 				${TESSELLATION_CONTROL_DECLARATIONS}
   1695 				smooth in mediump float tc_in[];
   1696 				smooth out mediump float tc_out[];
   1697 				void main()
   1698 				{
   1699 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   1700 					${TESSELLATION_CONTROL_OUTPUT}
   1701 				}
   1702 			""
   1703 			tessellation_evaluation ""
   1704 				#version 310 es
   1705 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1706 				smooth in mediump float tc_out[];
   1707 				smooth out mediump float te_out;
   1708 				void main()
   1709 				{
   1710 					te_out = tc_out[2];
   1711 					${TESSELLATION_EVALUATION_OUTPUT}
   1712 				}
   1713 			""
   1714 			fragment ""
   1715 				#version 310 es
   1716 				precision mediump float;
   1717 				${FRAGMENT_DECLARATIONS}
   1718 				smooth in mediump float te_out;
   1719 				void main()
   1720 				{
   1721 					out0 = te_out;
   1722 					${FRAGMENT_OUTPUT}
   1723 				}
   1724 			""
   1725 		end
   1726 
   1727 		case flat
   1728 			version 310 es
   1729 			desc "Flat varying"
   1730 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1731 			values
   1732 			{
   1733 				input float in0 = 1.0;
   1734 				output float out0 = 1.0;
   1735 			}
   1736 			vertex ""
   1737 				#version 310 es
   1738 				${VERTEX_DECLARATIONS}
   1739 				flat out mediump float tc_in;
   1740 				void main()
   1741 				{
   1742 					tc_in = in0;
   1743 					${VERTEX_OUTPUT}
   1744 				}
   1745 			""
   1746 			tessellation_control ""
   1747 				#version 310 es
   1748 				${TESSELLATION_CONTROL_DECLARATIONS}
   1749 				flat in mediump float tc_in[];
   1750 				flat out mediump float tc_out[];
   1751 				void main()
   1752 				{
   1753 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   1754 					${TESSELLATION_CONTROL_OUTPUT}
   1755 				}
   1756 			""
   1757 			tessellation_evaluation ""
   1758 				#version 310 es
   1759 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1760 				flat in mediump float tc_out[];
   1761 				flat out mediump float te_out;
   1762 				void main()
   1763 				{
   1764 					te_out = tc_out[2];
   1765 					${TESSELLATION_EVALUATION_OUTPUT}
   1766 				}
   1767 			""
   1768 			fragment ""
   1769 				#version 310 es
   1770 				precision mediump float;
   1771 				${FRAGMENT_DECLARATIONS}
   1772 				flat in mediump float te_out;
   1773 				void main()
   1774 				{
   1775 					out0 = te_out;
   1776 					${FRAGMENT_OUTPUT}
   1777 				}
   1778 			""
   1779 		end
   1780 
   1781 		case centroid
   1782 			version 310 es
   1783 			desc "Centroid varying"
   1784 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1785 			values
   1786 			{
   1787 				input float in0 = 1.0;
   1788 				output float out0 = 1.0;
   1789 			}
   1790 			vertex ""
   1791 				#version 310 es
   1792 				${VERTEX_DECLARATIONS}
   1793 				centroid out mediump float tc_in;
   1794 				void main()
   1795 				{
   1796 					tc_in = in0;
   1797 					${VERTEX_OUTPUT}
   1798 				}
   1799 			""
   1800 			tessellation_control ""
   1801 				#version 310 es
   1802 				${TESSELLATION_CONTROL_DECLARATIONS}
   1803 				centroid in mediump float tc_in[];
   1804 				centroid out mediump float tc_out[];
   1805 				void main()
   1806 				{
   1807 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   1808 					${TESSELLATION_CONTROL_OUTPUT}
   1809 				}
   1810 			""
   1811 			tessellation_evaluation ""
   1812 				#version 310 es
   1813 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1814 				centroid in mediump float tc_out[];
   1815 				centroid out mediump float te_out;
   1816 				void main()
   1817 				{
   1818 					te_out = tc_out[2];
   1819 					${TESSELLATION_EVALUATION_OUTPUT}
   1820 				}
   1821 			""
   1822 			fragment ""
   1823 				#version 310 es
   1824 				precision mediump float;
   1825 				${FRAGMENT_DECLARATIONS}
   1826 				centroid in mediump float te_out;
   1827 				void main()
   1828 				{
   1829 					out0 = te_out;
   1830 					${FRAGMENT_OUTPUT}
   1831 				}
   1832 			""
   1833 		end
   1834 
   1835 		case sample
   1836 			version 310 es
   1837 			desc "Sample varying"
   1838 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1839 			require extension { "GL_OES_shader_multisample_interpolation" }
   1840 			values
   1841 			{
   1842 				input float in0 = 1.0;
   1843 				output float out0 = 1.0;
   1844 			}
   1845 			vertex ""
   1846 				#version 310 es
   1847 				${VERTEX_DECLARATIONS}
   1848 				sample out mediump float tc_in;
   1849 				void main()
   1850 				{
   1851 					tc_in = in0;
   1852 					${VERTEX_OUTPUT}
   1853 				}
   1854 			""
   1855 			tessellation_control ""
   1856 				#version 310 es
   1857 				${TESSELLATION_CONTROL_DECLARATIONS}
   1858 				sample in mediump float tc_in[];
   1859 				sample out mediump float tc_out[];
   1860 				void main()
   1861 				{
   1862 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   1863 					${TESSELLATION_CONTROL_OUTPUT}
   1864 				}
   1865 			""
   1866 			tessellation_evaluation ""
   1867 				#version 310 es
   1868 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1869 				sample in mediump float tc_out[];
   1870 				sample out mediump float te_out;
   1871 				void main()
   1872 				{
   1873 					te_out = tc_out[2];
   1874 					${TESSELLATION_EVALUATION_OUTPUT}
   1875 				}
   1876 			""
   1877 			fragment ""
   1878 				#version 310 es
   1879 				precision mediump float;
   1880 				${FRAGMENT_DECLARATIONS}
   1881 				sample in mediump float te_out;
   1882 				void main()
   1883 				{
   1884 					out0 = te_out;
   1885 					${FRAGMENT_OUTPUT}
   1886 				}
   1887 			""
   1888 		end
   1889 
   1890 		case patch
   1891 			version 310 es
   1892 			desc "Pre-patch varying"
   1893 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1894 			values
   1895 			{
   1896 				input float in0 = 1.0;
   1897 				output float out0 = 1.0;
   1898 			}
   1899 			vertex ""
   1900 				#version 310 es
   1901 				${VERTEX_DECLARATIONS}
   1902 				out mediump float tc_in;
   1903 				void main()
   1904 				{
   1905 					tc_in = in0;
   1906 					${VERTEX_OUTPUT}
   1907 				}
   1908 			""
   1909 			tessellation_control ""
   1910 				#version 310 es
   1911 				${TESSELLATION_CONTROL_DECLARATIONS}
   1912 				in mediump float tc_in[];
   1913 				patch out mediump float tc_out;
   1914 				void main()
   1915 				{
   1916 					tc_out = tc_in[gl_InvocationID];
   1917 					${TESSELLATION_CONTROL_OUTPUT}
   1918 				}
   1919 			""
   1920 			tessellation_evaluation ""
   1921 				#version 310 es
   1922 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1923 				patch in mediump float tc_out;
   1924 				out mediump float te_out;
   1925 				void main()
   1926 				{
   1927 					te_out = tc_out;
   1928 					${TESSELLATION_EVALUATION_OUTPUT}
   1929 				}
   1930 			""
   1931 			fragment ""
   1932 				#version 310 es
   1933 				precision mediump float;
   1934 				${FRAGMENT_DECLARATIONS}
   1935 				in mediump float te_out;
   1936 				void main()
   1937 				{
   1938 					out0 = te_out;
   1939 					${FRAGMENT_OUTPUT}
   1940 				}
   1941 			""
   1942 		end
   1943 	end
   1944 
   1945 	import "linkage_tessellation_varying_types.test"
   1946 end
   1947 
   1948 group uniform "Uniform"
   1949 	group rules "Rules"
   1950 		case type_mismatch_1
   1951 			version 310 es
   1952 			desc "uniform type mismatch between vertex and tessellation control shaders"
   1953 			expect link_fail
   1954 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   1955 			vertex ""
   1956 				#version 310 es
   1957 				${VERTEX_DECLARATIONS}
   1958 				uniform mediump float val;
   1959 				out mediump float vtx_out;
   1960 				void main()
   1961 				{
   1962 					vtx_out = val;
   1963 					${VERTEX_OUTPUT}
   1964 				}
   1965 			""
   1966 			tessellation_control ""
   1967 				#version 310 es
   1968 				${TESSELLATION_CONTROL_DECLARATIONS}
   1969 				uniform mediump vec2 val;
   1970 				in mediump float vtx_out[];
   1971 				out mediump float tc_out[];
   1972 				void main()
   1973 				{
   1974 					tc_out[gl_InvocationID] = vtx_out[0] + val.x + val.y;
   1975 					${TESSELLATION_CONTROL_OUTPUT}
   1976 				}
   1977 			""
   1978 			tessellation_evaluation ""
   1979 				#version 310 es
   1980 				${TESSELLATION_EVALUATION_DECLARATIONS}
   1981 				in mediump float tc_out[];
   1982 				out mediump float te_out;
   1983 				void main()
   1984 				{
   1985 					te_out = tc_out[2];
   1986 					${TESSELLATION_EVALUATION_OUTPUT}
   1987 				}
   1988 			""
   1989 			fragment ""
   1990 				#version 310 es
   1991 				precision mediump float;
   1992 				${FRAGMENT_DECLARATIONS}
   1993 				in mediump float te_out;
   1994 				void main()
   1995 				{
   1996 					${FRAG_COLOR} = vec4(te_out);
   1997 				}
   1998 			""
   1999 		end
   2000 
   2001 		case type_mismatch_2
   2002 			version 310 es
   2003 			desc "uniform type mismatch between fragment and tessellation eval shaders"
   2004 			expect link_fail
   2005 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2006 			vertex ""
   2007 				#version 310 es
   2008 				${VERTEX_DECLARATIONS}
   2009 				out mediump float vtx_out;
   2010 				void main()
   2011 				{
   2012 					${VERTEX_OUTPUT}
   2013 				}
   2014 			""
   2015 			tessellation_control ""
   2016 				#version 310 es
   2017 				${TESSELLATION_CONTROL_DECLARATIONS}
   2018 				void main()
   2019 				{
   2020 					${TESSELLATION_CONTROL_OUTPUT}
   2021 				}
   2022 			""
   2023 			tessellation_evaluation ""
   2024 				#version 310 es
   2025 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2026 				uniform mediump vec3 val;
   2027 				out mediump float te_out;
   2028 				void main()
   2029 				{
   2030 					te_out = val.x + val.y + val.z;
   2031 					${TESSELLATION_EVALUATION_OUTPUT}
   2032 				}
   2033 			""
   2034 			fragment ""
   2035 				#version 310 es
   2036 				precision mediump float;
   2037 				${FRAGMENT_DECLARATIONS}
   2038 				uniform mediump vec4 val;
   2039 				in mediump float te_out;
   2040 				void main()
   2041 				{
   2042 					${FRAG_COLOR} = vec4(te_out) + val;
   2043 				}
   2044 			""
   2045 		end
   2046 
   2047 		case type_mismatch_3
   2048 			version 310 es
   2049 			desc "uniform type mismatch between tessellation control and eval shaders"
   2050 			expect link_fail
   2051 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2052 			vertex ""
   2053 				#version 310 es
   2054 				${VERTEX_DECLARATIONS}
   2055 				out mediump float vtx_out;
   2056 				void main()
   2057 				{
   2058 					${VERTEX_OUTPUT}
   2059 				}
   2060 			""
   2061 			tessellation_control ""
   2062 				#version 310 es
   2063 				${TESSELLATION_CONTROL_DECLARATIONS}
   2064 				uniform mediump vec4 val;
   2065 				out mediump vec4 tc_out[];
   2066 				void main()
   2067 				{
   2068 					tc_out[gl_InvocationID] = val;
   2069 					${TESSELLATION_CONTROL_OUTPUT}
   2070 				}
   2071 			""
   2072 			tessellation_evaluation ""
   2073 				#version 310 es
   2074 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2075 				uniform mediump vec3 val;
   2076 				in mediump vec4 tc_out[];
   2077 				out mediump float te_out;
   2078 				void main()
   2079 				{
   2080 					te_out = tc_out[0].w * val.z;
   2081 					${TESSELLATION_EVALUATION_OUTPUT}
   2082 				}
   2083 			""
   2084 			fragment ""
   2085 				#version 310 es
   2086 				precision mediump float;
   2087 				${FRAGMENT_DECLARATIONS}
   2088 				in mediump float te_out;
   2089 				void main()
   2090 				{
   2091 					${FRAG_COLOR} = vec4(te_out);
   2092 				}
   2093 			""
   2094 		end
   2095 
   2096 		case type_mismatch_4
   2097 			version 310 es
   2098 			desc "uniform type mismatch between vertex and tessellation control shaders"
   2099 			expect link_fail
   2100 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2101 			require limit "GL_MAX_VERTEX_ATOMIC_COUNTERS" > 0
   2102 			vertex ""
   2103 				#version 310 es
   2104 				${VERTEX_DECLARATIONS}
   2105 				layout(binding=0) uniform atomic_uint u_var;
   2106 				out mediump float vtx_out;
   2107 				void main()
   2108 				{
   2109 					uint result = atomicCounterIncrement(u_var);
   2110 					vtx_out = float(result);
   2111 					${VERTEX_OUTPUT}
   2112 				}
   2113 			""
   2114 			tessellation_control ""
   2115 				#version 310 es
   2116 				${TESSELLATION_CONTROL_DECLARATIONS}
   2117 				uniform mediump float u_var;
   2118 				in mediump float vtx_out[];
   2119 				out mediump float tc_out[];
   2120 				void main()
   2121 				{
   2122 					tc_out[gl_InvocationID] = vtx_out[0] + u_var;
   2123 					${TESSELLATION_CONTROL_OUTPUT}
   2124 				}
   2125 			""
   2126 			tessellation_evaluation ""
   2127 				#version 310 es
   2128 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2129 				in mediump float tc_out[];
   2130 				out mediump float te_out;
   2131 				void main()
   2132 				{
   2133 					te_out = tc_out[2];
   2134 					${TESSELLATION_EVALUATION_OUTPUT}
   2135 				}
   2136 			""
   2137 			fragment ""
   2138 				#version 310 es
   2139 				precision mediump float;
   2140 				${FRAGMENT_DECLARATIONS}
   2141 				in mediump float te_out;
   2142 				void main()
   2143 				{
   2144 					${FRAG_COLOR} = vec4(te_out);
   2145 				}
   2146 			""
   2147 		end
   2148 
   2149 		case type_mismatch_5
   2150 			version 310 es
   2151 			desc "uniform type mismatch between vertex and tessellation control shaders"
   2152 			expect link_fail
   2153 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2154 			require limit "GL_MAX_VERTEX_IMAGE_UNIFORMS" > 0
   2155 			vertex ""
   2156 				#version 310 es
   2157 				${VERTEX_DECLARATIONS}
   2158 				layout(binding=0) layout(rgba8i) uniform readonly highp iimage2D u_var;
   2159 				out mediump float vtx_out;
   2160 				void main()
   2161 				{
   2162 					int result = imageSize(u_var).x;
   2163 					vtx_out = float(result);
   2164 					${VERTEX_OUTPUT}
   2165 				}
   2166 			""
   2167 			tessellation_control ""
   2168 				#version 310 es
   2169 				${TESSELLATION_CONTROL_DECLARATIONS}
   2170 				uniform mediump float u_var;
   2171 				in mediump float vtx_out[];
   2172 				out mediump float tc_out[];
   2173 				void main()
   2174 				{
   2175 					tc_out[gl_InvocationID] = vtx_out[0] + u_var;
   2176 					${TESSELLATION_CONTROL_OUTPUT}
   2177 				}
   2178 			""
   2179 			tessellation_evaluation ""
   2180 				#version 310 es
   2181 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2182 				in mediump float tc_out[];
   2183 				out mediump float te_out;
   2184 				void main()
   2185 				{
   2186 					te_out = tc_out[2];
   2187 					${TESSELLATION_EVALUATION_OUTPUT}
   2188 				}
   2189 			""
   2190 			fragment ""
   2191 				#version 310 es
   2192 				precision mediump float;
   2193 				${FRAGMENT_DECLARATIONS}
   2194 				in mediump float te_out;
   2195 				void main()
   2196 				{
   2197 					${FRAG_COLOR} = vec4(te_out);
   2198 				}
   2199 			""
   2200 		end
   2201 
   2202 		case precision_mismatch_1
   2203 			version 310 es
   2204 			desc "uniform precision mismatch between tessellation control and eval shaders"
   2205 			expect link_fail
   2206 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2207 			vertex ""
   2208 				#version 310 es
   2209 				${VERTEX_DECLARATIONS}
   2210 				out mediump float vtx_out;
   2211 				void main()
   2212 				{
   2213 					${VERTEX_OUTPUT}
   2214 				}
   2215 			""
   2216 			tessellation_control ""
   2217 				#version 310 es
   2218 				${TESSELLATION_CONTROL_DECLARATIONS}
   2219 				uniform mediump vec4 val;
   2220 				out mediump vec4 tc_out[];
   2221 				void main()
   2222 				{
   2223 					tc_out[gl_InvocationID] = val;
   2224 					${TESSELLATION_CONTROL_OUTPUT}
   2225 				}
   2226 			""
   2227 			tessellation_evaluation ""
   2228 				#version 310 es
   2229 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2230 				uniform highp vec4 val;
   2231 				in mediump vec4 tc_out[];
   2232 				out mediump float te_out;
   2233 				void main()
   2234 				{
   2235 					te_out = tc_out[0].w * val.z;
   2236 					${TESSELLATION_EVALUATION_OUTPUT}
   2237 				}
   2238 			""
   2239 			fragment ""
   2240 				#version 310 es
   2241 				precision mediump float;
   2242 				${FRAGMENT_DECLARATIONS}
   2243 				in mediump float te_out;
   2244 				void main()
   2245 				{
   2246 					${FRAG_COLOR} = vec4(te_out);
   2247 				}
   2248 			""
   2249 		end
   2250 
   2251 		case precision_mismatch_2
   2252 			version 310 es
   2253 			desc "uniform precision mismatch between vertex and tessellation control shaders"
   2254 			expect link_fail
   2255 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2256 			vertex ""
   2257 				#version 310 es
   2258 				${VERTEX_DECLARATIONS}
   2259 				uniform highp float val;
   2260 				out mediump float vtx_out;
   2261 				void main()
   2262 				{
   2263 					vtx_out = val;
   2264 					${VERTEX_OUTPUT}
   2265 				}
   2266 			""
   2267 			tessellation_control ""
   2268 				#version 310 es
   2269 				${TESSELLATION_CONTROL_DECLARATIONS}
   2270 				uniform mediump float val;
   2271 				in mediump float vtx_out[];
   2272 				out mediump float tc_out[];
   2273 				void main()
   2274 				{
   2275 					tc_out[gl_InvocationID] = vtx_out[0] + val;
   2276 					${TESSELLATION_CONTROL_OUTPUT}
   2277 				}
   2278 			""
   2279 			tessellation_evaluation ""
   2280 				#version 310 es
   2281 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2282 				in mediump float tc_out[];
   2283 				out mediump float te_out;
   2284 				void main()
   2285 				{
   2286 					te_out = tc_out[2];
   2287 					${TESSELLATION_EVALUATION_OUTPUT}
   2288 				}
   2289 			""
   2290 			fragment ""
   2291 				#version 310 es
   2292 				precision mediump float;
   2293 				${FRAGMENT_DECLARATIONS}
   2294 				in mediump float te_out;
   2295 				void main()
   2296 				{
   2297 					${FRAG_COLOR} = vec4(te_out);
   2298 				}
   2299 			""
   2300 		end
   2301 
   2302 		case struct_partial_usage
   2303 			version 310 es
   2304 			desc "uniform is partially used in different shader stages"
   2305 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2306 			values
   2307 			{
   2308 				uniform float val.vtxVal	= 1.5;
   2309 				uniform float val.tcVal		= 2.5;
   2310 				uniform float val.teVal		= 6.0;
   2311 				uniform float val.fragVal	= 11.0;
   2312 				output float out0			= 68.5;
   2313 			}
   2314 			vertex ""
   2315 				#version 310 es
   2316 				${VERTEX_DECLARATIONS}
   2317 				struct S
   2318 				{
   2319 					mediump float vtxVal;
   2320 					mediump float tcVal;
   2321 					mediump float teVal;
   2322 					mediump float fragVal;
   2323 				};
   2324 				uniform S val;
   2325 				out mediump float vtx_out;
   2326 				void main()
   2327 				{
   2328 					vtx_out = val.vtxVal;
   2329 					${VERTEX_OUTPUT}
   2330 				}
   2331 			""
   2332 			tessellation_control ""
   2333 				#version 310 es
   2334 				${TESSELLATION_CONTROL_DECLARATIONS}
   2335 				struct S
   2336 				{
   2337 					mediump float vtxVal;
   2338 					mediump float tcVal;
   2339 					mediump float teVal;
   2340 					mediump float fragVal;
   2341 				};
   2342 				uniform S val;
   2343 				in mediump float vtx_out[];
   2344 				out mediump float tc_out[];
   2345 				void main()
   2346 				{
   2347 					tc_out[gl_InvocationID] = vtx_out[0] + 2.0 * val.tcVal;
   2348 					${TESSELLATION_CONTROL_OUTPUT}
   2349 				}
   2350 			""
   2351 			tessellation_evaluation ""
   2352 				#version 310 es
   2353 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2354 				struct S
   2355 				{
   2356 					mediump float vtxVal;
   2357 					mediump float tcVal;
   2358 					mediump float teVal;
   2359 					mediump float fragVal;
   2360 				};
   2361 				uniform S val;
   2362 				in mediump float tc_out[];
   2363 				out mediump float te_out;
   2364 				void main()
   2365 				{
   2366 					te_out = tc_out[2] + 3.0 * val.teVal;
   2367 					${TESSELLATION_EVALUATION_OUTPUT}
   2368 				}
   2369 			""
   2370 			fragment ""
   2371 				#version 310 es
   2372 				precision mediump float;
   2373 				${FRAGMENT_DECLARATIONS}
   2374 				struct S
   2375 				{
   2376 					mediump float vtxVal;
   2377 					mediump float tcVal;
   2378 					mediump float teVal;
   2379 					mediump float fragVal;
   2380 				};
   2381 				uniform S val;
   2382 				in mediump float te_out;
   2383 				void main()
   2384 				{
   2385 					out0 = te_out + 4.0 * val.fragVal;
   2386 					${FRAGMENT_OUTPUT};
   2387 				}
   2388 			""
   2389 		end
   2390 	end
   2391 
   2392 	import "linkage_tessellation_uniform_types.test"
   2393 end
   2394 
   2395 group layout_declarations "Layout linkage"
   2396 	group rules "Rules"
   2397 
   2398 		case primitive_mode_mismatch
   2399 			version 310 es
   2400 			desc "Tessellation evaluation shader primitive mode mismatch"
   2401 			expect compile_or_link_fail
   2402 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2403 			values
   2404 			{
   2405 				input float in0 = 1.0;
   2406 				output float out0 = 1.0;
   2407 			}
   2408 			vertex ""
   2409 				#version 310 es
   2410 				${VERTEX_DECLARATIONS}
   2411 				out mediump float tc_in;
   2412 				void main()
   2413 				{
   2414 					tc_in = in0;
   2415 					${VERTEX_OUTPUT}
   2416 				}
   2417 			""
   2418 			tessellation_control ""
   2419 				#version 310 es
   2420 				${TESSELLATION_CONTROL_DECLARATIONS}
   2421 				in mediump float tc_in[];
   2422 				out mediump float tc_out[];
   2423 				void main()
   2424 				{
   2425 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   2426 					${TESSELLATION_CONTROL_OUTPUT}
   2427 				}
   2428 			""
   2429 			tessellation_evaluation ""
   2430 				#version 310 es
   2431 				layout (triangles) in;
   2432 				layout (isolines) in;
   2433 				in mediump float tc_out[];
   2434 				out mediump float te_out;
   2435 				void main()
   2436 				{
   2437 					te_out = tc_out[2];
   2438 					${TESSELLATION_EVALUATION_OUTPUT}
   2439 				}
   2440 			""
   2441 			fragment ""
   2442 				#version 310 es
   2443 				precision mediump float;
   2444 				${FRAGMENT_DECLARATIONS}
   2445 				in mediump float te_out;
   2446 				void main()
   2447 				{
   2448 					out0 = te_out;
   2449 					${FRAGMENT_OUTPUT}
   2450 				}
   2451 			""
   2452 		end
   2453 
   2454 		case spacing_mode_mismatch
   2455 			version 310 es
   2456 			desc "Tessellation evaluation shader spacing mode mismatch"
   2457 			expect compile_or_link_fail
   2458 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2459 			values
   2460 			{
   2461 				input float in0 = 1.0;
   2462 				output float out0 = 1.0;
   2463 			}
   2464 			vertex ""
   2465 				#version 310 es
   2466 				${VERTEX_DECLARATIONS}
   2467 				out mediump float tc_in;
   2468 				void main()
   2469 				{
   2470 					tc_in = in0;
   2471 					${VERTEX_OUTPUT}
   2472 				}
   2473 			""
   2474 			tessellation_control ""
   2475 				#version 310 es
   2476 				${TESSELLATION_CONTROL_DECLARATIONS}
   2477 				in mediump float tc_in[];
   2478 				out mediump float tc_out[];
   2479 				void main()
   2480 				{
   2481 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   2482 					${TESSELLATION_CONTROL_OUTPUT}
   2483 				}
   2484 			""
   2485 			tessellation_evaluation ""
   2486 				#version 310 es
   2487 				layout (triangles, equal_spacing) in;
   2488 				layout (triangles, fractional_odd_spacing) in;
   2489 				in mediump float tc_out[];
   2490 				out mediump float te_out;
   2491 				void main()
   2492 				{
   2493 					te_out = tc_out[2];
   2494 					${TESSELLATION_EVALUATION_OUTPUT}
   2495 				}
   2496 			""
   2497 			fragment ""
   2498 				#version 310 es
   2499 				precision mediump float;
   2500 				${FRAGMENT_DECLARATIONS}
   2501 				in mediump float te_out;
   2502 				void main()
   2503 				{
   2504 					out0 = te_out;
   2505 					${FRAGMENT_OUTPUT}
   2506 				}
   2507 			""
   2508 		end
   2509 
   2510 		case vertex_order_mismatch
   2511 			version 310 es
   2512 			desc "Tessellation evaluation shader vertex order mismatch"
   2513 			expect compile_or_link_fail
   2514 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2515 			values
   2516 			{
   2517 				input float in0 = 1.0;
   2518 				output float out0 = 1.0;
   2519 			}
   2520 			vertex ""
   2521 				#version 310 es
   2522 				${VERTEX_DECLARATIONS}
   2523 				out mediump float tc_in;
   2524 				void main()
   2525 				{
   2526 					tc_in = in0;
   2527 					${VERTEX_OUTPUT}
   2528 				}
   2529 			""
   2530 			tessellation_control ""
   2531 				#version 310 es
   2532 				${TESSELLATION_CONTROL_DECLARATIONS}
   2533 				in mediump float tc_in[];
   2534 				out mediump float tc_out[];
   2535 				void main()
   2536 				{
   2537 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   2538 					${TESSELLATION_CONTROL_OUTPUT}
   2539 				}
   2540 			""
   2541 			tessellation_evaluation ""
   2542 				#version 310 es
   2543 				layout (triangles, cw) in;
   2544 				layout (triangles, ccw) in;
   2545 				    in mediump float tc_out[];
   2546 				out mediump float te_out;
   2547 				void main()
   2548 				{
   2549 					te_out = tc_out[2];
   2550 					${TESSELLATION_EVALUATION_OUTPUT}
   2551 				}
   2552 			""
   2553 			fragment ""
   2554 				#version 310 es
   2555 				precision mediump float;
   2556 				${FRAGMENT_DECLARATIONS}
   2557 				in mediump float te_out;
   2558 				void main()
   2559 				{
   2560 					out0 = te_out;
   2561 					${FRAGMENT_OUTPUT}
   2562 				}
   2563 			""
   2564 		end
   2565 
   2566 		case vertex_count_mismatch
   2567 			version 310 es
   2568 			desc "Tessellation control shader vertex count mismatch"
   2569 			expect compile_or_link_fail
   2570 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2571 			values
   2572 			{
   2573 				input float in0 = 1.0;
   2574 				output float out0 = 1.0;
   2575 			}
   2576 			vertex ""
   2577 				#version 310 es
   2578 				${VERTEX_DECLARATIONS}
   2579 				out mediump float tc_in;
   2580 				void main()
   2581 				{
   2582 					tc_in = in0;
   2583 					${VERTEX_OUTPUT}
   2584 				}
   2585 			""
   2586 			tessellation_control ""
   2587 				#version 310 es
   2588 				layout (vertices=3) out;
   2589 				layout (vertices=4) out;
   2590 				in mediump float tc_in[];
   2591 				out mediump float tc_out[];
   2592 				void main()
   2593 				{
   2594 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   2595 					${TESSELLATION_CONTROL_OUTPUT}
   2596 				}
   2597 			""
   2598 			tessellation_evaluation ""
   2599 				#version 310 es
   2600 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2601 				in mediump float tc_out[];
   2602 				out mediump float te_out;
   2603 				void main()
   2604 				{
   2605 					te_out = tc_out[2];
   2606 					${TESSELLATION_EVALUATION_OUTPUT}
   2607 				}
   2608 			""
   2609 			fragment ""
   2610 				#version 310 es
   2611 				precision mediump float;
   2612 				${FRAGMENT_DECLARATIONS}
   2613 				in mediump float te_out;
   2614 				void main()
   2615 				{
   2616 					out0 = te_out;
   2617 					${FRAGMENT_OUTPUT}
   2618 				}
   2619 			""
   2620 		end
   2621 	end
   2622 end
   2623 
   2624 group barriers "Barriers"
   2625 	group rules "Rules"
   2626 
   2627 		case invalid_barrier_usage_within_control_flow
   2628 			version 310 es
   2629 			desc "Tessellation control shader invalid barrier usage within control flow statement"
   2630 			expect compile_or_link_fail
   2631 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2632 			values
   2633 			{
   2634 				input float in0 = 1.0;
   2635 				output float out0 = 1.0;
   2636 			}
   2637 			vertex ""
   2638 				#version 310 es
   2639 				${VERTEX_DECLARATIONS}
   2640 				out mediump float tc_in;
   2641 				void main()
   2642 				{
   2643 					tc_in = in0;
   2644 					${VERTEX_OUTPUT}
   2645 				}
   2646 			""
   2647 			tessellation_control ""
   2648 				#version 310 es
   2649 				${TESSELLATION_CONTROL_DECLARATIONS}
   2650 				in mediump float tc_in[];
   2651 				out mediump float tc_out[];
   2652 
   2653 				void main()
   2654 				{
   2655 					if (gl_InvocationID == 0)
   2656 						barrier(); // error: within control flow
   2657 
   2658 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   2659 					${TESSELLATION_CONTROL_OUTPUT}
   2660 				}
   2661 			""
   2662 			tessellation_evaluation ""
   2663 				#version 310 es
   2664 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2665 				in mediump float tc_out[];
   2666 				out mediump float te_out;
   2667 				void main()
   2668 				{
   2669 					te_out = tc_out[2];
   2670 					${TESSELLATION_EVALUATION_OUTPUT}
   2671 				}
   2672 			""
   2673 			fragment ""
   2674 				#version 310 es
   2675 				precision mediump float;
   2676 				${FRAGMENT_DECLARATIONS}
   2677 				in mediump float te_out;
   2678 				void main()
   2679 				{
   2680 					out0 = te_out;
   2681 					${FRAGMENT_OUTPUT}
   2682 				}
   2683 			""
   2684 		end
   2685 
   2686 		case invalid_barrier_usage_after_return
   2687 			version 310 es
   2688 			desc "Tessellation control shader invalid barrier usage after main() returns"
   2689 			expect compile_or_link_fail
   2690 			require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
   2691 			values
   2692 			{
   2693 				input float in0 = 1.0;
   2694 				output float out0 = 1.0;
   2695 			}
   2696 			vertex ""
   2697 				#version 310 es
   2698 				${VERTEX_DECLARATIONS}
   2699 				out mediump float tc_in;
   2700 				void main()
   2701 				{
   2702 					tc_in = in0;
   2703 					${VERTEX_OUTPUT}
   2704 				}
   2705 			""
   2706 			tessellation_control ""
   2707 				#version 310 es
   2708 				${TESSELLATION_CONTROL_DECLARATIONS}
   2709 				in mediump float tc_in[];
   2710 				out mediump float tc_out[];
   2711 
   2712 				void main()
   2713 				{
   2714 					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
   2715 					${TESSELLATION_CONTROL_OUTPUT}
   2716 
   2717 					return;
   2718 					barrier(); // error: barrier() after return
   2719 				}
   2720 			""
   2721 			tessellation_evaluation ""
   2722 				#version 310 es
   2723 				${TESSELLATION_EVALUATION_DECLARATIONS}
   2724 				in mediump float tc_out[];
   2725 				out mediump float te_out;
   2726 				void main()
   2727 				{
   2728 					te_out = tc_out[2];
   2729 					${TESSELLATION_EVALUATION_OUTPUT}
   2730 				}
   2731 			""
   2732 			fragment ""
   2733 				#version 310 es
   2734 				precision mediump float;
   2735 				${FRAGMENT_DECLARATIONS}
   2736 				in mediump float te_out;
   2737 				void main()
   2738 				{
   2739 					out0 = te_out;
   2740 					${FRAGMENT_OUTPUT}
   2741 				}
   2742 			""
   2743 		end
   2744 	end
   2745 end
   2746