a93768ecb37484a8206b09dc586e2f846da77f23
[platform/upstream/VK-GL-CTS.git] / data / gles31 / shaders / separate_shader_validation.test
1
2 group varying "Default block varying matching"
3
4         case missing_input
5                 version 310 es
6                 desc "Variable has no matching input"
7                 expect validation_fail
8
9                 pipeline_program
10                         active_stages {vertex}
11                         vertex ""
12                                 #version 310 es
13                                 ${VERTEX_DECLARATIONS}
14                                 out mediump float v_val;
15                                 out mediump float v_val_no_such_input;
16                                 void main()
17                                 {
18                                         v_val = float(gl_VertexID);
19                                         v_val_no_such_input = 1.0;
20                                         ${VERTEX_OUTPUT}
21                                 }
22                         ""
23                 end
24                 pipeline_program
25                         active_stages {fragment}
26                         fragment ""
27                                 #version 310 es
28                                 ${FRAGMENT_DECLARATIONS}
29                                 in mediump float v_val;
30                                 void main()
31                                 {
32                                         ${FRAG_COLOR} = vec4(v_val);
33                                 }
34                         ""
35                 end
36         end
37
38         case missing_output
39                 version 310 es
40                 desc "Variable has no matching output"
41                 expect validation_fail
42
43                 pipeline_program
44                         active_stages {vertex}
45                         vertex ""
46                                 #version 310 es
47                                 ${VERTEX_DECLARATIONS}
48                                 out mediump float v_val;
49                                 void main()
50                                 {
51                                         v_val = float(gl_VertexID);
52                                         ${VERTEX_OUTPUT}
53                                 }
54                         ""
55                 end
56                 pipeline_program
57                         active_stages {fragment}
58                         fragment ""
59                                 #version 310 es
60                                 ${FRAGMENT_DECLARATIONS}
61                                 in mediump float v_val;
62                                 in mediump float v_val_no_such_output;
63                                 void main()
64                                 {
65                                         ${FRAG_COLOR} = vec4(v_val + v_val_no_such_output);
66                                 }
67                         ""
68                 end
69         end
70
71         case mismatch_type
72                 version 310 es
73                 desc "Variable type mismatch"
74                 expect validation_fail
75
76                 pipeline_program
77                         active_stages {vertex}
78                         vertex ""
79                                 #version 310 es
80                                 ${VERTEX_DECLARATIONS}
81                                 out mediump vec3 v_val;
82                                 void main()
83                                 {
84                                         v_val = vec3(float(gl_VertexID));
85                                         ${VERTEX_OUTPUT}
86                                 }
87                         ""
88                 end
89                 pipeline_program
90                         active_stages {fragment}
91                         fragment ""
92                                 #version 310 es
93                                 ${FRAGMENT_DECLARATIONS}
94                                 in mediump vec4 v_val;
95                                 void main()
96                                 {
97                                         ${FRAG_COLOR} = v_val;
98                                 }
99                         ""
100                 end
101         end
102
103         case mismatch_precision
104                 version 310 es
105                 desc "Variable precision mismatch"
106                 expect validation_fail
107
108                 pipeline_program
109                         active_stages {vertex}
110                         vertex ""
111                                 #version 310 es
112                                 ${VERTEX_DECLARATIONS}
113                                 out mediump float v_val;
114                                 void main()
115                                 {
116                                         v_val = float(gl_VertexID);
117                                         ${VERTEX_OUTPUT}
118                                 }
119                         ""
120                 end
121                 pipeline_program
122                         active_stages {fragment}
123                         fragment ""
124                                 #version 310 es
125                                 ${FRAGMENT_DECLARATIONS}
126                                 in highp float v_val;
127                                 void main()
128                                 {
129                                         ${FRAG_COLOR} = vec4(v_val);
130                                 }
131                         ""
132                 end
133         end
134
135         case mismatch_explicit_location_type
136                 version 310 es
137                 desc "Variable type mismatch, explicit varying locations"
138                 expect validation_fail
139
140                 pipeline_program
141                         active_stages {vertex}
142                         vertex ""
143                                 #version 310 es
144                                 ${VERTEX_DECLARATIONS}
145                                 layout(location = 3) out mediump vec4 v_val;
146                                 void main()
147                                 {
148                                         v_val = vec4(float(gl_VertexID));
149                                         ${VERTEX_OUTPUT}
150                                 }
151                         ""
152                 end
153                 pipeline_program
154                         active_stages {fragment}
155                         fragment ""
156                                 #version 310 es
157                                 ${FRAGMENT_DECLARATIONS}
158                                 layout(location = 3) in mediump vec2 v_val;
159                                 void main()
160                                 {
161                                         ${FRAG_COLOR} = v_val.xxyy;
162                                 }
163                         ""
164                 end
165         end
166
167         case mismatch_explicit_location_precision
168                 version 310 es
169                 desc "Variable precision mismatch, explicit varying locations"
170                 expect validation_fail
171
172                 pipeline_program
173                         active_stages {vertex}
174                         vertex ""
175                                 #version 310 es
176                                 ${VERTEX_DECLARATIONS}
177                                 layout(location = 3) out mediump float v_val;
178                                 void main()
179                                 {
180                                         v_val = float(gl_VertexID);
181                                         ${VERTEX_OUTPUT}
182                                 }
183                         ""
184                 end
185                 pipeline_program
186                         active_stages {fragment}
187                         fragment ""
188                                 #version 310 es
189                                 ${FRAGMENT_DECLARATIONS}
190                                 layout(location = 3) in highp float v_val;
191                                 void main()
192                                 {
193                                         ${FRAG_COLOR} = vec4(v_val);
194                                 }
195                         ""
196                 end
197         end
198
199         case mismatch_explicit_location
200                 version 310 es
201                 desc "Variable location mismatch"
202                 expect validation_fail
203
204                 pipeline_program
205                         active_stages {vertex}
206                         vertex ""
207                                 #version 310 es
208                                 ${VERTEX_DECLARATIONS}
209                                 layout(location = 3) out mediump float v_val;
210                                 void main()
211                                 {
212                                         v_val = float(gl_VertexID);
213                                         ${VERTEX_OUTPUT}
214                                 }
215                         ""
216                 end
217                 pipeline_program
218                         active_stages {fragment}
219                         fragment ""
220                                 #version 310 es
221                                 ${FRAGMENT_DECLARATIONS}
222                                 layout(location = 4) in mediump float v_val;
223                                 void main()
224                                 {
225                                         ${FRAG_COLOR} = vec4(v_val);
226                                 }
227                         ""
228                 end
229         end
230
231         case mismatch_implicit_explicit_location_1
232                 version 310 es
233                 desc "Variable location mismatch"
234                 expect validation_fail
235
236                 pipeline_program
237                         active_stages {vertex}
238                         vertex ""
239                                 #version 310 es
240                                 ${VERTEX_DECLARATIONS}
241                                 out mediump float v_val;
242                                 void main()
243                                 {
244                                         v_val = float(gl_VertexID);
245                                         ${VERTEX_OUTPUT}
246                                 }
247                         ""
248                 end
249                 pipeline_program
250                         active_stages {fragment}
251                         fragment ""
252                                 #version 310 es
253                                 ${FRAGMENT_DECLARATIONS}
254                                 layout(location = 3) in mediump float v_val;
255                                 void main()
256                                 {
257                                         ${FRAG_COLOR} = vec4(v_val);
258                                 }
259                         ""
260                 end
261         end
262
263         case mismatch_implicit_explicit_location_2
264                 version 310 es
265                 desc "Variable location mismatch"
266                 expect validation_fail
267
268                 pipeline_program
269                         active_stages {vertex}
270                         vertex ""
271                                 #version 310 es
272                                 ${VERTEX_DECLARATIONS}
273                                 layout(location = 3) out mediump float v_val;
274                                 void main()
275                                 {
276                                         v_val = float(gl_VertexID);
277                                         ${VERTEX_OUTPUT}
278                                 }
279                         ""
280                 end
281                 pipeline_program
282                         active_stages {fragment}
283                         fragment ""
284                                 #version 310 es
285                                 ${FRAGMENT_DECLARATIONS}
286                                 in mediump float v_val;
287                                 layout(location = 3) in mediump float v_val_other_name;
288                                 void main()
289                                 {
290                                         ${FRAG_COLOR} = vec4(v_val + v_val_other_name);
291                                 }
292                         ""
293                 end
294         end
295
296         case mismatch_implicit_explicit_location_3
297                 version 310 es
298                 desc "Variable location mismatch"
299                 expect validation_fail
300
301                 pipeline_program
302                         active_stages {vertex}
303                         vertex ""
304                                 #version 310 es
305                                 ${VERTEX_DECLARATIONS}
306                                 out mediump float v_val;
307                                 layout(location = 3) out mediump float v_val_other_name;
308                                 void main()
309                                 {
310                                         v_val = float(gl_VertexID);
311                                         v_val_other_name = 1.0;
312                                         ${VERTEX_OUTPUT}
313                                 }
314                         ""
315                 end
316                 pipeline_program
317                         active_stages {fragment}
318                         fragment ""
319                                 #version 310 es
320                                 ${FRAGMENT_DECLARATIONS}
321                                 layout(location = 3) in mediump float v_val;
322                                 void main()
323                                 {
324                                         ${FRAG_COLOR} = vec4(v_val);
325                                 }
326                         ""
327                 end
328         end
329
330         case match_different_struct_names
331                 version 310 es
332                 desc "Variable struct names different but otherwise identical"
333                 expect pass
334
335                 pipeline_program
336                         active_stages {vertex}
337                         vertex ""
338                                 #version 310 es
339                                 ${VERTEX_DECLARATIONS}
340                                 struct StructureNameA
341                                 {
342                                         mediump float member;
343                                 };
344                                 out StructureNameA v_val;
345                                 void main()
346                                 {
347                                         v_val.member = float(gl_VertexID);
348                                         ${VERTEX_OUTPUT}
349                                 }
350                         ""
351                 end
352                 pipeline_program
353                         active_stages {fragment}
354                         fragment ""
355                                 #version 310 es
356                                 ${FRAGMENT_DECLARATIONS}
357                                 struct StructureNameB
358                                 {
359                                         mediump float member;
360                                 };
361                                 in StructureNameB v_val;
362                                 void main()
363                                 {
364                                         // should always produce white
365                                         ${FRAG_COLOR} = (v_val.member > -1.0) ? (vec4(1.0)) : (vec4(0.0));
366                                 }
367                         ""
368                 end
369         end
370
371         case mismatch_struct_member_name
372                 version 310 es
373                 desc "Struct member name mismatch"
374                 expect validation_fail
375
376                 pipeline_program
377                         active_stages {vertex}
378                         vertex ""
379                                 #version 310 es
380                                 ${VERTEX_DECLARATIONS}
381                                 struct StructureName
382                                 {
383                                         mediump float member;
384                                 };
385                                 out StructureName v_val;
386                                 void main()
387                                 {
388                                         v_val.member = float(gl_VertexID);
389                                         ${VERTEX_OUTPUT}
390                                 }
391                         ""
392                 end
393                 pipeline_program
394                         active_stages {fragment}
395                         fragment ""
396                                 #version 310 es
397                                 ${FRAGMENT_DECLARATIONS}
398                                 struct StructureName
399                                 {
400                                         mediump float member_different_name;
401                                 };
402                                 in StructureName v_val;
403                                 void main()
404                                 {
405                                         ${FRAG_COLOR} = vec4(v_val.member_different_name);
406                                 }
407                         ""
408                 end
409         end
410
411         case mismatch_struct_member_type
412                 version 310 es
413                 desc "Struct member type mismatch"
414                 expect validation_fail
415
416                 pipeline_program
417                         active_stages {vertex}
418                         vertex ""
419                                 #version 310 es
420                                 ${VERTEX_DECLARATIONS}
421                                 struct StructureName
422                                 {
423                                         mediump float member;
424                                 };
425                                 out StructureName v_val;
426                                 void main()
427                                 {
428                                         v_val.member = float(gl_VertexID);
429                                         ${VERTEX_OUTPUT}
430                                 }
431                         ""
432                 end
433                 pipeline_program
434                         active_stages {fragment}
435                         fragment ""
436                                 #version 310 es
437                                 ${FRAGMENT_DECLARATIONS}
438                                 struct StructureName
439                                 {
440                                         mediump vec2 member;
441                                 };
442                                 in StructureName v_val;
443                                 void main()
444                                 {
445                                         ${FRAG_COLOR} = vec4(v_val.member.x);
446                                 }
447                         ""
448                 end
449         end
450
451         case mismatch_struct_member_precision
452                 version 310 es
453                 desc "Struct member precision mismatch"
454                 expect validation_fail
455
456                 pipeline_program
457                         active_stages {vertex}
458                         vertex ""
459                                 #version 310 es
460                                 ${VERTEX_DECLARATIONS}
461                                 struct StructureName
462                                 {
463                                         mediump float member;
464                                 };
465                                 out StructureName v_val;
466                                 void main()
467                                 {
468                                         v_val.member = float(gl_VertexID);
469                                         ${VERTEX_OUTPUT}
470                                 }
471                         ""
472                 end
473                 pipeline_program
474                         active_stages {fragment}
475                         fragment ""
476                                 #version 310 es
477                                 ${FRAGMENT_DECLARATIONS}
478                                 struct StructureName
479                                 {
480                                         highp float member;
481                                 };
482                                 in StructureName v_val;
483                                 void main()
484                                 {
485                                         ${FRAG_COLOR} = vec4(v_val.member);
486                                 }
487                         ""
488                 end
489         end
490
491         case mismatch_struct_member_order
492                 version 310 es
493                 desc "Struct member order mismatch"
494                 expect validation_fail
495
496                 pipeline_program
497                         active_stages {vertex}
498                         vertex ""
499                                 #version 310 es
500                                 ${VERTEX_DECLARATIONS}
501                                 struct StructureName
502                                 {
503                                         mediump float memberA;
504                                         mediump float memberB;
505                                 };
506                                 out StructureName v_val;
507                                 void main()
508                                 {
509                                         v_val.memberA = float(gl_VertexID);
510                                         v_val.memberB = 1.0;
511                                         ${VERTEX_OUTPUT}
512                                 }
513                         ""
514                 end
515                 pipeline_program
516                         active_stages {fragment}
517                         fragment ""
518                                 #version 310 es
519                                 ${FRAGMENT_DECLARATIONS}
520                                 struct StructureName
521                                 {
522                                         mediump float memberB;
523                                         mediump float memberA;
524                                 };
525                                 in StructureName v_val;
526                                 void main()
527                                 {
528                                         ${FRAG_COLOR} = vec4(v_val.memberA + v_val.memberB);
529                                 }
530                         ""
531                 end
532         end
533
534         case mismatch_array_element_type
535                 version 310 es
536                 desc "Array element type mismatch"
537                 expect validation_fail
538
539                 pipeline_program
540                         active_stages {vertex}
541                         vertex ""
542                                 #version 310 es
543                                 ${VERTEX_DECLARATIONS}
544                                 out mediump float v_val[2];
545                                 void main()
546                                 {
547                                         v_val[0] = 1.0;
548                                         v_val[1] = 2.0;
549                                         ${VERTEX_OUTPUT}
550                                 }
551                         ""
552                 end
553                 pipeline_program
554                         active_stages {fragment}
555                         fragment ""
556                                 #version 310 es
557                                 ${FRAGMENT_DECLARATIONS}
558                                 in mediump vec2 v_val[2];
559                                 void main()
560                                 {
561                                         ${FRAG_COLOR} = vec4(v_val[0].x + v_val[1].y);
562                                 }
563                         ""
564                 end
565         end
566
567         case mismatch_array_length
568                 version 310 es
569                 desc "Array length mismatch"
570                 expect validation_fail
571
572                 pipeline_program
573                         active_stages {vertex}
574                         vertex ""
575                                 #version 310 es
576                                 ${VERTEX_DECLARATIONS}
577                                 out mediump float v_val[2];
578                                 void main()
579                                 {
580                                         v_val[0] = 1.0;
581                                         v_val[1] = 2.0;
582                                         ${VERTEX_OUTPUT}
583                                 }
584                         ""
585                 end
586                 pipeline_program
587                         active_stages {fragment}
588                         fragment ""
589                                 #version 310 es
590                                 ${FRAGMENT_DECLARATIONS}
591                                 in mediump float v_val[3];
592                                 void main()
593                                 {
594                                         ${FRAG_COLOR} = vec4(v_val[0] + v_val[1] + v_val[2]);
595                                 }
596                         ""
597                 end
598         end
599
600         case mismatch_array_precision
601                 version 310 es
602                 desc "Array length mismatch"
603                 expect validation_fail
604
605                 pipeline_program
606                         active_stages {vertex}
607                         vertex ""
608                                 #version 310 es
609                                 ${VERTEX_DECLARATIONS}
610                                 out mediump float v_val[2];
611                                 void main()
612                                 {
613                                         v_val[0] = 1.0;
614                                         v_val[1] = 2.0;
615                                         ${VERTEX_OUTPUT}
616                                 }
617                         ""
618                 end
619                 pipeline_program
620                         active_stages {fragment}
621                         fragment ""
622                                 #version 310 es
623                                 ${FRAGMENT_DECLARATIONS}
624                                 in highp float v_val[2];
625                                 void main()
626                                 {
627                                         ${FRAG_COLOR} = vec4(v_val[0] + v_val[1]);
628                                 }
629                         ""
630                 end
631         end
632 end
633
634 group io_blocks "shader io blocks"
635
636         case missing_input
637                 version 310 es
638                 desc "Missing input block"
639                 expect validation_fail
640
641                 pipeline_program
642                         active_stages {vertex}
643                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
644                         vertex ""
645                                 #version 310 es
646                                 ${VERTEX_DECLARATIONS}
647                                 out IOBlockName
648                                 {
649                                         mediump float v_val;
650                                 };
651                                 void main()
652                                 {
653                                         v_val = 1.0;
654                                         ${VERTEX_OUTPUT}
655                                 }
656                         ""
657                 end
658                 pipeline_program
659                         active_stages {fragment}
660                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
661                         fragment ""
662                                 #version 310 es
663                                 ${FRAGMENT_DECLARATIONS}
664                                 void main()
665                                 {
666                                         ${FRAG_COLOR} = vec4(1.0);
667                                 }
668                         ""
669                 end
670         end
671
672         case missing_output
673                 version 310 es
674                 desc "Missing output block"
675                 expect validation_fail
676
677                 pipeline_program
678                         active_stages {vertex}
679                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
680                         vertex ""
681                                 #version 310 es
682                                 ${VERTEX_DECLARATIONS}
683                                 void main()
684                                 {
685                                         ${VERTEX_OUTPUT}
686                                 }
687                         ""
688                 end
689                 pipeline_program
690                         active_stages {fragment}
691                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
692                         fragment ""
693                                 #version 310 es
694                                 ${FRAGMENT_DECLARATIONS}
695                                 in IOBlockName
696                                 {
697                                         mediump float v_val;
698                                 };
699                                 void main()
700                                 {
701                                         ${FRAG_COLOR} = vec4(v_val);
702                                 }
703                         ""
704                 end
705         end
706
707         case mismatch_number_of_declarations
708                 version 310 es
709                 desc "IO-blocks do not match due to mismatch in number of declarations"
710                 expect validation_fail
711
712                 pipeline_program
713                         active_stages {vertex}
714                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
715                         vertex ""
716                                 #version 310 es
717                                 ${VERTEX_DECLARATIONS}
718                                 out IOBlockName
719                                 {
720                                         mediump float v_valA;
721                                         mediump float v_valB;
722                                 };
723                                 void main()
724                                 {
725                                         v_valA = 1.0;
726                                         v_valB = 2.0;
727                                         ${VERTEX_OUTPUT}
728                                 }
729                         ""
730                 end
731                 pipeline_program
732                         active_stages {fragment}
733                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
734                         fragment ""
735                                 #version 310 es
736                                 ${FRAGMENT_DECLARATIONS}
737                                 in IOBlockName
738                                 {
739                                         mediump float v_valA;
740                                 };
741                                 void main()
742                                 {
743                                         ${FRAG_COLOR} = vec4(v_valA);
744                                 }
745                         ""
746                 end
747         end
748
749         case mismatch_member_order
750                 version 310 es
751                 desc "IO-blocks do not match due to mismatch with member declaration order"
752                 expect validation_fail
753
754                 pipeline_program
755                         active_stages {vertex}
756                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
757                         vertex ""
758                                 #version 310 es
759                                 ${VERTEX_DECLARATIONS}
760                                 out IOBlockName
761                                 {
762                                         mediump float v_valA;
763                                         mediump float v_valB;
764                                 };
765                                 void main()
766                                 {
767                                         v_valA = 1.0;
768                                         v_valB = 2.0;
769                                         ${VERTEX_OUTPUT}
770                                 }
771                         ""
772                 end
773                 pipeline_program
774                         active_stages {fragment}
775                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
776                         fragment ""
777                                 #version 310 es
778                                 ${FRAGMENT_DECLARATIONS}
779                                 in IOBlockName
780                                 {
781                                         mediump float v_valB;
782                                         mediump float v_valA;
783                                 };
784                                 void main()
785                                 {
786                                         ${FRAG_COLOR} = vec4(v_valA+v_valB);
787                                 }
788                         ""
789                 end
790         end
791
792         case mismatch_member_type
793                 version 310 es
794                 desc "IO-blocks do not match due to mismatch with member types"
795                 expect validation_fail
796
797                 pipeline_program
798                         active_stages {vertex}
799                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
800                         vertex ""
801                                 #version 310 es
802                                 ${VERTEX_DECLARATIONS}
803                                 out IOBlockName
804                                 {
805                                         mediump float v_valA;
806                                 };
807                                 void main()
808                                 {
809                                         v_valA = 1.0;
810                                         ${VERTEX_OUTPUT}
811                                 }
812                         ""
813                 end
814                 pipeline_program
815                         active_stages {fragment}
816                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
817                         fragment ""
818                                 #version 310 es
819                                 ${FRAGMENT_DECLARATIONS}
820                                 in IOBlockName
821                                 {
822                                         mediump vec2 v_valA;
823                                 };
824                                 void main()
825                                 {
826                                         ${FRAG_COLOR} = vec4(v_valA.xyxy);
827                                 }
828                         ""
829                 end
830         end
831
832         case mismatch_member_name
833                 version 310 es
834                 desc "IO-blocks do not match due to mismatch with member names"
835                 expect validation_fail
836
837                 pipeline_program
838                         active_stages {vertex}
839                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
840                         vertex ""
841                                 #version 310 es
842                                 ${VERTEX_DECLARATIONS}
843                                 out IOBlockName
844                                 {
845                                         mediump float v_valA;
846                                 };
847                                 void main()
848                                 {
849                                         v_valA = 1.0;
850                                         ${VERTEX_OUTPUT}
851                                 }
852                         ""
853                 end
854                 pipeline_program
855                         active_stages {fragment}
856                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
857                         fragment ""
858                                 #version 310 es
859                                 ${FRAGMENT_DECLARATIONS}
860                                 in IOBlockName
861                                 {
862                                         mediump vec2 v_valB;
863                                 };
864                                 void main()
865                                 {
866                                         ${FRAG_COLOR} = vec4(v_valB.y);
867                                 }
868                         ""
869                 end
870         end
871
872         case mismatch_member_precision
873                 version 310 es
874                 desc "IO-blocks do not match due to mismatch with member precisions"
875                 expect validation_fail
876
877                 pipeline_program
878                         active_stages {vertex}
879                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
880                         vertex ""
881                                 #version 310 es
882                                 ${VERTEX_DECLARATIONS}
883                                 out IOBlockName
884                                 {
885                                         mediump float v_valA;
886                                 };
887                                 void main()
888                                 {
889                                         v_valA = 1.0;
890                                         ${VERTEX_OUTPUT}
891                                 }
892                         ""
893                 end
894                 pipeline_program
895                         active_stages {fragment}
896                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
897                         fragment ""
898                                 #version 310 es
899                                 ${FRAGMENT_DECLARATIONS}
900                                 in IOBlockName
901                                 {
902                                         highp float v_valA;
903                                 };
904                                 void main()
905                                 {
906                                         ${FRAG_COLOR} = vec4(v_valA);
907                                 }
908                         ""
909                 end
910         end
911
912         case match_different_member_interpolation
913                 version 310 es
914                 desc "IO-block members match with different interpolation qualifiers"
915                 expect pass
916
917                 pipeline_program
918                         active_stages {vertex}
919                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
920                         vertex ""
921                                 #version 310 es
922                                 ${VERTEX_DECLARATIONS}
923                                 out IOBlockName
924                                 {
925                                         smooth out mediump float v_val;
926                                 };
927                                 void main()
928                                 {
929                                         v_val = 1.0;
930                                         ${VERTEX_OUTPUT}
931                                 }
932                         ""
933                 end
934                 pipeline_program
935                         active_stages {fragment}
936                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
937                         fragment ""
938                                 #version 310 es
939                                 ${FRAGMENT_DECLARATIONS}
940                                 in IOBlockName
941                                 {
942                                         flat in mediump float v_val;
943                                 };
944                                 void main()
945                                 {
946                                         ${FRAG_COLOR} = vec4(v_val);
947                                 }
948                         ""
949                 end
950         end
951
952         case mismatch_member_array_size
953                 version 310 es
954                 desc "IO-blocks do not match due to mismatch with member array size"
955                 expect validation_fail
956
957                 pipeline_program
958                         active_stages {vertex}
959                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
960                         vertex ""
961                                 #version 310 es
962                                 ${VERTEX_DECLARATIONS}
963                                 out IOBlockName
964                                 {
965                                         mediump float v_val_arr[2];
966                                 };
967                                 void main()
968                                 {
969                                         v_val_arr[0] = 1.0;
970                                         v_val_arr[1] = 2.0;
971                                         ${VERTEX_OUTPUT}
972                                 }
973                         ""
974                 end
975                 pipeline_program
976                         active_stages {fragment}
977                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
978                         fragment ""
979                                 #version 310 es
980                                 ${FRAGMENT_DECLARATIONS}
981                                 in IOBlockName
982                                 {
983                                         mediump float v_val_arr[1];
984                                 };
985                                 void main()
986                                 {
987                                         ${FRAG_COLOR} = vec4(v_val_arr[0]);
988                                 }
989                         ""
990                 end
991         end
992
993         case match_different_member_struct_names
994                 version 310 es
995                 desc "IO-blocks match with structs with different names"
996                 expect pass
997
998                 pipeline_program
999                         active_stages {vertex}
1000                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1001                         vertex ""
1002                                 #version 310 es
1003                                 ${VERTEX_DECLARATIONS}
1004                                 struct StructNameA
1005                                 {
1006                                         mediump float v;
1007                                 };
1008                                 out IOBlockName
1009                                 {
1010                                         StructNameA v_val;
1011                                 };
1012
1013                                 void main()
1014                                 {
1015                                         v_val.v = 1.0;
1016                                         ${VERTEX_OUTPUT}
1017                                 }
1018                         ""
1019                 end
1020                 pipeline_program
1021                         active_stages {fragment}
1022                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1023                         fragment ""
1024                                 #version 310 es
1025                                 ${FRAGMENT_DECLARATIONS}
1026                                 struct StructNameB
1027                                 {
1028                                         mediump float v;
1029                                 };
1030                                 in IOBlockName
1031                                 {
1032                                         StructNameB v_val;
1033                                 };
1034                                 void main()
1035                                 {
1036                                         ${FRAG_COLOR} = vec4(v_val.v);
1037                                 }
1038                         ""
1039                 end
1040         end
1041
1042         case mismatch_member_struct_member_name
1043                 version 310 es
1044                 desc "IO-blocks do not match due to mismatch with member structs"
1045                 expect validation_fail
1046
1047                 pipeline_program
1048                         active_stages {vertex}
1049                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1050                         vertex ""
1051                                 #version 310 es
1052                                 ${VERTEX_DECLARATIONS}
1053                                 struct StructName
1054                                 {
1055                                         mediump float v;
1056                                 };
1057                                 out IOBlockName
1058                                 {
1059                                         StructName v_val;
1060                                 };
1061
1062                                 void main()
1063                                 {
1064                                         v_val.v = 1.0;
1065                                         ${VERTEX_OUTPUT}
1066                                 }
1067                         ""
1068                 end
1069                 pipeline_program
1070                         active_stages {fragment}
1071                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1072                         fragment ""
1073                                 #version 310 es
1074                                 ${FRAGMENT_DECLARATIONS}
1075                                 struct StructName
1076                                 {
1077                                         mediump float v_alt_name;
1078                                 };
1079                                 in IOBlockName
1080                                 {
1081                                         StructName v_val;
1082                                 };
1083                                 void main()
1084                                 {
1085                                         ${FRAG_COLOR} = vec4(v_val.v_alt_name);
1086                                 }
1087                         ""
1088                 end
1089         end
1090
1091         case mismatch_member_struct_member_type
1092                 version 310 es
1093                 desc "IO-blocks do not match due to mismatch with member structs"
1094                 expect validation_fail
1095
1096                 pipeline_program
1097                         active_stages {vertex}
1098                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1099                         vertex ""
1100                                 #version 310 es
1101                                 ${VERTEX_DECLARATIONS}
1102                                 struct StructName
1103                                 {
1104                                         mediump float v;
1105                                 };
1106                                 out IOBlockName
1107                                 {
1108                                         StructName v_val;
1109                                 };
1110
1111                                 void main()
1112                                 {
1113                                         v_val.v = 1.0;
1114                                         ${VERTEX_OUTPUT}
1115                                 }
1116                         ""
1117                 end
1118                 pipeline_program
1119                         active_stages {fragment}
1120                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1121                         fragment ""
1122                                 #version 310 es
1123                                 ${FRAGMENT_DECLARATIONS}
1124                                 struct StructName
1125                                 {
1126                                         mediump vec2 v;
1127                                 };
1128                                 in IOBlockName
1129                                 {
1130                                         StructName v_val;
1131                                 };
1132                                 void main()
1133                                 {
1134                                         ${FRAG_COLOR} = vec4(v_val.v.x);
1135                                 }
1136                         ""
1137                 end
1138         end
1139
1140         case mismatch_member_struct_member_precision
1141                 version 310 es
1142                 desc "IO-blocks do not match due to mismatch with member structs"
1143                 expect validation_fail
1144
1145                 pipeline_program
1146                         active_stages {vertex}
1147                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1148                         vertex ""
1149                                 #version 310 es
1150                                 ${VERTEX_DECLARATIONS}
1151                                 struct StructName
1152                                 {
1153                                         mediump float v;
1154                                 };
1155                                 out IOBlockName
1156                                 {
1157                                         StructName v_val;
1158                                 };
1159
1160                                 void main()
1161                                 {
1162                                         v_val.v = 1.0;
1163                                         ${VERTEX_OUTPUT}
1164                                 }
1165                         ""
1166                 end
1167                 pipeline_program
1168                         active_stages {fragment}
1169                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1170                         fragment ""
1171                                 #version 310 es
1172                                 ${FRAGMENT_DECLARATIONS}
1173                                 struct StructName
1174                                 {
1175                                         highp float v;
1176                                 };
1177                                 in IOBlockName
1178                                 {
1179                                         StructName v_val;
1180                                 };
1181                                 void main()
1182                                 {
1183                                         ${FRAG_COLOR} = vec4(v_val.v);
1184                                 }
1185                         ""
1186                 end
1187         end
1188
1189         case mismatch_member_struct_member_order
1190                 version 310 es
1191                 desc "IO-blocks do not match due to mismatch with member structs"
1192                 expect validation_fail
1193
1194                 pipeline_program
1195                         active_stages {vertex}
1196                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1197                         vertex ""
1198                                 #version 310 es
1199                                 ${VERTEX_DECLARATIONS}
1200                                 struct StructName
1201                                 {
1202                                         mediump float v_a;
1203                                         mediump float v_b;
1204                                 };
1205                                 out IOBlockName
1206                                 {
1207                                         StructName v_val;
1208                                 };
1209
1210                                 void main()
1211                                 {
1212                                         v_val.v_a = 1.0;
1213                                         v_val.v_b = 1.0;
1214                                         ${VERTEX_OUTPUT}
1215                                 }
1216                         ""
1217                 end
1218                 pipeline_program
1219                         active_stages {fragment}
1220                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1221                         fragment ""
1222                                 #version 310 es
1223                                 ${FRAGMENT_DECLARATIONS}
1224                                 struct StructName
1225                                 {
1226                                         mediump float v_b;
1227                                         mediump float v_a;
1228                                 };
1229                                 in IOBlockName
1230                                 {
1231                                         StructName v_val;
1232                                 };
1233                                 void main()
1234                                 {
1235                                         ${FRAG_COLOR} = vec4(v_val.v_a);
1236                                 }
1237                         ""
1238                 end
1239         end
1240
1241         case mismatch_array_size
1242                 version 310 es
1243                 desc "IO-blocks do not match due to mismatch with array sizes"
1244                 expect validation_fail
1245
1246                 pipeline_program
1247                         active_stages {vertex}
1248                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1249                         vertex ""
1250                                 #version 310 es
1251                                 ${VERTEX_DECLARATIONS}
1252                                 out IOBlockName
1253                                 {
1254                                         mediump float v_val;
1255                                 } ioBlock[2];
1256                                 void main()
1257                                 {
1258                                         ioBlock[0].v_val = 1.0;
1259                                         ioBlock[1].v_val = 2.0;
1260                                         ${VERTEX_OUTPUT}
1261                                 }
1262                         ""
1263                 end
1264                 pipeline_program
1265                         active_stages {fragment}
1266                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1267                         fragment ""
1268                                 #version 310 es
1269                                 ${FRAGMENT_DECLARATIONS}
1270                                 in IOBlockName
1271                                 {
1272                                         mediump float v_val;
1273                                 } ioBlock[1];
1274                                 void main()
1275                                 {
1276                                         ${FRAG_COLOR} = vec4(ioBlock[0].v_val);
1277                                 }
1278                         ""
1279                 end
1280         end
1281
1282         case mismatch_variable_and_block_member_1
1283                 version 310 es
1284                 desc "IO-block does not match with variable"
1285                 expect validation_fail
1286
1287                 pipeline_program
1288                         active_stages {vertex}
1289                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1290                         vertex ""
1291                                 #version 310 es
1292                                 ${VERTEX_DECLARATIONS}
1293                                 out IOBlockName
1294                                 {
1295                                         mediump float v_val;
1296                                 };
1297
1298                                 void main()
1299                                 {
1300                                         v_val = 1.0;
1301                                         ${VERTEX_OUTPUT}
1302                                 }
1303                         ""
1304                 end
1305                 pipeline_program
1306                         active_stages {fragment}
1307                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1308                         fragment ""
1309                                 #version 310 es
1310                                 ${FRAGMENT_DECLARATIONS}
1311                                 in mediump float v_val;
1312                                 void main()
1313                                 {
1314                                         ${FRAG_COLOR} = vec4(v_val);
1315                                 }
1316                         ""
1317                 end
1318         end
1319
1320         case mismatch_variable_and_block_member_2
1321                 version 310 es
1322                 desc "IO-block does not match with variable"
1323                 expect validation_fail
1324
1325                 pipeline_program
1326                         active_stages {vertex}
1327                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1328                         vertex ""
1329                                 #version 310 es
1330                                 ${VERTEX_DECLARATIONS}
1331                                 out VariableAndBlockName
1332                                 {
1333                                         mediump float v_val;
1334                                 };
1335
1336                                 void main()
1337                                 {
1338                                         v_val = 1.0;
1339                                         ${VERTEX_OUTPUT}
1340                                 }
1341                         ""
1342                 end
1343                 pipeline_program
1344                         active_stages {fragment}
1345                         require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1346                         fragment ""
1347                                 #version 310 es
1348                                 ${FRAGMENT_DECLARATIONS}
1349                                 in mediump float VariableAndBlockName;
1350                                 void main()
1351                                 {
1352                                         ${FRAG_COLOR} = vec4(VariableAndBlockName);
1353                                 }
1354                         ""
1355                 end
1356         end
1357 end