1# -------------------------------------------------
2# drawElements Quality Program OpenGL ES 3.2 Module
3# -------------------------------------------------
4#
5# Copyright 2016 The Android Open Source Project
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11#      http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18
19
20group varying "Varying linkage"
21	group rules "Rules"
22
23		case input_type_mismatch
24			version 320 es
25			desc "Tessellation control shader input type mismatch"
26			expect link_fail
27			values
28			{
29				input float in0 = 1.0;
30				output float out0 = 1.0;
31			}
32			vertex ""
33				#version 320 es
34				${VERTEX_DECLARATIONS}
35				out mediump float tc_in;
36				void main()
37				{
38					tc_in = in0;
39					${VERTEX_OUTPUT}
40				}
41			""
42			tessellation_control ""
43				#version 320 es
44				${TESSELLATION_CONTROL_DECLARATIONS}
45				in mediump vec2 tc_in[];
46				out mediump float tc_out[];
47				void main()
48				{
49					tc_out[gl_InvocationID] = tc_in[gl_InvocationID].x;
50					${TESSELLATION_CONTROL_OUTPUT}
51				}
52			""
53			tessellation_evaluation ""
54				#version 320 es
55				${TESSELLATION_EVALUATION_DECLARATIONS}
56				in mediump float tc_out[];
57				out mediump float te_out;
58				void main()
59				{
60					te_out = tc_out[2];
61					${TESSELLATION_EVALUATION_OUTPUT}
62				}
63			""
64			fragment ""
65				#version 320 es
66				precision mediump float;
67				${FRAGMENT_DECLARATIONS}
68				in mediump float te_out;
69				void main()
70				{
71					out0 = te_out;
72					${FRAGMENT_OUTPUT}
73				}
74			""
75		end
76
77		case output_type_mismatch
78			version 320 es
79			desc "Tessellation evaluation shader output type mismatch"
80			expect link_fail
81			values
82			{
83				input float in0 = 1.0;
84				output float out0 = 1.0;
85			}
86			vertex ""
87				#version 320 es
88				${VERTEX_DECLARATIONS}
89				out mediump float tc_in;
90				void main()
91				{
92					tc_in = in0;
93					${VERTEX_OUTPUT}
94				}
95			""
96			tessellation_control ""
97				#version 320 es
98				${TESSELLATION_CONTROL_DECLARATIONS}
99				in mediump float tc_in[];
100				out mediump float tc_out[];
101				void main()
102				{
103					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
104					${TESSELLATION_CONTROL_OUTPUT}
105				}
106			""
107			tessellation_evaluation ""
108				#version 320 es
109				${TESSELLATION_EVALUATION_DECLARATIONS}
110				in mediump float tc_out[];
111				out mediump float te_out;
112				void main()
113				{
114					te_out = tc_out[2];
115					${TESSELLATION_EVALUATION_OUTPUT}
116				}
117			""
118			fragment ""
119				#version 320 es
120				precision mediump float;
121				${FRAGMENT_DECLARATIONS}
122				in mediump vec2 te_out;
123				void main()
124				{
125					out0 = te_out.x + te_out.y;
126					${FRAGMENT_OUTPUT}
127				}
128			""
129		end
130
131		case internal_type_mismatch
132			version 320 es
133			desc "Tessellation control and evaluation shader varying type mismatch"
134			expect link_fail
135			values
136			{
137				input float in0 = 1.0;
138				output float out0 = 1.0;
139			}
140			vertex ""
141				#version 320 es
142				${VERTEX_DECLARATIONS}
143				out mediump float tc_in;
144				void main()
145				{
146					tc_in = in0;
147					${VERTEX_OUTPUT}
148				}
149			""
150			tessellation_control ""
151				#version 320 es
152				${TESSELLATION_CONTROL_DECLARATIONS}
153				in mediump float tc_in[];
154				out mediump float tc_out[];
155				void main()
156				{
157					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
158					${TESSELLATION_CONTROL_OUTPUT}
159				}
160			""
161			tessellation_evaluation ""
162				#version 320 es
163				${TESSELLATION_EVALUATION_DECLARATIONS}
164				in mediump vec2 tc_out[];
165				out mediump float te_out;
166				void main()
167				{
168					te_out = tc_out[2].x + tc_out[0].y;
169					${TESSELLATION_EVALUATION_OUTPUT}
170				}
171			""
172			fragment ""
173				#version 320 es
174				precision mediump float;
175				${FRAGMENT_DECLARATIONS}
176				in mediump float te_out;
177				void main()
178				{
179					out0 = te_out;
180					${FRAGMENT_OUTPUT}
181				}
182			""
183		end
184
185		case input_different_precision
186			version 320 es
187			desc "Tessellation control shader input precisions different"
188			values
189			{
190				input float in0 = 1.0;
191				output float out0 = 1.0;
192			}
193			vertex ""
194				#version 320 es
195				${VERTEX_DECLARATIONS}
196				out highp float tc_in;
197				void main()
198				{
199					tc_in = in0;
200					${VERTEX_OUTPUT}
201				}
202			""
203			tessellation_control ""
204				#version 320 es
205				${TESSELLATION_CONTROL_DECLARATIONS}
206				in lowp float tc_in[];
207				out mediump float tc_out[];
208				void main()
209				{
210					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
211					${TESSELLATION_CONTROL_OUTPUT}
212				}
213			""
214			tessellation_evaluation ""
215				#version 320 es
216				${TESSELLATION_EVALUATION_DECLARATIONS}
217				in mediump float tc_out[];
218				out mediump float te_out;
219				void main()
220				{
221					te_out = tc_out[2];
222					${TESSELLATION_EVALUATION_OUTPUT}
223				}
224			""
225			fragment ""
226				#version 320 es
227				precision mediump float;
228				${FRAGMENT_DECLARATIONS}
229				in mediump float te_out;
230				void main()
231				{
232					out0 = te_out;
233					${FRAGMENT_OUTPUT}
234				}
235			""
236		end
237
238		case output_different_precision
239			version 320 es
240			desc "Tessellation evaluation shader output precisions different"
241			values
242			{
243				input float in0 = 1.0;
244				output float out0 = 1.0;
245			}
246			vertex ""
247				#version 320 es
248				${VERTEX_DECLARATIONS}
249				out mediump float tc_in;
250				void main()
251				{
252					tc_in = in0;
253					${VERTEX_OUTPUT}
254				}
255			""
256			tessellation_control ""
257				#version 320 es
258				${TESSELLATION_CONTROL_DECLARATIONS}
259				in mediump float tc_in[];
260				out mediump float tc_out[];
261				void main()
262				{
263					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
264					${TESSELLATION_CONTROL_OUTPUT}
265				}
266			""
267			tessellation_evaluation ""
268				#version 320 es
269				${TESSELLATION_EVALUATION_DECLARATIONS}
270				in mediump float tc_out[];
271				out highp float te_out;
272				void main()
273				{
274					te_out = tc_out[2];
275					${TESSELLATION_EVALUATION_OUTPUT}
276				}
277			""
278			fragment ""
279				#version 320 es
280				precision mediump float;
281				${FRAGMENT_DECLARATIONS}
282				in lowp float te_out;
283				void main()
284				{
285					out0 = te_out;
286					${FRAGMENT_OUTPUT}
287				}
288			""
289		end
290
291		case internal_different_precision
292			version 320 es
293			desc "Tessellation control and evaluation shader varying precisions different"
294			values
295			{
296				input float in0 = 1.0;
297				output float out0 = 1.0;
298			}
299			vertex ""
300				#version 320 es
301				${VERTEX_DECLARATIONS}
302				out mediump float tc_in;
303				void main()
304				{
305					tc_in = in0;
306					${VERTEX_OUTPUT}
307				}
308			""
309			tessellation_control ""
310				#version 320 es
311				${TESSELLATION_CONTROL_DECLARATIONS}
312				in mediump float tc_in[];
313				out highp float tc_out[];
314				void main()
315				{
316					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
317					${TESSELLATION_CONTROL_OUTPUT}
318				}
319			""
320			tessellation_evaluation ""
321				#version 320 es
322				${TESSELLATION_EVALUATION_DECLARATIONS}
323				in lowp float tc_out[];
324				out mediump float te_out;
325				void main()
326				{
327					te_out = tc_out[2];
328					${TESSELLATION_EVALUATION_OUTPUT}
329				}
330			""
331			fragment ""
332				#version 320 es
333				precision mediump float;
334				${FRAGMENT_DECLARATIONS}
335				in mediump float te_out;
336				void main()
337				{
338					out0 = te_out;
339					${FRAGMENT_OUTPUT}
340				}
341			""
342		end
343
344		case input_no_declaration
345			version 320 es
346			desc "Tessellation control shader input with no matching output"
347			expect link_fail
348			values
349			{
350				input float in0 = 1.0;
351				output float out0 = 1.0;
352			}
353			vertex ""
354				#version 320 es
355				${VERTEX_DECLARATIONS}
356				void main()
357				{
358					${VERTEX_OUTPUT}
359				}
360			""
361			tessellation_control ""
362				#version 320 es
363				${TESSELLATION_CONTROL_DECLARATIONS}
364				in mediump float tc_in[];
365				out mediump float tc_out[];
366				void main()
367				{
368					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
369					${TESSELLATION_CONTROL_OUTPUT}
370				}
371			""
372			tessellation_evaluation ""
373				#version 320 es
374				${TESSELLATION_EVALUATION_DECLARATIONS}
375				in mediump float tc_out[];
376				out mediump float te_out;
377				void main()
378				{
379					te_out = tc_out[2];
380					${TESSELLATION_EVALUATION_OUTPUT}
381				}
382			""
383			fragment ""
384				#version 320 es
385				precision mediump float;
386				${FRAGMENT_DECLARATIONS}
387				in mediump float te_out;
388				void main()
389				{
390					out0 = te_out;
391					${FRAGMENT_OUTPUT}
392				}
393			""
394		end
395
396		case output_no_declaration
397			version 320 es
398			desc "Tessellation evaluation shader without output for an fragment shader input"
399			expect link_fail
400			values
401			{
402				output float out0 = 1.0;
403			}
404			vertex ""
405				#version 320 es
406				${VERTEX_DECLARATIONS}
407				void main()
408				{
409					${VERTEX_OUTPUT}
410				}
411			""
412			tessellation_control ""
413				#version 320 es
414				${TESSELLATION_CONTROL_DECLARATIONS}
415				void main()
416				{
417					${TESSELLATION_CONTROL_OUTPUT}
418				}
419			""
420			tessellation_evaluation ""
421				#version 320 es
422				${TESSELLATION_EVALUATION_DECLARATIONS}
423				void main()
424				{
425					${TESSELLATION_EVALUATION_OUTPUT}
426				}
427			""
428			fragment ""
429				#version 320 es
430				precision mediump float;
431				${FRAGMENT_DECLARATIONS}
432				in mediump float te_out;
433				void main()
434				{
435					out0 = te_out;
436					${FRAGMENT_OUTPUT}
437				}
438			""
439		end
440
441		case internal_no_declaration
442			version 320 es
443			desc "Tessellation evaluation shader input without matching output"
444			expect link_fail
445			values
446			{
447				output float out0 = 1.0;
448			}
449			vertex ""
450				#version 320 es
451				${VERTEX_DECLARATIONS}
452				void main()
453				{
454					${VERTEX_OUTPUT}
455				}
456			""
457			tessellation_control ""
458				#version 320 es
459				${TESSELLATION_CONTROL_DECLARATIONS}
460				void main()
461				{
462					${TESSELLATION_CONTROL_OUTPUT}
463				}
464			""
465			tessellation_evaluation ""
466				#version 320 es
467				${TESSELLATION_EVALUATION_DECLARATIONS}
468				in mediump float tc_out[];
469				out mediump float te_out;
470				void main()
471				{
472					te_out = tc_out[2];
473					${TESSELLATION_EVALUATION_OUTPUT}
474				}
475			""
476			fragment ""
477				#version 320 es
478				precision mediump float;
479				${FRAGMENT_DECLARATIONS}
480				in mediump float te_out;
481				void main()
482				{
483					out0 = te_out;
484					${FRAGMENT_OUTPUT}
485				}
486			""
487		end
488
489		case input_superfluous_declaration
490			version 320 es
491			desc "Tessellation control has no input for an output"
492			values
493			{
494				input float in0 = 1.0;
495				output float out0 = 1.0;
496			}
497			vertex ""
498				#version 320 es
499				${VERTEX_DECLARATIONS}
500				out mediump float tc_in;
501				out mediump float tc_in_unused;
502				void main()
503				{
504					tc_in = in0;
505					tc_in_unused = in0 + 1.0;
506					${VERTEX_OUTPUT}
507				}
508			""
509			tessellation_control ""
510				#version 320 es
511				${TESSELLATION_CONTROL_DECLARATIONS}
512				in mediump float tc_in[];
513				out mediump float tc_out[];
514				void main()
515				{
516					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
517					${TESSELLATION_CONTROL_OUTPUT}
518				}
519			""
520			tessellation_evaluation ""
521				#version 320 es
522				${TESSELLATION_EVALUATION_DECLARATIONS}
523				in mediump float tc_out[];
524				out mediump float te_out;
525				void main()
526				{
527					te_out = tc_out[2];
528					${TESSELLATION_EVALUATION_OUTPUT}
529				}
530			""
531			fragment ""
532				#version 320 es
533				precision mediump float;
534				${FRAGMENT_DECLARATIONS}
535				in mediump float te_out;
536				void main()
537				{
538					out0 = te_out;
539					${FRAGMENT_OUTPUT}
540				}
541			""
542		end
543
544		case output_superfluous_declaration
545			version 320 es
546			desc "Tessellation has an output without a matching input"
547			values
548			{
549				input float in0 = 1.0;
550				output float out0 = 1.0;
551			}
552			vertex ""
553				#version 320 es
554				${VERTEX_DECLARATIONS}
555				out mediump float tc_in;
556				void main()
557				{
558					tc_in = in0;
559					${VERTEX_OUTPUT}
560				}
561			""
562			tessellation_control ""
563				#version 320 es
564				${TESSELLATION_CONTROL_DECLARATIONS}
565				in mediump float tc_in[];
566				out mediump float tc_out[];
567				void main()
568				{
569					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
570					${TESSELLATION_CONTROL_OUTPUT}
571				}
572			""
573			tessellation_evaluation ""
574				#version 320 es
575				${TESSELLATION_EVALUATION_DECLARATIONS}
576				in mediump float tc_out[];
577				out mediump float te_out;
578				out mediump float te_out_unused;
579				void main()
580				{
581					te_out = tc_out[2];
582					te_out_unused = tc_out[0];
583					${TESSELLATION_EVALUATION_OUTPUT}
584				}
585			""
586			fragment ""
587				#version 320 es
588				precision mediump float;
589				${FRAGMENT_DECLARATIONS}
590				in mediump float te_out;
591				void main()
592				{
593					out0 = te_out;
594					${FRAGMENT_OUTPUT}
595				}
596			""
597		end
598
599		case internal_superfluous_declaration
600			version 320 es
601			desc "Tessellation control has an output without a matching input"
602			values
603			{
604				input float in0 = 1.0;
605				output float out0 = 1.0;
606			}
607			vertex ""
608				#version 320 es
609				${VERTEX_DECLARATIONS}
610				out mediump float tc_in;
611				void main()
612				{
613					tc_in = in0;
614					${VERTEX_OUTPUT}
615				}
616			""
617			tessellation_control ""
618				#version 320 es
619				${TESSELLATION_CONTROL_DECLARATIONS}
620				in mediump float tc_in[];
621				out mediump float tc_out[];
622				out mediump float tc_out_unused[];
623				void main()
624				{
625					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
626					tc_out_unused[gl_InvocationID] = tc_in[gl_InvocationID] + 1.0;
627					${TESSELLATION_CONTROL_OUTPUT}
628				}
629			""
630			tessellation_evaluation ""
631				#version 320 es
632				${TESSELLATION_EVALUATION_DECLARATIONS}
633				in mediump float tc_out[];
634				out mediump float te_out;
635				void main()
636				{
637					te_out = tc_out[2];
638					${TESSELLATION_EVALUATION_OUTPUT}
639				}
640			""
641			fragment ""
642				#version 320 es
643				precision mediump float;
644				${FRAGMENT_DECLARATIONS}
645				in mediump float te_out;
646				void main()
647				{
648					out0 = te_out;
649					${FRAGMENT_OUTPUT}
650				}
651			""
652		end
653
654		case vertex_fragment_same_varying_name_1
655			version 320 es
656			desc "Tessellation control has an output without a matching input"
657			values
658			{
659				input float in0 = 1.0;
660				output float out0 = 2.0;
661			}
662			vertex ""
663				#version 320 es
664				${VERTEX_DECLARATIONS}
665				out mediump float sharedVaringName;
666				void main()
667				{
668					sharedVaringName = in0;
669					${VERTEX_OUTPUT}
670				}
671			""
672			tessellation_control ""
673				#version 320 es
674				${TESSELLATION_CONTROL_DECLARATIONS}
675				in mediump float sharedVaringName[];
676				out mediump float tc_out[];
677				void main()
678				{
679					tc_out[gl_InvocationID] = sharedVaringName[gl_InvocationID];
680					${TESSELLATION_CONTROL_OUTPUT}
681				}
682			""
683			tessellation_evaluation ""
684				#version 320 es
685				${TESSELLATION_EVALUATION_DECLARATIONS}
686				in mediump float tc_out[];
687				out mediump float sharedVaringName;
688				void main()
689				{
690					sharedVaringName = 2.0 * tc_out[2];
691					${TESSELLATION_EVALUATION_OUTPUT}
692				}
693			""
694			fragment ""
695				#version 320 es
696				precision mediump float;
697				${FRAGMENT_DECLARATIONS}
698				in mediump float sharedVaringName;
699				void main()
700				{
701					out0 = sharedVaringName;
702					${FRAGMENT_OUTPUT}
703				}
704			""
705		end
706
707		case vertex_fragment_same_varying_name_2
708			version 320 es
709			desc "Tessellation control has an output without a matching input"
710			values
711			{
712				input vec2 in0 = vec2(1.0, 3.0);
713				output float out0 = 4.0;
714			}
715			vertex ""
716				#version 320 es
717				${VERTEX_DECLARATIONS}
718				out mediump vec2 sharedVaringName;
719				void main()
720				{
721					sharedVaringName = in0;
722					${VERTEX_OUTPUT}
723				}
724			""
725			tessellation_control ""
726				#version 320 es
727				${TESSELLATION_CONTROL_DECLARATIONS}
728				in mediump vec2 sharedVaringName[];
729				out mediump float tc_out[];
730				void main()
731				{
732					tc_out[gl_InvocationID] = sharedVaringName[gl_InvocationID].x + sharedVaringName[gl_InvocationID].y;
733					${TESSELLATION_CONTROL_OUTPUT}
734				}
735			""
736			tessellation_evaluation ""
737				#version 320 es
738				${TESSELLATION_EVALUATION_DECLARATIONS}
739				in mediump float tc_out[];
740				out mediump float sharedVaringName;
741				void main()
742				{
743					sharedVaringName = tc_out[2];
744					${TESSELLATION_EVALUATION_OUTPUT}
745				}
746			""
747			fragment ""
748				#version 320 es
749				precision mediump float;
750				${FRAGMENT_DECLARATIONS}
751				in mediump float sharedVaringName;
752				void main()
753				{
754					out0 = sharedVaringName;
755					${FRAGMENT_OUTPUT}
756				}
757			""
758		end
759
760		case invalid_vertex_index
761			version 320 es
762			desc "Tessellation control output not indexed with gl_InvocationID"
763			expect compile_or_link_fail
764			vertex ""
765				#version 320 es
766				${VERTEX_DECLARATIONS}
767				void main()
768				{
769					${VERTEX_OUTPUT}
770				}
771			""
772			tessellation_control ""
773				#version 320 es
774				${TESSELLATION_CONTROL_DECLARATIONS}
775				out mediump float tc_out[];
776				void main()
777				{
778					tc_out[2 - gl_InvocationID] = float(gl_InvocationID);
779					${TESSELLATION_CONTROL_OUTPUT}
780				}
781			""
782			tessellation_evaluation ""
783				#version 320 es
784				${TESSELLATION_EVALUATION_DECLARATIONS}
785				in mediump float tc_out[];
786				out mediump float te_out;
787				void main()
788				{
789					te_out = tc_out[2];
790					${TESSELLATION_EVALUATION_OUTPUT}
791				}
792			""
793			fragment ""
794				#version 320 es
795				precision mediump float;
796				${FRAGMENT_DECLARATIONS}
797				in mediump float te_out;
798				void main()
799				{
800					${FRAG_COLOR} = vec4(te_out);
801				}
802			""
803		end
804
805		case input_non_array
806			version 320 es
807			desc "Tessellation control input in not an array"
808			expect compile_or_link_fail
809			values
810			{
811				input float in0 = 1.0;
812				output float out0 = 1.0;
813			}
814			vertex ""
815				#version 320 es
816				${VERTEX_DECLARATIONS}
817				out mediump float tc_in;
818				void main()
819				{
820					tc_in = in0;
821					${VERTEX_OUTPUT}
822				}
823			""
824			tessellation_control ""
825				#version 320 es
826				${TESSELLATION_CONTROL_DECLARATIONS}
827				in mediump float tc_in;
828				out mediump float tc_out[];
829				void main()
830				{
831					tc_out[gl_InvocationID] = tc_in;
832					${TESSELLATION_CONTROL_OUTPUT}
833				}
834			""
835			tessellation_evaluation ""
836				#version 320 es
837				${TESSELLATION_EVALUATION_DECLARATIONS}
838				in mediump float tc_out[];
839				out mediump float te_out;
840				void main()
841				{
842					te_out = tc_out[2];
843					${TESSELLATION_EVALUATION_OUTPUT}
844				}
845			""
846			fragment ""
847				#version 320 es
848				precision mediump float;
849				${FRAGMENT_DECLARATIONS}
850				in mediump float te_out;
851				void main()
852				{
853					out0 = te_out;
854					${FRAGMENT_OUTPUT}
855				}
856			""
857		end
858
859		case input_array_size_mismatch
860			version 320 es
861			desc "Tessellation control input array size is not gl_MaxPatchVertices"
862			expect compile_or_link_fail
863			values
864			{
865				input float in0 = 1.0;
866				output float out0 = 1.0;
867			}
868			vertex ""
869				#version 320 es
870				${VERTEX_DECLARATIONS}
871				out mediump float tc_in;
872				void main()
873				{
874					tc_in = in0;
875					${VERTEX_OUTPUT}
876				}
877			""
878			tessellation_control ""
879				#version 320 es
880				${TESSELLATION_CONTROL_DECLARATIONS}
881				in mediump float tc_in[2]; // not gl_MaxPatchVertices
882				out mediump float tc_out[];
883				void main()
884				{
885					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
886					${TESSELLATION_CONTROL_OUTPUT}
887				}
888			""
889			tessellation_evaluation ""
890				#version 320 es
891				${TESSELLATION_EVALUATION_DECLARATIONS}
892				in mediump float tc_out[];
893				out mediump float te_out;
894				void main()
895				{
896					te_out = tc_out[2];
897					${TESSELLATION_EVALUATION_OUTPUT}
898				}
899			""
900			fragment ""
901				#version 320 es
902				precision mediump float;
903				${FRAGMENT_DECLARATIONS}
904				in mediump float te_out;
905				void main()
906				{
907					out0 = te_out;
908					${FRAGMENT_OUTPUT}
909				}
910			""
911		end
912
913		case internal_array_size_mismatch
914			version 320 es
915			desc "Tessellation control output array size is not consistent with layout qualifier"
916			expect compile_or_link_fail
917			values
918			{
919				input float in0 = 1.0;
920				output float out0 = 1.0;
921			}
922			vertex ""
923				#version 320 es
924				${VERTEX_DECLARATIONS}
925				out mediump float tc_in;
926				void main()
927				{
928					tc_in = in0;
929					${VERTEX_OUTPUT}
930				}
931			""
932			tessellation_control ""
933				#version 320 es
934				${TESSELLATION_CONTROL_DECLARATIONS}
935				in mediump float tc_in[];
936				out mediump float tc_out[2]; // does not match output layout qualifier
937				void main()
938				{
939					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
940					${TESSELLATION_CONTROL_OUTPUT}
941				}
942			""
943			tessellation_evaluation ""
944				#version 320 es
945				${TESSELLATION_EVALUATION_DECLARATIONS}
946				in mediump float tc_out[2];
947				out mediump float te_out;
948				void main()
949				{
950					te_out = tc_out[1];
951					${TESSELLATION_EVALUATION_OUTPUT}
952				}
953			""
954			fragment ""
955				#version 320 es
956				precision mediump float;
957				${FRAGMENT_DECLARATIONS}
958				in mediump float te_out;
959				void main()
960				{
961					out0 = te_out;
962					${FRAGMENT_OUTPUT}
963				}
964			""
965		end
966
967		case per_patch_qualifier_mismatch_1
968			version 320 es
969			desc "Tessellation control output is per-patch qualified, evaluation input is not"
970			expect compile_or_link_fail
971			values
972			{
973				input float in0 = 1.0;
974				output float out0 = 1.0;
975			}
976			vertex ""
977				#version 320 es
978				${VERTEX_DECLARATIONS}
979				out mediump float tc_in;
980				void main()
981				{
982					tc_in = in0;
983					${VERTEX_OUTPUT}
984				}
985			""
986			tessellation_control ""
987				#version 320 es
988				${TESSELLATION_CONTROL_DECLARATIONS}
989				in mediump float tc_in[];
990				patch out mediump float tc_out[gl_MaxPatchVertices];
991				void main()
992				{
993					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
994					${TESSELLATION_CONTROL_OUTPUT}
995				}
996			""
997			tessellation_evaluation ""
998				#version 320 es
999				${TESSELLATION_EVALUATION_DECLARATIONS}
1000				in mediump float tc_out[gl_MaxPatchVertices];
1001				out mediump float te_out;
1002				void main()
1003				{
1004					te_out = tc_out[2];
1005					${TESSELLATION_EVALUATION_OUTPUT}
1006				}
1007			""
1008			fragment ""
1009				#version 320 es
1010				precision mediump float;
1011				${FRAGMENT_DECLARATIONS}
1012				in mediump float te_out;
1013				void main()
1014				{
1015					out0 = te_out;
1016					${FRAGMENT_OUTPUT}
1017				}
1018			""
1019		end
1020
1021		case per_patch_qualifier_mismatch_2
1022			version 320 es
1023			desc "Tessellation control output is not per-patch qualified, evaluation input is"
1024			expect compile_or_link_fail
1025			values
1026			{
1027				input float in0 = 1.0;
1028				output float out0 = 1.0;
1029			}
1030			vertex ""
1031				#version 320 es
1032				${VERTEX_DECLARATIONS}
1033				out mediump float tc_in;
1034				void main()
1035				{
1036					tc_in = in0;
1037					${VERTEX_OUTPUT}
1038				}
1039			""
1040			tessellation_control ""
1041				#version 320 es
1042				${TESSELLATION_CONTROL_DECLARATIONS}
1043				in mediump float tc_in[];
1044				out mediump float tc_out[gl_MaxPatchVertices];
1045				void main()
1046				{
1047					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
1048					${TESSELLATION_CONTROL_OUTPUT}
1049				}
1050			""
1051			tessellation_evaluation ""
1052				#version 320 es
1053				${TESSELLATION_EVALUATION_DECLARATIONS}
1054				patch in mediump float tc_out[gl_MaxPatchVertices];
1055				out mediump float te_out;
1056				void main()
1057				{
1058					te_out = tc_out[2];
1059					${TESSELLATION_EVALUATION_OUTPUT}
1060				}
1061			""
1062			fragment ""
1063				#version 320 es
1064				precision mediump float;
1065				${FRAGMENT_DECLARATIONS}
1066				in mediump float te_out;
1067				void main()
1068				{
1069					out0 = te_out;
1070					${FRAGMENT_OUTPUT}
1071				}
1072			""
1073		end
1074
1075		case input_block
1076			version 320 es
1077			desc "Tessellation control shader input block"
1078			values { output float out0 = 1.0; }
1079			vertex ""
1080				#version 320 es
1081				${VERTEX_DECLARATIONS}
1082				out IOBlockName
1083				{
1084					mediump float var;
1085				} outputInstanceName;
1086				void main()
1087				{
1088					outputInstanceName.var = 1.0;
1089					${VERTEX_OUTPUT}
1090				}
1091			""
1092			tessellation_control ""
1093				#version 320 es
1094				${TESSELLATION_CONTROL_DECLARATIONS}
1095				in IOBlockName
1096				{
1097					mediump float var;
1098				} inputInstanceName[];
1099				out mediump float tc_out[];
1100				void main()
1101				{
1102					tc_out[gl_InvocationID] = inputInstanceName[gl_InvocationID].var;
1103					${TESSELLATION_CONTROL_OUTPUT}
1104				}
1105			""
1106			tessellation_evaluation ""
1107				#version 320 es
1108				${TESSELLATION_EVALUATION_DECLARATIONS}
1109				in mediump float tc_out[];
1110				out mediump float te_out;
1111				void main()
1112				{
1113					te_out = tc_out[2];
1114					${TESSELLATION_EVALUATION_OUTPUT}
1115				}
1116			""
1117			fragment ""
1118				#version 320 es
1119				precision mediump float;
1120				${FRAGMENT_DECLARATIONS}
1121				in mediump float te_out;
1122				void main()
1123				{
1124					out0 = te_out;
1125					${FRAGMENT_OUTPUT}
1126				}
1127			""
1128		end
1129
1130		case input_block_non_array
1131			version 320 es
1132			desc "Tessellation control shader input block with explicit array"
1133			expect compile_or_link_fail
1134			values { output float out0 = 1.0; }
1135			vertex ""
1136				#version 320 es
1137				${VERTEX_DECLARATIONS}
1138				out IOBlockName
1139				{
1140					mediump float var;
1141				} outputInstanceName;
1142				void main()
1143				{
1144					outputInstanceName.var = 1.0;
1145					${VERTEX_OUTPUT}
1146				}
1147			""
1148			tessellation_control ""
1149				#version 320 es
1150				${TESSELLATION_CONTROL_DECLARATIONS}
1151				in IOBlockName
1152				{
1153					mediump float var;
1154				} inputInstanceName;
1155				out mediump float tc_out[];
1156				void main()
1157				{
1158					tc_out[gl_InvocationID] = inputInstanceName.var;
1159					${TESSELLATION_CONTROL_OUTPUT}
1160				}
1161			""
1162			tessellation_evaluation ""
1163				#version 320 es
1164				${TESSELLATION_EVALUATION_DECLARATIONS}
1165				in mediump float tc_out[];
1166				out mediump float te_out;
1167				void main()
1168				{
1169					te_out = tc_out[2];
1170					${TESSELLATION_EVALUATION_OUTPUT}
1171				}
1172			""
1173			fragment ""
1174				#version 320 es
1175				precision mediump float;
1176				${FRAGMENT_DECLARATIONS}
1177				in mediump float geo_out;
1178				void main()
1179				{
1180					out0 = geo_out;
1181					${FRAGMENT_OUTPUT}
1182				}
1183			""
1184		end
1185
1186		case input_block_array_size_mismatch
1187			version 320 es
1188			desc "Tessellation control shader input block array, size not gl_MaxPatchVertices"
1189			expect compile_or_link_fail
1190			values { output float out0 = 1.0; }
1191			vertex ""
1192				#version 320 es
1193				${VERTEX_DECLARATIONS}
1194				out IOBlockName
1195				{
1196					mediump float var;
1197				} outputInstanceName;
1198				void main()
1199				{
1200					outputInstanceName.var = 1.0;
1201					${VERTEX_OUTPUT}
1202				}
1203			""
1204			tessellation_control ""
1205				#version 320 es
1206				${TESSELLATION_CONTROL_DECLARATIONS}
1207				in IOBlockName
1208				{
1209					mediump float var;
1210				} inputInstanceName[4]; // not gl_MaxPatchVertices
1211				out mediump float tc_out[];
1212				void main()
1213				{
1214					tc_out[gl_InvocationID] = inputInstanceName[gl_InvocationID + 1].var;
1215					${TESSELLATION_CONTROL_OUTPUT}
1216				}
1217			""
1218			tessellation_evaluation ""
1219				#version 320 es
1220				${TESSELLATION_EVALUATION_DECLARATIONS}
1221				in mediump float tc_out[];
1222				out mediump float te_out;
1223				void main()
1224				{
1225					te_out = tc_out[2];
1226					${TESSELLATION_EVALUATION_OUTPUT}
1227				}
1228			""
1229			fragment ""
1230				#version 320 es
1231				precision mediump float;
1232				${FRAGMENT_DECLARATIONS}
1233				in mediump float geo_out;
1234				void main()
1235				{
1236					out0 = geo_out;
1237					${FRAGMENT_OUTPUT}
1238				}
1239			""
1240		end
1241
1242		case output_block
1243			version 320 es
1244			desc "Tessellation shader output block"
1245			values { output float out0 = 1.0; }
1246			vertex ""
1247				#version 320 es
1248				${VERTEX_DECLARATIONS}
1249				void main()
1250				{
1251					${VERTEX_OUTPUT}
1252				}
1253			""
1254			tessellation_control ""
1255				#version 320 es
1256				${TESSELLATION_CONTROL_DECLARATIONS}
1257				void main()
1258				{
1259					${TESSELLATION_CONTROL_OUTPUT}
1260				}
1261			""
1262			tessellation_evaluation ""
1263				#version 320 es
1264				${TESSELLATION_EVALUATION_DECLARATIONS}
1265				out IOBlockName
1266				{
1267					mediump float var;
1268				} outputInstanceName;
1269				void main()
1270				{
1271					outputInstanceName.var = 1.0;
1272					${TESSELLATION_EVALUATION_OUTPUT}
1273				}
1274			""
1275			fragment ""
1276				#version 320 es
1277				precision mediump float;
1278				${FRAGMENT_DECLARATIONS}
1279				in IOBlockName
1280				{
1281					mediump float var;
1282				} inputInstanceName;
1283				void main()
1284				{
1285					out0 = inputInstanceName.var;
1286					${FRAGMENT_OUTPUT}
1287				}
1288			""
1289		end
1290
1291		case output_block_array
1292			version 320 es
1293			desc "Tessellation shader output block array"
1294			values { output float out0 = 1.0; }
1295			vertex ""
1296				#version 320 es
1297				${VERTEX_DECLARATIONS}
1298				void main()
1299				{
1300					${VERTEX_OUTPUT}
1301				}
1302			""
1303			tessellation_control ""
1304				#version 320 es
1305				${TESSELLATION_CONTROL_DECLARATIONS}
1306				void main()
1307				{
1308					${TESSELLATION_CONTROL_OUTPUT}
1309				}
1310			""
1311			tessellation_evaluation ""
1312				#version 320 es
1313				${TESSELLATION_EVALUATION_DECLARATIONS}
1314				out IOBlockName
1315				{
1316					mediump float var;
1317				} outputInstanceName[2];
1318				void main()
1319				{
1320					outputInstanceName[0].var = 2.0;
1321					outputInstanceName[1].var = 1.0;
1322					${TESSELLATION_EVALUATION_OUTPUT}
1323				}
1324			""
1325			fragment ""
1326				#version 320 es
1327				precision mediump float;
1328				${FRAGMENT_DECLARATIONS}
1329				in IOBlockName
1330				{
1331					mediump float var;
1332				} inputInstanceName[2];
1333				void main()
1334				{
1335					out0 = inputInstanceName[0].var - inputInstanceName[1].var;
1336					${FRAGMENT_OUTPUT}
1337				}
1338			""
1339		end
1340
1341		case unspecified_vertex_count
1342			version 320 es
1343			desc "Tessellation shader unspecified vertex count"
1344			expect compile_or_link_fail
1345			vertex ""
1346				#version 320 es
1347				${VERTEX_DECLARATIONS}
1348				void main()
1349				{
1350					${VERTEX_OUTPUT}
1351				}
1352			""
1353			tessellation_control ""
1354				#version 320 es
1355				void main()
1356				{
1357					${TESSELLATION_CONTROL_OUTPUT}
1358				}
1359			""
1360			tessellation_evaluation ""
1361				#version 320 es
1362				${TESSELLATION_EVALUATION_DECLARATIONS}
1363				void main()
1364				{
1365					${TESSELLATION_EVALUATION_OUTPUT}
1366				}
1367			""
1368			fragment ""
1369				#version 320 es
1370				precision mediump float;
1371				${FRAGMENT_DECLARATIONS}
1372				void main()
1373				{
1374					${FRAGMENT_OUTPUT}
1375				}
1376			""
1377		end
1378
1379		case unspecified_primitive_mode
1380			version 320 es
1381			desc "Tessellation shader unspecified vertex count"
1382			expect compile_or_link_fail
1383			vertex ""
1384				#version 320 es
1385				${VERTEX_DECLARATIONS}
1386				void main()
1387				{
1388					${VERTEX_OUTPUT}
1389				}
1390			""
1391			tessellation_control ""
1392				#version 320 es
1393				${TESSELLATION_CONTROL_DECLARATIONS}
1394				void main()
1395				{
1396					${TESSELLATION_CONTROL_OUTPUT}
1397				}
1398			""
1399			tessellation_evaluation ""
1400				#version 320 es
1401				void main()
1402				{
1403					${TESSELLATION_EVALUATION_OUTPUT}
1404				}
1405			""
1406			fragment ""
1407				#version 320 es
1408				precision mediump float;
1409				${FRAGMENT_DECLARATIONS}
1410				void main()
1411				{
1412					${FRAGMENT_OUTPUT}
1413				}
1414			""
1415		end
1416	end
1417
1418	group qualifiers "Varying qualifiers"
1419		case smooth
1420			version 320 es
1421			desc "Smooth varying"
1422			values
1423			{
1424				input float in0 = 1.0;
1425				output float out0 = 1.0;
1426			}
1427			vertex ""
1428				#version 320 es
1429				${VERTEX_DECLARATIONS}
1430				smooth out mediump float tc_in;
1431				void main()
1432				{
1433					tc_in = in0;
1434					${VERTEX_OUTPUT}
1435				}
1436			""
1437			tessellation_control ""
1438				#version 320 es
1439				${TESSELLATION_CONTROL_DECLARATIONS}
1440				smooth in mediump float tc_in[];
1441				smooth out mediump float tc_out[];
1442				void main()
1443				{
1444					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
1445					${TESSELLATION_CONTROL_OUTPUT}
1446				}
1447			""
1448			tessellation_evaluation ""
1449				#version 320 es
1450				${TESSELLATION_EVALUATION_DECLARATIONS}
1451				smooth in mediump float tc_out[];
1452				smooth out mediump float te_out;
1453				void main()
1454				{
1455					te_out = tc_out[2];
1456					${TESSELLATION_EVALUATION_OUTPUT}
1457				}
1458			""
1459			fragment ""
1460				#version 320 es
1461				precision mediump float;
1462				${FRAGMENT_DECLARATIONS}
1463				smooth in mediump float te_out;
1464				void main()
1465				{
1466					out0 = te_out;
1467					${FRAGMENT_OUTPUT}
1468				}
1469			""
1470		end
1471
1472		case flat
1473			version 320 es
1474			desc "Flat varying"
1475			values
1476			{
1477				input float in0 = 1.0;
1478				output float out0 = 1.0;
1479			}
1480			vertex ""
1481				#version 320 es
1482				${VERTEX_DECLARATIONS}
1483				flat out mediump float tc_in;
1484				void main()
1485				{
1486					tc_in = in0;
1487					${VERTEX_OUTPUT}
1488				}
1489			""
1490			tessellation_control ""
1491				#version 320 es
1492				${TESSELLATION_CONTROL_DECLARATIONS}
1493				flat in mediump float tc_in[];
1494				flat out mediump float tc_out[];
1495				void main()
1496				{
1497					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
1498					${TESSELLATION_CONTROL_OUTPUT}
1499				}
1500			""
1501			tessellation_evaluation ""
1502				#version 320 es
1503				${TESSELLATION_EVALUATION_DECLARATIONS}
1504				flat in mediump float tc_out[];
1505				flat out mediump float te_out;
1506				void main()
1507				{
1508					te_out = tc_out[2];
1509					${TESSELLATION_EVALUATION_OUTPUT}
1510				}
1511			""
1512			fragment ""
1513				#version 320 es
1514				precision mediump float;
1515				${FRAGMENT_DECLARATIONS}
1516				flat in mediump float te_out;
1517				void main()
1518				{
1519					out0 = te_out;
1520					${FRAGMENT_OUTPUT}
1521				}
1522			""
1523		end
1524
1525		case centroid
1526			version 320 es
1527			desc "Centroid varying"
1528			values
1529			{
1530				input float in0 = 1.0;
1531				output float out0 = 1.0;
1532			}
1533			vertex ""
1534				#version 320 es
1535				${VERTEX_DECLARATIONS}
1536				centroid out mediump float tc_in;
1537				void main()
1538				{
1539					tc_in = in0;
1540					${VERTEX_OUTPUT}
1541				}
1542			""
1543			tessellation_control ""
1544				#version 320 es
1545				${TESSELLATION_CONTROL_DECLARATIONS}
1546				centroid in mediump float tc_in[];
1547				centroid out mediump float tc_out[];
1548				void main()
1549				{
1550					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
1551					${TESSELLATION_CONTROL_OUTPUT}
1552				}
1553			""
1554			tessellation_evaluation ""
1555				#version 320 es
1556				${TESSELLATION_EVALUATION_DECLARATIONS}
1557				centroid in mediump float tc_out[];
1558				centroid out mediump float te_out;
1559				void main()
1560				{
1561					te_out = tc_out[2];
1562					${TESSELLATION_EVALUATION_OUTPUT}
1563				}
1564			""
1565			fragment ""
1566				#version 320 es
1567				precision mediump float;
1568				${FRAGMENT_DECLARATIONS}
1569				centroid in mediump float te_out;
1570				void main()
1571				{
1572					out0 = te_out;
1573					${FRAGMENT_OUTPUT}
1574				}
1575			""
1576		end
1577
1578		case sample
1579			version 320 es
1580			desc "Sample varying"
1581			values
1582			{
1583				input float in0 = 1.0;
1584				output float out0 = 1.0;
1585			}
1586			vertex ""
1587				#version 320 es
1588				${VERTEX_DECLARATIONS}
1589				sample out mediump float tc_in;
1590				void main()
1591				{
1592					tc_in = in0;
1593					${VERTEX_OUTPUT}
1594				}
1595			""
1596			tessellation_control ""
1597				#version 320 es
1598				${TESSELLATION_CONTROL_DECLARATIONS}
1599				sample in mediump float tc_in[];
1600				sample out mediump float tc_out[];
1601				void main()
1602				{
1603					tc_out[gl_InvocationID] = tc_in[gl_InvocationID];
1604					${TESSELLATION_CONTROL_OUTPUT}
1605				}
1606			""
1607			tessellation_evaluation ""
1608				#version 320 es
1609				${TESSELLATION_EVALUATION_DECLARATIONS}
1610				sample in mediump float tc_out[];
1611				sample out mediump float te_out;
1612				void main()
1613				{
1614					te_out = tc_out[2];
1615					${TESSELLATION_EVALUATION_OUTPUT}
1616				}
1617			""
1618			fragment ""
1619				#version 320 es
1620				precision mediump float;
1621				${FRAGMENT_DECLARATIONS}
1622				sample in mediump float te_out;
1623				void main()
1624				{
1625					out0 = te_out;
1626					${FRAGMENT_OUTPUT}
1627				}
1628			""
1629		end
1630
1631		case patch
1632			version 320 es
1633			desc "Pre-patch varying"
1634			values
1635			{
1636				input float in0 = 1.0;
1637				output float out0 = 1.0;
1638			}
1639			vertex ""
1640				#version 320 es
1641				${VERTEX_DECLARATIONS}
1642				out mediump float tc_in;
1643				void main()
1644				{
1645					tc_in = in0;
1646					${VERTEX_OUTPUT}
1647				}
1648			""
1649			tessellation_control ""
1650				#version 320 es
1651				${TESSELLATION_CONTROL_DECLARATIONS}
1652				in mediump float tc_in[];
1653				patch out mediump float tc_out;
1654				void main()
1655				{
1656					tc_out = tc_in[gl_InvocationID];
1657					${TESSELLATION_CONTROL_OUTPUT}
1658				}
1659			""
1660			tessellation_evaluation ""
1661				#version 320 es
1662				${TESSELLATION_EVALUATION_DECLARATIONS}
1663				patch in mediump float tc_out;
1664				out mediump float te_out;
1665				void main()
1666				{
1667					te_out = tc_out;
1668					${TESSELLATION_EVALUATION_OUTPUT}
1669				}
1670			""
1671			fragment ""
1672				#version 320 es
1673				precision mediump float;
1674				${FRAGMENT_DECLARATIONS}
1675				in mediump float te_out;
1676				void main()
1677				{
1678					out0 = te_out;
1679					${FRAGMENT_OUTPUT}
1680				}
1681			""
1682		end
1683	end
1684
1685	import "linkage_tessellation_varying_types.test"
1686end
1687
1688group uniform "Uniform"
1689	group rules "Rules"
1690		case type_mismatch_1
1691			version 320 es
1692			desc "uniform type mismatch between vertex and tessellation control shaders"
1693			expect link_fail
1694			vertex ""
1695				#version 320 es
1696				${VERTEX_DECLARATIONS}
1697				uniform mediump float val;
1698				out mediump float vtx_out;
1699				void main()
1700				{
1701					vtx_out = val;
1702					${VERTEX_OUTPUT}
1703				}
1704			""
1705			tessellation_control ""
1706				#version 320 es
1707				${TESSELLATION_CONTROL_DECLARATIONS}
1708				uniform mediump vec2 val;
1709				in mediump float vtx_out[];
1710				out mediump float tc_out[];
1711				void main()
1712				{
1713					tc_out[gl_InvocationID] = vtx_out[0] + val.x + val.y;
1714					${TESSELLATION_CONTROL_OUTPUT}
1715				}
1716			""
1717			tessellation_evaluation ""
1718				#version 320 es
1719				${TESSELLATION_EVALUATION_DECLARATIONS}
1720				in mediump float tc_out[];
1721				out mediump float te_out;
1722				void main()
1723				{
1724					te_out = tc_out[2];
1725					${TESSELLATION_EVALUATION_OUTPUT}
1726				}
1727			""
1728			fragment ""
1729				#version 320 es
1730				precision mediump float;
1731				${FRAGMENT_DECLARATIONS}
1732				in mediump float te_out;
1733				void main()
1734				{
1735					${FRAG_COLOR} = vec4(te_out);
1736				}
1737			""
1738		end
1739
1740		case type_mismatch_2
1741			version 320 es
1742			desc "uniform type mismatch between fragment and tessellation eval shaders"
1743			expect link_fail
1744			vertex ""
1745				#version 320 es
1746				${VERTEX_DECLARATIONS}
1747				out mediump float vtx_out;
1748				void main()
1749				{
1750					${VERTEX_OUTPUT}
1751				}
1752			""
1753			tessellation_control ""
1754				#version 320 es
1755				${TESSELLATION_CONTROL_DECLARATIONS}
1756				void main()
1757				{
1758					${TESSELLATION_CONTROL_OUTPUT}
1759				}
1760			""
1761			tessellation_evaluation ""
1762				#version 320 es
1763				${TESSELLATION_EVALUATION_DECLARATIONS}
1764				uniform mediump vec3 val;
1765				out mediump float te_out;
1766				void main()
1767				{
1768					te_out = val.x + val.y + val.z;
1769					${TESSELLATION_EVALUATION_OUTPUT}
1770				}
1771			""
1772			fragment ""
1773				#version 320 es
1774				precision mediump float;
1775				${FRAGMENT_DECLARATIONS}
1776				uniform mediump vec4 val;
1777				in mediump float te_out;
1778				void main()
1779				{
1780					${FRAG_COLOR} = vec4(te_out) + val;
1781				}
1782			""
1783		end
1784
1785		case type_mismatch_3
1786			version 320 es
1787			desc "uniform type mismatch between tessellation control and eval shaders"
1788			expect link_fail
1789			vertex ""
1790				#version 320 es
1791				${VERTEX_DECLARATIONS}
1792				out mediump float vtx_out;
1793				void main()
1794				{
1795					${VERTEX_OUTPUT}
1796				}
1797			""
1798			tessellation_control ""
1799				#version 320 es
1800				${TESSELLATION_CONTROL_DECLARATIONS}
1801				uniform mediump vec4 val;
1802				out mediump vec4 tc_out[];
1803				void main()
1804				{
1805					tc_out[gl_InvocationID] = val;
1806					${TESSELLATION_CONTROL_OUTPUT}
1807				}
1808			""
1809			tessellation_evaluation ""
1810				#version 320 es
1811				${TESSELLATION_EVALUATION_DECLARATIONS}
1812				uniform mediump vec3 val;
1813				in mediump vec4 tc_out[];
1814				out mediump float te_out;
1815				void main()
1816				{
1817					te_out = tc_out[0].w * val.z;
1818					${TESSELLATION_EVALUATION_OUTPUT}
1819				}
1820			""
1821			fragment ""
1822				#version 320 es
1823				precision mediump float;
1824				${FRAGMENT_DECLARATIONS}
1825				in mediump float te_out;
1826				void main()
1827				{
1828					${FRAG_COLOR} = vec4(te_out);
1829				}
1830			""
1831		end
1832
1833		case type_mismatch_4
1834			version 320 es
1835			desc "uniform type mismatch between vertex and tessellation control shaders"
1836			expect link_fail
1837			require limit "GL_MAX_VERTEX_ATOMIC_COUNTERS" > 0
1838			vertex ""
1839				#version 320 es
1840				${VERTEX_DECLARATIONS}
1841				layout(binding=0) uniform atomic_uint u_var;
1842				out mediump float vtx_out;
1843				void main()
1844				{
1845					uint result = atomicCounterIncrement(u_var);
1846					vtx_out = float(result);
1847					${VERTEX_OUTPUT}
1848				}
1849			""
1850			tessellation_control ""
1851				#version 320 es
1852				${TESSELLATION_CONTROL_DECLARATIONS}
1853				uniform mediump float u_var;
1854				in mediump float vtx_out[];
1855				out mediump float tc_out[];
1856				void main()
1857				{
1858					tc_out[gl_InvocationID] = vtx_out[0] + u_var;
1859					${TESSELLATION_CONTROL_OUTPUT}
1860				}
1861			""
1862			tessellation_evaluation ""
1863				#version 320 es
1864				${TESSELLATION_EVALUATION_DECLARATIONS}
1865				in mediump float tc_out[];
1866				out mediump float te_out;
1867				void main()
1868				{
1869					te_out = tc_out[2];
1870					${TESSELLATION_EVALUATION_OUTPUT}
1871				}
1872			""
1873			fragment ""
1874				#version 320 es
1875				precision mediump float;
1876				${FRAGMENT_DECLARATIONS}
1877				in mediump float te_out;
1878				void main()
1879				{
1880					${FRAG_COLOR} = vec4(te_out);
1881				}
1882			""
1883		end
1884
1885		case type_mismatch_5
1886			version 320 es
1887			desc "uniform type mismatch between vertex and tessellation control shaders"
1888			expect link_fail
1889			require limit "GL_MAX_VERTEX_IMAGE_UNIFORMS" > 0
1890			vertex ""
1891				#version 320 es
1892				${VERTEX_DECLARATIONS}
1893				layout(binding=0) layout(rgba8i) uniform readonly highp iimage2D u_var;
1894				out mediump float vtx_out;
1895				void main()
1896				{
1897					int result = imageSize(u_var).x;
1898					vtx_out = float(result);
1899					${VERTEX_OUTPUT}
1900				}
1901			""
1902			tessellation_control ""
1903				#version 320 es
1904				${TESSELLATION_CONTROL_DECLARATIONS}
1905				uniform mediump float u_var;
1906				in mediump float vtx_out[];
1907				out mediump float tc_out[];
1908				void main()
1909				{
1910					tc_out[gl_InvocationID] = vtx_out[0] + u_var;
1911					${TESSELLATION_CONTROL_OUTPUT}
1912				}
1913			""
1914			tessellation_evaluation ""
1915				#version 320 es
1916				${TESSELLATION_EVALUATION_DECLARATIONS}
1917				in mediump float tc_out[];
1918				out mediump float te_out;
1919				void main()
1920				{
1921					te_out = tc_out[2];
1922					${TESSELLATION_EVALUATION_OUTPUT}
1923				}
1924			""
1925			fragment ""
1926				#version 320 es
1927				precision mediump float;
1928				${FRAGMENT_DECLARATIONS}
1929				in mediump float te_out;
1930				void main()
1931				{
1932					${FRAG_COLOR} = vec4(te_out);
1933				}
1934			""
1935		end
1936
1937		case precision_mismatch_1
1938			version 320 es
1939			desc "uniform precision mismatch between tessellation control and eval shaders"
1940			expect link_fail
1941			vertex ""
1942				#version 320 es
1943				${VERTEX_DECLARATIONS}
1944				out mediump float vtx_out;
1945				void main()
1946				{
1947					${VERTEX_OUTPUT}
1948				}
1949			""
1950			tessellation_control ""
1951				#version 320 es
1952				${TESSELLATION_CONTROL_DECLARATIONS}
1953				uniform mediump vec4 val;
1954				out mediump vec4 tc_out[];
1955				void main()
1956				{
1957					tc_out[gl_InvocationID] = val;
1958					${TESSELLATION_CONTROL_OUTPUT}
1959				}
1960			""
1961			tessellation_evaluation ""
1962				#version 320 es
1963				${TESSELLATION_EVALUATION_DECLARATIONS}
1964				uniform highp vec4 val;
1965				in mediump vec4 tc_out[];
1966				out mediump float te_out;
1967				void main()
1968				{
1969					te_out = tc_out[0].w * val.z;
1970					${TESSELLATION_EVALUATION_OUTPUT}
1971				}
1972			""
1973			fragment ""
1974				#version 320 es
1975				precision mediump float;
1976				${FRAGMENT_DECLARATIONS}
1977				in mediump float te_out;
1978				void main()
1979				{
1980					${FRAG_COLOR} = vec4(te_out);
1981				}
1982			""
1983		end
1984
1985		case precision_mismatch_2
1986			version 320 es
1987			desc "uniform precision mismatch between vertex and tessellation control shaders"
1988			expect link_fail
1989			vertex ""
1990				#version 320 es
1991				${VERTEX_DECLARATIONS}
1992				uniform highp float val;
1993				out mediump float vtx_out;
1994				void main()
1995				{
1996					vtx_out = val;
1997					${VERTEX_OUTPUT}
1998				}
1999			""
2000			tessellation_control ""
2001				#version 320 es
2002				${TESSELLATION_CONTROL_DECLARATIONS}
2003				uniform mediump float val;
2004				in mediump float vtx_out[];
2005				out mediump float tc_out[];
2006				void main()
2007				{
2008					tc_out[gl_InvocationID] = vtx_out[0] + val;
2009					${TESSELLATION_CONTROL_OUTPUT}
2010				}
2011			""
2012			tessellation_evaluation ""
2013				#version 320 es
2014				${TESSELLATION_EVALUATION_DECLARATIONS}
2015				in mediump float tc_out[];
2016				out mediump float te_out;
2017				void main()
2018				{
2019					te_out = tc_out[2];
2020					${TESSELLATION_EVALUATION_OUTPUT}
2021				}
2022			""
2023			fragment ""
2024				#version 320 es
2025				precision mediump float;
2026				${FRAGMENT_DECLARATIONS}
2027				in mediump float te_out;
2028				void main()
2029				{
2030					${FRAG_COLOR} = vec4(te_out);
2031				}
2032			""
2033		end
2034
2035		case struct_partial_usage
2036			version 320 es
2037			desc "uniform is partially used in different shader stages"
2038			values
2039			{
2040				uniform float val.vtxVal		= 1.5;
2041				uniform float val.tcVal		= 2.5;
2042				uniform float val.teVal		= 6.0;
2043				uniform float val.fragVal	= 11.0;
2044				output float out0			= 68.5;
2045			}
2046			vertex ""
2047				#version 320 es
2048				${VERTEX_DECLARATIONS}
2049				struct S
2050				{
2051					mediump float vtxVal;
2052					mediump float tcVal;
2053					mediump float teVal;
2054					mediump float fragVal;
2055				};
2056				uniform S val;
2057				out mediump float vtx_out;
2058				void main()
2059				{
2060					vtx_out = val.vtxVal;
2061					${VERTEX_OUTPUT}
2062				}
2063			""
2064			tessellation_control ""
2065				#version 320 es
2066				${TESSELLATION_CONTROL_DECLARATIONS}
2067				struct S
2068				{
2069					mediump float vtxVal;
2070					mediump float tcVal;
2071					mediump float teVal;
2072					mediump float fragVal;
2073				};
2074				uniform S val;
2075				in mediump float vtx_out[];
2076				out mediump float tc_out[];
2077				void main()
2078				{
2079					tc_out[gl_InvocationID] = vtx_out[0] + 2.0 * val.tcVal;
2080					${TESSELLATION_CONTROL_OUTPUT}
2081				}
2082			""
2083			tessellation_evaluation ""
2084				#version 320 es
2085				${TESSELLATION_EVALUATION_DECLARATIONS}
2086				struct S
2087				{
2088					mediump float vtxVal;
2089					mediump float tcVal;
2090					mediump float teVal;
2091					mediump float fragVal;
2092				};
2093				uniform S val;
2094				in mediump float tc_out[];
2095				out mediump float te_out;
2096				void main()
2097				{
2098					te_out = tc_out[2] + 3.0 * val.teVal;
2099					${TESSELLATION_EVALUATION_OUTPUT}
2100				}
2101			""
2102			fragment ""
2103				#version 320 es
2104				precision mediump float;
2105				${FRAGMENT_DECLARATIONS}
2106				struct S
2107				{
2108					mediump float vtxVal;
2109					mediump float tcVal;
2110					mediump float teVal;
2111					mediump float fragVal;
2112				};
2113				uniform S val;
2114				in mediump float te_out;
2115				void main()
2116				{
2117					out0 = te_out + 4.0 * val.fragVal;
2118					${FRAGMENT_OUTPUT};
2119				}
2120			""
2121		end
2122	end
2123
2124	import "linkage_tessellation_uniform_types.test"
2125end
2126