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