1case float_input
2	version 300 es
3	values
4	{
5		input float in0		= [ 1.123 | 0.75 | -512.0 | -72.13 | 199.91 ];
6		output float out0	= [ 1.123 | 0.75 | -512.0 | -72.13 | 199.91 ];
7	}
8	values
9	{
10		input float in0		= [ -1.123 | -0.75 | 512.0 | -72.13 | -199.91 ];
11		output float out0	= [ -1.123 | -0.75 | 512.0 | -72.13 | -199.91 ];
12	}
13
14	both ""
15		#version 300 es
16		precision highp float;
17		${DECLARATIONS}
18		void main()
19		{
20			out0 = in0;
21			${OUTPUT}
22		}
23	""
24end
25
26case float_uniform
27	version 300 es
28	values
29	{
30		uniform float uni0	= [ 1.123 | 0.75 | -512.0 | -72.13 | 199.91 ];
31		output float out0	= [ 1.123 | 0.75 | -512.0 | -72.13 | 199.91 ];
32	}
33
34	both ""
35		#version 300 es
36		precision highp float;
37		${DECLARATIONS}
38		uniform float uni0;
39		void main()
40		{
41			out0 = uni0;
42			${OUTPUT}
43		}
44	""
45end
46
47case float_0
48	version 300 es
49	values { output float out0 = 1.123; }
50	both ""
51		#version 300 es
52		precision highp float;
53		${DECLARATIONS}
54		void main()
55		{
56			out0 = +1.123;
57			${OUTPUT}
58		}
59	""
60end
61
62case float_1
63	version 300 es
64	values { output float out0 = -1.123; }
65	both ""
66		#version 300 es
67		precision highp float;
68		${DECLARATIONS}
69		void main()
70		{
71			out0 = -1.123;
72			${OUTPUT}
73		}
74	""
75end
76
77case float_2
78	version 300 es
79	values { output float out0 = 123.0; }
80	both ""
81		#version 300 es
82		precision highp float;
83		${DECLARATIONS}
84		void main()
85		{
86			out0 = 123.;
87			${OUTPUT}
88		}
89	""
90end
91
92case float_3
93	version 300 es
94	values { output float out0 = 0.123; }
95	both ""
96		#version 300 es
97		precision highp float;
98		${DECLARATIONS}
99		void main()
100		{
101			out0 = .123;
102			${OUTPUT}
103		}
104	""
105end
106
107case float_4
108	version 300 es
109	values { output float out0 = 123.0; }
110	both ""
111		#version 300 es
112		precision highp float;
113		${DECLARATIONS}
114		void main()
115		{
116			out0 = 1.23e+2;
117			${OUTPUT}
118		}
119	""
120end
121
122case float_5
123	version 300 es
124	values { output float out0 = -123.0; }
125	both ""
126		#version 300 es
127		precision highp float;
128		${DECLARATIONS}
129		void main()
130		{
131			out0 = -1.23E+2;
132			${OUTPUT}
133		}
134	""
135end
136
137case float_6
138	version 300 es
139	values { output float out0 = -123.0; }
140	both ""
141		#version 300 es
142		precision highp float;
143		${DECLARATIONS}
144		void main()
145		{
146			out0 = -1.23e2;
147			${OUTPUT}
148		}
149	""
150end
151
152case float_7
153	version 300 es
154	values { output float out0 = 0.123; }
155	both ""
156		#version 300 es
157		precision highp float;
158		${DECLARATIONS}
159		void main()
160		{
161			out0 = 1.23e-1;
162			${OUTPUT}
163		}
164	""
165end
166
167case float_8
168	version 300 es
169	values { output float out0 = 1000.0; }
170	both ""
171		#version 300 es
172		precision highp float;
173		${DECLARATIONS}
174		void main()
175		{
176			out0 = 1e3;
177			${OUTPUT}
178		}
179	""
180end
181
182case float_f_suffix_0
183	version 300 es
184	values { output float out0 = 1.0; }
185	both ""
186		#version 300 es
187		precision mediump float;
188		${DECLARATIONS}
189		void main ()
190		{
191			${SETUP}
192			float value = 1.0f;
193			out0 = value;
194			${OUTPUT}
195		}
196	""
197end
198
199case float_f_suffix_1
200	version 300 es
201	values { output float out0 = 1.0; }
202	both ""
203		#version 300 es
204		precision mediump float;
205		${DECLARATIONS}
206		void main ()
207		{
208			${SETUP}
209			float value = 1.0F;
210			out0 = value;
211			${OUTPUT}
212		}
213	""
214end
215
216case int_0
217	version 300 es
218	values { output int out0 = 123; }
219	both ""
220		#version 300 es
221		precision highp float;
222		${DECLARATIONS}
223		void main()
224		{
225			out0 = 123;
226			${OUTPUT}
227		}
228	""
229end
230
231case int_1
232	version 300 es
233	values { output int out0 = -321; }
234	both ""
235		#version 300 es
236		precision highp float;
237		${DECLARATIONS}
238		void main()
239		{
240			out0 = -321;
241			${OUTPUT}
242		}
243	""
244end
245
246case int_2
247	version 300 es
248	values { output int out0 = 123; }
249	both ""
250		#version 300 es
251		precision highp float;
252		${DECLARATIONS}
253		void main()
254		{
255			out0 = 0x7B;
256			${OUTPUT}
257		}
258	""
259end
260
261case int_3
262	version 300 es
263	values { output int out0 = 123; }
264	both ""
265		#version 300 es
266		precision highp float;
267		${DECLARATIONS}
268		void main()
269		{
270			out0 = 0X7b;
271			${OUTPUT}
272		}
273	""
274end
275
276case int_4
277	version 300 es
278	values { output int out0 = 123; }
279	both ""
280		#version 300 es
281		precision highp float;
282		${DECLARATIONS}
283		void main()
284		{
285			out0 = 0173;
286			${OUTPUT}
287		}
288	""
289end
290
291case bool_0
292	version 300 es
293	values { output bool out0 = true; }
294	both ""
295		#version 300 es
296		precision highp float;
297		${DECLARATIONS}
298		void main()
299		{
300			out0 = true;
301			${OUTPUT}
302		}
303	""
304end
305
306case bool_1
307	version 300 es
308	values { output bool out0 = false; }
309	both ""
310		#version 300 es
311		precision highp float;
312		${DECLARATIONS}
313		void main()
314		{
315			out0 = false;
316			${OUTPUT}
317		}
318	""
319end
320
321case const_float_global
322	 version 300 es
323	 values { output float out0 = 1000.0; }
324
325	 both ""
326			#version 300 es
327			precision mediump float;
328			${DECLARATIONS}
329			const float theConstant = 1000.0;
330			void main()
331			{
332				out0 = theConstant;
333				${OUTPUT}
334			}
335	 ""
336end
337
338case const_float_main
339	 version 300 es
340	 values { output float out0 = -1000.0; }
341
342	 both ""
343			#version 300 es
344			precision mediump float;
345			${DECLARATIONS}
346			void main()
347			{
348					const float theConstant = -1000.0;
349				out0 = theConstant;
350				${OUTPUT}
351			}
352	 ""
353end
354
355case const_float_function
356	 version 300 es
357	 values { output float out0 = -0.012; }
358
359	 both ""
360			#version 300 es
361			precision mediump float;
362			${DECLARATIONS}
363			float func()
364			{
365					const float theConstant = -0.012;
366				return theConstant;
367			}
368			void main()
369			{
370				out0 = func();
371				${OUTPUT}
372			}
373	 ""
374end
375
376case const_float_scope
377	 version 300 es
378	 values { output float out0 = 1.0; }
379
380	 both ""
381			#version 300 es
382			precision mediump float;
383			${DECLARATIONS}
384			void main()
385			{
386				{
387					 const float theConstant = 1.0;
388					 out0 = theConstant;
389				}
390				${OUTPUT}
391			}
392	 ""
393end
394
395case const_float_scope_shawdowing_1
396	 version 300 es
397	 values { output float out0 = 1.0; }
398
399	 both ""
400			#version 300 es
401			precision mediump float;
402			${DECLARATIONS}
403			void main()
404			{
405				const float theConstant = 100.0;
406				{
407					 const float theConstant = 1.0;
408					 out0 = theConstant;
409				}
410				${OUTPUT}
411			}
412	 ""
413end
414
415case const_float_scope_shawdowing_2
416	 version 300 es
417	 values { output float out0 = 1.0; }
418
419	 both ""
420			#version 300 es
421			precision mediump float;
422			${DECLARATIONS}
423			const float theConstant = 100.0;
424			void main()
425			{
426				{
427					 const float theConstant = 1.0;
428					 out0 = theConstant;
429				}
430				${OUTPUT}
431			}
432	 ""
433end
434
435case const_float_scope_shawdowing_3
436	 version 300 es
437	 values { output float out0 = 1.0; }
438
439	 both ""
440			#version 300 es
441			precision mediump float;
442			${DECLARATIONS}
443			const float theConstant = 100.0;
444			void main()
445			{
446				const float theConstant = -100.0;
447				{
448					 const float theConstant = 1.0;
449					 out0 = theConstant;
450				}
451				${OUTPUT}
452			}
453	 ""
454end
455
456case const_float_scope_shawdowing_4
457	 version 300 es
458	 values { output float out0 = 2.0; }
459
460	 both ""
461			#version 300 es
462			precision mediump float;
463			${DECLARATIONS}
464			const float theConstant = 100.0;
465			float func()
466			{
467				const float theConstant = 2.0;
468				return theConstant;
469			}
470			void main()
471			{
472				const float theConstant = -100.0;
473				{
474					 const float theConstant = 1.0;
475					 out0 = func();
476				}
477				${OUTPUT}
478			}
479	 ""
480end
481
482case const_float_operations_with_const
483	 version 300 es
484	 values { output float out0 = 21.0; }
485
486	 both ""
487			#version 300 es
488			precision mediump float;
489			${DECLARATIONS}
490			const float theGlobalConstant = 10.0;
491			float func()
492			{
493				const float theConstant = 2.0;
494				return theConstant;
495			}
496			void main()
497			{
498				const float theConstant = -100.0;
499				{
500					 const float theConstant = 1.0;
501					 out0 = func() * theGlobalConstant + theConstant;
502				}
503				${OUTPUT}
504			}
505	 ""
506end
507
508case const_float_assignment_1
509	 version 300 es
510	 values { output float out0 = 10.0; }
511
512	 both ""
513			#version 300 es
514			precision mediump float;
515			${DECLARATIONS}
516			void main()
517			{
518				const float theConstant1 = 10.0;
519				const float theConstant2 = theConstant1;
520				out0 = theConstant2;
521				${OUTPUT}
522			}
523	 ""
524end
525
526case const_float_assignment_2
527	 version 300 es
528	 values { output float out0 = 10.0; }
529
530	 both ""
531			#version 300 es
532			precision mediump float;
533			${DECLARATIONS}
534			void main()
535			{
536				const float theConstant1 = 10.0;
537				{
538					const float theConstant2 = theConstant1;
539					out0 = theConstant2;
540				}
541				${OUTPUT}
542			}
543	 ""
544end
545
546case const_float_assignment_3
547	 version 300 es
548	 values { output float out0 = 10.0; }
549
550	 both ""
551			#version 300 es
552			precision mediump float;
553			${DECLARATIONS}
554			const float theConstant1 = 10.0;
555			void main()
556			{
557				const float theConstant2 = theConstant1;
558				out0 = theConstant2;
559				${OUTPUT}
560			}
561	 ""
562end
563
564case const_float_assignment_4
565	 version 300 es
566	 values { output float out0 = 10.0; }
567
568	 both ""
569			#version 300 es
570			precision mediump float;
571			${DECLARATIONS}
572			const float theConstant1 = 10.0;
573			float func()
574			{
575				const float theConstant2 = theConstant1;
576				return theConstant2;
577			}
578			void main()
579			{
580				out0 = func();
581				${OUTPUT}
582			}
583	 ""
584end
585
586case const_float_assign_uniform
587	 version 300 es
588	 expect compile_fail
589	 values { output float out0 = 10.0; }
590	 both ""
591			#version 300 es
592			precision mediump float;
593			${DECLARATIONS}
594			uniform float theUniform;
595			void main()
596			{
597				const float theConstant = theUniform;
598				out0 = theConstant;
599				${OUTPUT}
600			}
601	 ""
602end
603
604case const_float_assign_varying
605	 version 300 es
606	 expect compile_fail
607	 values { output float out0 = 10.0; }
608	 vertex ""
609			#version 300 es
610			${VERTEX_DECLARATIONS}
611			out float theVarying;
612			void main()
613			{
614				theVarying = 1.0;
615				gl_Position = vec(1.0);
616			}
617	 ""
618	 fragment ""
619			#version 300 es
620			precision mediump float;
621			${FRAGMENT_DECLARATIONS}
622			in float theVarying;
623			void main()
624			{
625				const float theConstant = theVarying;
626				out0 = theConstant;
627				${FRAGMENT_OUTPUT}
628			}
629	 ""
630end
631
632case const_float_function_gotcha
633	 version 300 es
634	 desc "Function constant parameters are not really constants, so using them as constant expressions should fail."
635	 expect compile_fail
636	 values { output float out0 = 20.0; }
637	 both ""
638			#version 300 es
639			precision mediump float;
640			${DECLARATIONS}
641			float func(const float gotcha)
642			{
643				const float theConstant2 = gotcha;
644				return theConstant2*2.0;
645			}
646			void main()
647			{
648					const float theConstant = 10.0;
649				out0 = func(theConstant);
650				${OUTPUT}
651			}
652	 ""
653end
654
655case const_float_from_int
656	 version 300 es
657	 values { output float out0 = 10.0; }
658
659	 both ""
660			#version 300 es
661			precision mediump float;
662			${DECLARATIONS}
663			const float theConstant = float(10);
664			void main()
665			{
666				out0 = theConstant;
667				${OUTPUT}
668			}
669	 ""
670end
671
672case const_float_from_vec2
673	 version 300 es
674	 values { output float out0 = 10.0; }
675
676	 both ""
677			#version 300 es
678			precision mediump float;
679			${DECLARATIONS}
680			const float theConstant = vec2(1.0, 10.0).y;
681			void main()
682			{
683				out0 = theConstant;
684				${OUTPUT}
685			}
686	 ""
687end
688
689case const_float_from_vec3
690	 version 300 es
691	 values { output float out0 = 10.0; }
692
693	 both ""
694			#version 300 es
695			precision mediump float;
696			${DECLARATIONS}
697			const float theConstant = vec3(1.0, 10.0, 20.0).y;
698			void main()
699			{
700				out0 = theConstant;
701				${OUTPUT}
702			}
703	 ""
704end
705
706case const_float_from_vec4
707	 version 300 es
708	 values { output float out0 = 10.0; }
709
710	 both ""
711			#version 300 es
712			precision mediump float;
713			${DECLARATIONS}
714			const float theConstant = vec4(1.0, 10.0, 20.0, -10.0).y;
715			void main()
716			{
717				out0 = theConstant;
718				${OUTPUT}
719			}
720	 ""
721end
722
723case const_float_assign_variable_1
724	 version 300 es
725	 expect compile_fail
726	 values { output float out0 = 20.0; }
727	 both ""
728			#version 300 es
729			precision mediump float;
730			${DECLARATIONS}
731			void main()
732			{
733				float theVariable = 20.0;
734				const float theConstant = theVariable;
735				out0 = theConstant;
736				${OUTPUT}
737			}
738	 ""
739end
740
741case const_float_assign_variable_2
742	 version 300 es
743	 expect compile_fail
744	 values { output float out0 = 50.0; }
745	 both ""
746			#version 300 es
747			precision mediump float;
748			${DECLARATIONS}
749			void main()
750			{
751				float theVariable = 20.0;
752				theVariable += 30.0;
753				const float theConstant = theVariable;
754				out0 = theConstant;
755				${OUTPUT}
756			}
757	 ""
758end
759
760case const_float_assign_user_func
761	 version 300 es
762	 expect compile_fail
763	 values { output float out0 = 50.0; }
764	 both ""
765			#version 300 es
766			precision mediump float;
767			${DECLARATIONS}
768			float func()
769			{
770				return 50.0;
771			}
772			void main()
773			{
774				const float theConstant = func();
775				out0 = theConstant;
776				${OUTPUT}
777			}
778	 ""
779end
780
781case int_decimal
782	version 300 es
783	values { output int out0 = 7; }
784	both ""
785		#version 300 es
786		${DECLARATIONS}
787		void main ()
788		{
789			${SETUP}
790			int value = 7;
791			out0 = value;
792			${OUTPUT}
793		}
794	""
795end
796
797case int_octal
798	version 300 es
799	values { output int out0 = 15; }
800	both ""
801		#version 300 es
802		${DECLARATIONS}
803		void main ()
804		{
805			${SETUP}
806			int value = 017;
807			out0 = value;
808			${OUTPUT}
809		}
810	""
811end
812
813case int_hexadecimal_0
814	version 300 es
815	values { output int out0 = 47; }
816	both ""
817		#version 300 es
818		${DECLARATIONS}
819		void main ()
820		{
821			${SETUP}
822			int value = 0x2f;
823			out0 = value;
824			${OUTPUT}
825		}
826	""
827end
828
829case int_hexadecimal_1
830	version 300 es
831	values { output int out0 = 47; }
832	both ""
833		#version 300 es
834		${DECLARATIONS}
835		void main ()
836		{
837			${SETUP}
838			int value = 0X2f;
839			out0 = value;
840			${OUTPUT}
841		}
842	""
843end
844
845case uint_decimal_0
846	version 300 es
847	values { output uint out0 = 7; }
848	both ""
849		#version 300 es
850		${DECLARATIONS}
851		void main ()
852		{
853			${SETUP}
854			uint value = 7u;
855			out0 = value;
856			${OUTPUT}
857		}
858	""
859end
860
861case uint_decimal_1
862	version 300 es
863	values { output uint out0 = 7; }
864	both ""
865		#version 300 es
866		${DECLARATIONS}
867		void main ()
868		{
869			${SETUP}
870			uint value = 7U;
871			out0 = value;
872			${OUTPUT}
873		}
874	""
875end
876
877case uint_octal_0
878	version 300 es
879	values { output uint out0 = 15; }
880	both ""
881		#version 300 es
882		${DECLARATIONS}
883		void main ()
884		{
885			${SETUP}
886			uint value = 017u;
887			out0 = value;
888			${OUTPUT}
889		}
890	""
891end
892
893case uint_octal_1
894	version 300 es
895	values { output uint out0 = 15; }
896	both ""
897		#version 300 es
898		${DECLARATIONS}
899		void main ()
900		{
901			${SETUP}
902			uint value = 017U;
903			out0 = value;
904			${OUTPUT}
905		}
906	""
907end
908
909case uint_hexadecimal_0
910	version 300 es
911	values { output uint out0 = 47; }
912	both ""
913		#version 300 es
914		${DECLARATIONS}
915		void main ()
916		{
917			${SETUP}
918			uint value = 0x2fU;
919			out0 = value;
920			${OUTPUT}
921		}
922	""
923end
924
925case uint_hexadecimal_1
926	version 300 es
927	values { output uint out0 = 47; }
928	both ""
929		#version 300 es
930		${DECLARATIONS}
931		void main ()
932		{
933			${SETUP}
934			uint value = 0X2fu;
935			out0 = value;
936			${OUTPUT}
937		}
938	""
939end
940
941case int_from_uint
942	expect compile_fail
943	version 300 es
944	both ""
945		#version 300 es
946		${DECLARATIONS}
947		void main ()
948		{
949			int value = 7u;
950			${POSITION_FRAG_COLOR} = vec4(0.0);
951		}
952	""
953end
954
955case uint_from_int
956	expect compile_fail
957	version 300 es
958	both ""
959		#version 300 es
960		${DECLARATIONS}
961		void main ()
962		{
963			uint value = 7;
964			${POSITION_FRAG_COLOR} = vec4(0.0);
965		}
966	""
967end
968
969case int_from_float
970	expect compile_fail
971	version 300 es
972	both ""
973		#version 300 es
974		${DECLARATIONS}
975		void main ()
976		{
977			int value = 7.0;
978			${POSITION_FRAG_COLOR} = vec4(0.0);
979		}
980	""
981end
982
983case uint_from_float
984	expect compile_fail
985	version 300 es
986	both ""
987		#version 300 es
988		${DECLARATIONS}
989		void main ()
990		{
991			uint value = 7.0;
992			${POSITION_FRAG_COLOR} = vec4(0.0);
993		}
994	""
995end
996
997case bool_from_int
998	expect compile_fail
999	version 300 es
1000	both ""
1001		#version 300 es
1002		${DECLARATIONS}
1003		void main ()
1004		{
1005			bool value = 1;
1006			${POSITION_FRAG_COLOR} = vec4(0.0);
1007		}
1008	""
1009end
1010
1011case bool_from_uint
1012	expect compile_fail
1013	version 300 es
1014	both ""
1015		#version 300 es
1016		${DECLARATIONS}
1017		void main ()
1018		{
1019			bool value = 1u;
1020			${POSITION_FRAG_COLOR} = vec4(0.0);
1021		}
1022	""
1023end
1024
1025case bool_from_float
1026	expect compile_fail
1027	version 300 es
1028	both ""
1029		#version 300 es
1030		${DECLARATIONS}
1031		void main ()
1032		{
1033			bool value = 1.0;
1034			${POSITION_FRAG_COLOR} = vec4(0.0);
1035		}
1036	""
1037end
1038
1039case float_int_f_suffix_0
1040	expect compile_fail
1041	version 300 es
1042	both ""
1043		#version 300 es
1044		precision mediump float;
1045		${DECLARATIONS}
1046		void main ()
1047		{
1048			${SETUP}
1049			float value = 1f;
1050			${POSITION_FRAG_COLOR} = vec4(0.0);
1051		}
1052	""
1053end
1054
1055case float_int_f_suffix_1
1056	expect compile_fail
1057	version 300 es
1058	both ""
1059		#version 300 es
1060		precision mediump float;
1061		${DECLARATIONS}
1062		void main ()
1063		{
1064			${SETUP}
1065			float value = 1F;
1066			${POSITION_FRAG_COLOR} = vec4(0.0);
1067		}
1068	""
1069end
1070
1071case int_l_suffix
1072	expect compile_fail
1073	version 300 es
1074	both ""
1075		#version 300 es
1076		${DECLARATIONS}
1077		void main ()
1078		{
1079			int value = 1l;
1080			${POSITION_FRAG_COLOR} = vec4(0.0);
1081		}
1082	""
1083end
1084
1085case uint_ul_suffix
1086	expect compile_fail
1087	version 300 es
1088	both ""
1089		#version 300 es
1090		${DECLARATIONS}
1091		void main ()
1092		{
1093			uint value = 1ul;
1094			${POSITION_FRAG_COLOR} = vec4(0.0);
1095		}
1096	""
1097end
1098
1099case invalid_octal_0
1100	expect compile_fail
1101	version 300 es
1102	both ""
1103		#version 300 es
1104		${DECLARATIONS}
1105		void main ()
1106		{
1107			int value = 018;
1108			${POSITION_FRAG_COLOR} = vec4(0.0);
1109		}
1110	""
1111end
1112
1113case invalid_octal_1
1114	expect compile_fail
1115	version 300 es
1116	both ""
1117		#version 300 es
1118		${DECLARATIONS}
1119		void main ()
1120		{
1121			uint value = 09U;
1122			${POSITION_FRAG_COLOR} = vec4(0.0);
1123		}
1124	""
1125end
1126
1127case invalid_hexadecimal_0
1128	expect compile_fail
1129	version 300 es
1130	both ""
1131		#version 300 es
1132		${DECLARATIONS}
1133		void main ()
1134		{
1135			int value = 0x2g7;
1136			${POSITION_FRAG_COLOR} = vec4(0.0);
1137		}
1138	""
1139end
1140
1141case invalid_hexadecimal_1
1142	expect compile_fail
1143	version 300 es
1144	both ""
1145		#version 300 es
1146		${DECLARATIONS}
1147		void main ()
1148		{
1149			uint value = 0X1h7u;
1150			${POSITION_FRAG_COLOR} = vec4(0.0);
1151		}
1152	""
1153end
1154