1
2group 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
633	case mismatch_qualifier_vertex_flat_fragment_none
634		version 310 es
635		desc "Interpolation qualifier mismatch"
636		expect validation_fail
637
638		pipeline_program
639			active_stages {vertex}
640			vertex ""
641				#version 310 es
642				${VERTEX_DECLARATIONS}
643				out flat highp vec4 v_val;
644				void main()
645				{
646					v_val = vec4(float(gl_VertexID));
647					${VERTEX_OUTPUT}
648				}
649			""
650		end
651		pipeline_program
652			active_stages {fragment}
653			fragment ""
654				#version 310 es
655				${FRAGMENT_DECLARATIONS}
656				in highp vec4 v_val;
657				void main()
658				{
659					${FRAG_COLOR} = v_val;
660				}
661			""
662		end
663	end
664
665	case mismatch_qualifier_vertex_flat_fragment_smooth
666		version 310 es
667		desc "Interpolation qualifier mismatch"
668		expect validation_fail
669
670		pipeline_program
671			active_stages {vertex}
672			vertex ""
673				#version 310 es
674				${VERTEX_DECLARATIONS}
675				out flat highp vec4 v_val;
676				void main()
677				{
678					v_val = vec4(float(gl_VertexID));
679					${VERTEX_OUTPUT}
680				}
681			""
682		end
683		pipeline_program
684			active_stages {fragment}
685			fragment ""
686				#version 310 es
687				${FRAGMENT_DECLARATIONS}
688				in smooth highp vec4 v_val;
689				void main()
690				{
691					${FRAG_COLOR} = v_val;
692				}
693			""
694		end
695	end
696
697	case mismatch_qualifier_vertex_flat_fragment_centroid
698		version 310 es
699		desc "Interpolation qualifier mismatch"
700		expect validation_fail
701
702		pipeline_program
703			active_stages {vertex}
704			vertex ""
705				#version 310 es
706				${VERTEX_DECLARATIONS}
707				out flat highp vec4 v_val;
708				void main()
709				{
710					v_val = vec4(float(gl_VertexID));
711					${VERTEX_OUTPUT}
712				}
713			""
714		end
715		pipeline_program
716			active_stages {fragment}
717			fragment ""
718				#version 310 es
719				${FRAGMENT_DECLARATIONS}
720				in centroid highp vec4 v_val;
721				void main()
722				{
723					${FRAG_COLOR} = v_val;
724				}
725			""
726		end
727	end
728
729	case mismatch_qualifier_vertex_smooth_fragment_flat
730		version 310 es
731		desc "Interpolation qualifier mismatch"
732		expect validation_fail
733
734		pipeline_program
735			active_stages {vertex}
736			vertex ""
737				#version 310 es
738				${VERTEX_DECLARATIONS}
739				out smooth highp vec4 v_val;
740				void main()
741				{
742					v_val = vec4(float(gl_VertexID));
743					${VERTEX_OUTPUT}
744				}
745			""
746		end
747		pipeline_program
748			active_stages {fragment}
749			fragment ""
750				#version 310 es
751				${FRAGMENT_DECLARATIONS}
752				in flat highp vec4 v_val;
753				void main()
754				{
755					${FRAG_COLOR} = v_val;
756				}
757			""
758		end
759	end
760
761	case mismatch_qualifier_vertex_centroid_fragment_flat
762		version 310 es
763		desc "Interpolation qualifier mismatch"
764		expect validation_fail
765
766		pipeline_program
767			active_stages {vertex}
768			vertex ""
769				#version 310 es
770				${VERTEX_DECLARATIONS}
771				out centroid highp vec4 v_val;
772				void main()
773				{
774					v_val = vec4(float(gl_VertexID));
775					${VERTEX_OUTPUT}
776				}
777			""
778		end
779		pipeline_program
780			active_stages {fragment}
781			fragment ""
782				#version 310 es
783				${FRAGMENT_DECLARATIONS}
784				in flat highp vec4 v_val;
785				void main()
786				{
787					${FRAG_COLOR} = v_val;
788				}
789			""
790		end
791	end
792end
793
794group io_blocks "shader io blocks"
795
796	case missing_input
797		version 310 es
798		desc "Missing input block"
799		expect validation_fail
800
801		pipeline_program
802			active_stages {vertex}
803			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
804			vertex ""
805				#version 310 es
806				${VERTEX_DECLARATIONS}
807				out IOBlockName
808				{
809					mediump float v_val;
810				};
811				void main()
812				{
813					v_val = 1.0;
814					${VERTEX_OUTPUT}
815				}
816			""
817		end
818		pipeline_program
819			active_stages {fragment}
820			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
821			fragment ""
822				#version 310 es
823				${FRAGMENT_DECLARATIONS}
824				void main()
825				{
826					${FRAG_COLOR} = vec4(1.0);
827				}
828			""
829		end
830	end
831
832	case missing_output
833		version 310 es
834		desc "Missing output block"
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				void main()
844				{
845					${VERTEX_OUTPUT}
846				}
847			""
848		end
849		pipeline_program
850			active_stages {fragment}
851			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
852			fragment ""
853				#version 310 es
854				${FRAGMENT_DECLARATIONS}
855				in IOBlockName
856				{
857					mediump float v_val;
858				};
859				void main()
860				{
861					${FRAG_COLOR} = vec4(v_val);
862				}
863			""
864		end
865	end
866
867	case mismatch_number_of_declarations
868		version 310 es
869		desc "IO-blocks do not match due to mismatch in number of declarations"
870		expect validation_fail
871
872		pipeline_program
873			active_stages {vertex}
874			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
875			vertex ""
876				#version 310 es
877				${VERTEX_DECLARATIONS}
878				out IOBlockName
879				{
880					mediump float v_valA;
881					mediump float v_valB;
882				};
883				void main()
884				{
885					v_valA = 1.0;
886					v_valB = 2.0;
887					${VERTEX_OUTPUT}
888				}
889			""
890		end
891		pipeline_program
892			active_stages {fragment}
893			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
894			fragment ""
895				#version 310 es
896				${FRAGMENT_DECLARATIONS}
897				in IOBlockName
898				{
899					mediump float v_valA;
900				};
901				void main()
902				{
903					${FRAG_COLOR} = vec4(v_valA);
904				}
905			""
906		end
907	end
908
909	case mismatch_member_order
910		version 310 es
911		desc "IO-blocks do not match due to mismatch with member declaration order"
912		expect validation_fail
913
914		pipeline_program
915			active_stages {vertex}
916			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
917			vertex ""
918				#version 310 es
919				${VERTEX_DECLARATIONS}
920				out IOBlockName
921				{
922					mediump float v_valA;
923					mediump float v_valB;
924				};
925				void main()
926				{
927					v_valA = 1.0;
928					v_valB = 2.0;
929					${VERTEX_OUTPUT}
930				}
931			""
932		end
933		pipeline_program
934			active_stages {fragment}
935			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
936			fragment ""
937				#version 310 es
938				${FRAGMENT_DECLARATIONS}
939				in IOBlockName
940				{
941					mediump float v_valB;
942					mediump float v_valA;
943				};
944				void main()
945				{
946					${FRAG_COLOR} = vec4(v_valA+v_valB);
947				}
948			""
949		end
950	end
951
952	case mismatch_member_type
953		version 310 es
954		desc "IO-blocks do not match due to mismatch with member types"
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_valA;
966				};
967				void main()
968				{
969					v_valA = 1.0;
970					${VERTEX_OUTPUT}
971				}
972			""
973		end
974		pipeline_program
975			active_stages {fragment}
976			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
977			fragment ""
978				#version 310 es
979				${FRAGMENT_DECLARATIONS}
980				in IOBlockName
981				{
982					mediump vec2 v_valA;
983				};
984				void main()
985				{
986					${FRAG_COLOR} = vec4(v_valA.xyxy);
987				}
988			""
989		end
990	end
991
992	case mismatch_member_name
993		version 310 es
994		desc "IO-blocks do not match due to mismatch with member names"
995		expect validation_fail
996
997		pipeline_program
998			active_stages {vertex}
999			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1000			vertex ""
1001				#version 310 es
1002				${VERTEX_DECLARATIONS}
1003				out IOBlockName
1004				{
1005					mediump float v_valA;
1006				};
1007				void main()
1008				{
1009					v_valA = 1.0;
1010					${VERTEX_OUTPUT}
1011				}
1012			""
1013		end
1014		pipeline_program
1015			active_stages {fragment}
1016			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1017			fragment ""
1018				#version 310 es
1019				${FRAGMENT_DECLARATIONS}
1020				in IOBlockName
1021				{
1022					mediump vec2 v_valB;
1023				};
1024				void main()
1025				{
1026					${FRAG_COLOR} = vec4(v_valB.y);
1027				}
1028			""
1029		end
1030	end
1031
1032	case mismatch_member_precision
1033		version 310 es
1034		desc "IO-blocks do not match due to mismatch with member precisions"
1035		expect validation_fail
1036
1037		pipeline_program
1038			active_stages {vertex}
1039			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1040			vertex ""
1041				#version 310 es
1042				${VERTEX_DECLARATIONS}
1043				out IOBlockName
1044				{
1045					mediump float v_valA;
1046				};
1047				void main()
1048				{
1049					v_valA = 1.0;
1050					${VERTEX_OUTPUT}
1051				}
1052			""
1053		end
1054		pipeline_program
1055			active_stages {fragment}
1056			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1057			fragment ""
1058				#version 310 es
1059				${FRAGMENT_DECLARATIONS}
1060				in IOBlockName
1061				{
1062					highp float v_valA;
1063				};
1064				void main()
1065				{
1066					${FRAG_COLOR} = vec4(v_valA);
1067				}
1068			""
1069		end
1070	end
1071
1072	case mismatch_different_member_interpolation
1073		version 310 es
1074		desc "IO-block members do not match due to different interpolation qualifiers"
1075		expect validation_fail
1076
1077		pipeline_program
1078			active_stages {vertex}
1079			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1080			vertex ""
1081				#version 310 es
1082				${VERTEX_DECLARATIONS}
1083				out IOBlockName
1084				{
1085					smooth out mediump float v_val;
1086				};
1087				void main()
1088				{
1089					v_val = 1.0;
1090					${VERTEX_OUTPUT}
1091				}
1092			""
1093		end
1094		pipeline_program
1095			active_stages {fragment}
1096			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1097			fragment ""
1098				#version 310 es
1099				${FRAGMENT_DECLARATIONS}
1100				in IOBlockName
1101				{
1102					flat in mediump float v_val;
1103				};
1104				void main()
1105				{
1106					${FRAG_COLOR} = vec4(v_val);
1107				}
1108			""
1109		end
1110	end
1111
1112	case mismatch_member_array_size
1113		version 310 es
1114		desc "IO-blocks do not match due to mismatch with member array size"
1115		expect validation_fail
1116
1117		pipeline_program
1118			active_stages {vertex}
1119			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1120			vertex ""
1121				#version 310 es
1122				${VERTEX_DECLARATIONS}
1123				out IOBlockName
1124				{
1125					mediump float v_val_arr[2];
1126				};
1127				void main()
1128				{
1129					v_val_arr[0] = 1.0;
1130					v_val_arr[1] = 2.0;
1131					${VERTEX_OUTPUT}
1132				}
1133			""
1134		end
1135		pipeline_program
1136			active_stages {fragment}
1137			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1138			fragment ""
1139				#version 310 es
1140				${FRAGMENT_DECLARATIONS}
1141				in IOBlockName
1142				{
1143					mediump float v_val_arr[1];
1144				};
1145				void main()
1146				{
1147					${FRAG_COLOR} = vec4(v_val_arr[0]);
1148				}
1149			""
1150		end
1151	end
1152
1153	case match_different_member_struct_names
1154		version 310 es
1155		desc "IO-blocks match with structs with different names"
1156		expect pass
1157
1158		pipeline_program
1159			active_stages {vertex}
1160			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1161			vertex ""
1162				#version 310 es
1163				${VERTEX_DECLARATIONS}
1164				struct StructNameA
1165				{
1166					mediump float v;
1167				};
1168				out IOBlockName
1169				{
1170					StructNameA v_val;
1171				};
1172
1173				void main()
1174				{
1175					v_val.v = 1.0;
1176					${VERTEX_OUTPUT}
1177				}
1178			""
1179		end
1180		pipeline_program
1181			active_stages {fragment}
1182			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1183			fragment ""
1184				#version 310 es
1185				${FRAGMENT_DECLARATIONS}
1186				struct StructNameB
1187				{
1188					mediump float v;
1189				};
1190				in IOBlockName
1191				{
1192					StructNameB v_val;
1193				};
1194				void main()
1195				{
1196					${FRAG_COLOR} = vec4(v_val.v);
1197				}
1198			""
1199		end
1200	end
1201
1202	case mismatch_member_struct_member_name
1203		version 310 es
1204		desc "IO-blocks do not match due to mismatch with member structs"
1205		expect validation_fail
1206
1207		pipeline_program
1208			active_stages {vertex}
1209			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1210			vertex ""
1211				#version 310 es
1212				${VERTEX_DECLARATIONS}
1213				struct StructName
1214				{
1215					mediump float v;
1216				};
1217				out IOBlockName
1218				{
1219					StructName v_val;
1220				};
1221
1222				void main()
1223				{
1224					v_val.v = 1.0;
1225					${VERTEX_OUTPUT}
1226				}
1227			""
1228		end
1229		pipeline_program
1230			active_stages {fragment}
1231			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1232			fragment ""
1233				#version 310 es
1234				${FRAGMENT_DECLARATIONS}
1235				struct StructName
1236				{
1237					mediump float v_alt_name;
1238				};
1239				in IOBlockName
1240				{
1241					StructName v_val;
1242				};
1243				void main()
1244				{
1245					${FRAG_COLOR} = vec4(v_val.v_alt_name);
1246				}
1247			""
1248		end
1249	end
1250
1251	case mismatch_member_struct_member_type
1252		version 310 es
1253		desc "IO-blocks do not match due to mismatch with member structs"
1254		expect validation_fail
1255
1256		pipeline_program
1257			active_stages {vertex}
1258			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1259			vertex ""
1260				#version 310 es
1261				${VERTEX_DECLARATIONS}
1262				struct StructName
1263				{
1264					mediump float v;
1265				};
1266				out IOBlockName
1267				{
1268					StructName v_val;
1269				};
1270
1271				void main()
1272				{
1273					v_val.v = 1.0;
1274					${VERTEX_OUTPUT}
1275				}
1276			""
1277		end
1278		pipeline_program
1279			active_stages {fragment}
1280			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1281			fragment ""
1282				#version 310 es
1283				${FRAGMENT_DECLARATIONS}
1284				struct StructName
1285				{
1286					mediump vec2 v;
1287				};
1288				in IOBlockName
1289				{
1290					StructName v_val;
1291				};
1292				void main()
1293				{
1294					${FRAG_COLOR} = vec4(v_val.v.x);
1295				}
1296			""
1297		end
1298	end
1299
1300	case mismatch_member_struct_member_precision
1301		version 310 es
1302		desc "IO-blocks do not match due to mismatch with member structs"
1303		expect validation_fail
1304
1305		pipeline_program
1306			active_stages {vertex}
1307			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1308			vertex ""
1309				#version 310 es
1310				${VERTEX_DECLARATIONS}
1311				struct StructName
1312				{
1313					mediump float v;
1314				};
1315				out IOBlockName
1316				{
1317					StructName v_val;
1318				};
1319
1320				void main()
1321				{
1322					v_val.v = 1.0;
1323					${VERTEX_OUTPUT}
1324				}
1325			""
1326		end
1327		pipeline_program
1328			active_stages {fragment}
1329			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1330			fragment ""
1331				#version 310 es
1332				${FRAGMENT_DECLARATIONS}
1333				struct StructName
1334				{
1335					highp float v;
1336				};
1337				in IOBlockName
1338				{
1339					StructName v_val;
1340				};
1341				void main()
1342				{
1343					${FRAG_COLOR} = vec4(v_val.v);
1344				}
1345			""
1346		end
1347	end
1348
1349	case mismatch_member_struct_member_order
1350		version 310 es
1351		desc "IO-blocks do not match due to mismatch with member structs"
1352		expect validation_fail
1353
1354		pipeline_program
1355			active_stages {vertex}
1356			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1357			vertex ""
1358				#version 310 es
1359				${VERTEX_DECLARATIONS}
1360				struct StructName
1361				{
1362					mediump float v_a;
1363					mediump float v_b;
1364				};
1365				out IOBlockName
1366				{
1367					StructName v_val;
1368				};
1369
1370				void main()
1371				{
1372					v_val.v_a = 1.0;
1373					v_val.v_b = 1.0;
1374					${VERTEX_OUTPUT}
1375				}
1376			""
1377		end
1378		pipeline_program
1379			active_stages {fragment}
1380			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1381			fragment ""
1382				#version 310 es
1383				${FRAGMENT_DECLARATIONS}
1384				struct StructName
1385				{
1386					mediump float v_b;
1387					mediump float v_a;
1388				};
1389				in IOBlockName
1390				{
1391					StructName v_val;
1392				};
1393				void main()
1394				{
1395					${FRAG_COLOR} = vec4(v_val.v_a);
1396				}
1397			""
1398		end
1399	end
1400
1401	case mismatch_array_size
1402		version 310 es
1403		desc "IO-blocks do not match due to mismatch with array sizes"
1404		expect validation_fail
1405
1406		pipeline_program
1407			active_stages {vertex}
1408			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1409			vertex ""
1410				#version 310 es
1411				${VERTEX_DECLARATIONS}
1412				out IOBlockName
1413				{
1414					mediump float v_val;
1415				} ioBlock[2];
1416				void main()
1417				{
1418					ioBlock[0].v_val = 1.0;
1419					ioBlock[1].v_val = 2.0;
1420					${VERTEX_OUTPUT}
1421				}
1422			""
1423		end
1424		pipeline_program
1425			active_stages {fragment}
1426			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1427			fragment ""
1428				#version 310 es
1429				${FRAGMENT_DECLARATIONS}
1430				in IOBlockName
1431				{
1432					mediump float v_val;
1433				} ioBlock[1];
1434				void main()
1435				{
1436					${FRAG_COLOR} = vec4(ioBlock[0].v_val);
1437				}
1438			""
1439		end
1440	end
1441
1442	case mismatch_variable_and_block_member_1
1443		version 310 es
1444		desc "IO-block does not match with variable"
1445		expect validation_fail
1446
1447		pipeline_program
1448			active_stages {vertex}
1449			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1450			vertex ""
1451				#version 310 es
1452				${VERTEX_DECLARATIONS}
1453				out IOBlockName
1454				{
1455					mediump float v_val;
1456				};
1457
1458				void main()
1459				{
1460					v_val = 1.0;
1461					${VERTEX_OUTPUT}
1462				}
1463			""
1464		end
1465		pipeline_program
1466			active_stages {fragment}
1467			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1468			fragment ""
1469				#version 310 es
1470				${FRAGMENT_DECLARATIONS}
1471				in mediump float v_val;
1472				void main()
1473				{
1474					${FRAG_COLOR} = vec4(v_val);
1475				}
1476			""
1477		end
1478	end
1479
1480	case mismatch_variable_and_block_member_2
1481		version 310 es
1482		desc "IO-block does not match with variable"
1483		expect validation_fail
1484
1485		pipeline_program
1486			active_stages {vertex}
1487			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { vertex }
1488			vertex ""
1489				#version 310 es
1490				${VERTEX_DECLARATIONS}
1491				out VariableAndBlockName
1492				{
1493					mediump float v_val;
1494				};
1495
1496				void main()
1497				{
1498					v_val = 1.0;
1499					${VERTEX_OUTPUT}
1500				}
1501			""
1502		end
1503		pipeline_program
1504			active_stages {fragment}
1505			require extension { "GL_OES_shader_io_blocks" | "GL_EXT_shader_io_blocks" } in { fragment }
1506			fragment ""
1507				#version 310 es
1508				${FRAGMENT_DECLARATIONS}
1509				in mediump float VariableAndBlockName;
1510				void main()
1511				{
1512					${FRAG_COLOR} = vec4(VariableAndBlockName);
1513				}
1514			""
1515		end
1516	end
1517end
1518