• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1case float_input
2	values
3	{
4		input float in0		= [ 1.123 | 0.75 | -512.0 | -72.13 | 199.91 | -1.123 | -0.75 | 512.0 | -72.13 | -199.91 ];
5		output float out0	= [ 1.123 | 0.75 | -512.0 | -72.13 | 199.91 | -1.123 | -0.75 | 512.0 | -72.13 | -199.91 ];
6	}
7
8	both ""
9		precision highp float;
10		${DECLARATIONS}
11		void main()
12		{
13			out0 = in0;
14			${OUTPUT}
15		}
16	""
17end
18
19case float_uniform
20	values
21	{
22		uniform float uni0	= [ 1.123 | 0.75 | -512.0 | -72.13 | 199.91 ];
23		output float out0	= [ 1.123 | 0.75 | -512.0 | -72.13 | 199.91 ];
24	}
25
26	both ""
27		precision highp float;
28		${DECLARATIONS}
29		uniform float uni0;
30		void main()
31		{
32			out0 = uni0;
33			${OUTPUT}
34		}
35	""
36end
37
38case float_0
39	values { output float out0 = 1.123; }
40	both ""
41		precision highp float;
42		${DECLARATIONS}
43		void main()
44		{
45			out0 = +1.123;
46			${OUTPUT}
47		}
48	""
49end
50
51case float_1
52	values { output float out0 = -1.123; }
53	both ""
54		precision highp float;
55		${DECLARATIONS}
56		void main()
57		{
58			out0 = -1.123;
59			${OUTPUT}
60		}
61	""
62end
63
64case float_2
65	values { output float out0 = 123.0; }
66	both ""
67		precision highp float;
68		${DECLARATIONS}
69		void main()
70		{
71			out0 = 123.;
72			${OUTPUT}
73		}
74	""
75end
76
77case float_3
78	values { output float out0 = 0.123; }
79	both ""
80		precision highp float;
81		${DECLARATIONS}
82		void main()
83		{
84			out0 = .123;
85			${OUTPUT}
86		}
87	""
88end
89
90case float_4
91	values { output float out0 = 123.0; }
92	both ""
93		precision highp float;
94		${DECLARATIONS}
95		void main()
96		{
97			out0 = 1.23e+2;
98			${OUTPUT}
99		}
100	""
101end
102
103case float_5
104	values { output float out0 = -123.0; }
105	both ""
106		precision highp float;
107		${DECLARATIONS}
108		void main()
109		{
110			out0 = -1.23E+2;
111			${OUTPUT}
112		}
113	""
114end
115
116case float_6
117	values { output float out0 = -123.0; }
118	both ""
119		precision highp float;
120		${DECLARATIONS}
121		void main()
122		{
123			out0 = -1.23e2;
124			${OUTPUT}
125		}
126	""
127end
128
129case float_7
130	values { output float out0 = 0.123; }
131	both ""
132		precision highp float;
133		${DECLARATIONS}
134		void main()
135		{
136			out0 = 1.23e-1;
137			${OUTPUT}
138		}
139	""
140end
141
142case float_8
143	values { output float out0 = 1000.0; }
144	both ""
145		precision highp float;
146		${DECLARATIONS}
147		void main()
148		{
149			out0 = 1e3;
150			${OUTPUT}
151		}
152	""
153end
154
155case int_0
156	values { output int out0 = 123; }
157	both ""
158		precision highp float;
159		${DECLARATIONS}
160		void main()
161		{
162			out0 = 123;
163			${OUTPUT}
164		}
165	""
166end
167
168case int_1
169	values { output int out0 = -321; }
170	both ""
171		precision highp float;
172		${DECLARATIONS}
173		void main()
174		{
175			out0 = -321;
176			${OUTPUT}
177		}
178	""
179end
180
181case int_2
182	values { output int out0 = 123; }
183	both ""
184		precision highp float;
185		${DECLARATIONS}
186		void main()
187		{
188			out0 = 0x7B;
189			${OUTPUT}
190		}
191	""
192end
193
194case int_3
195	values { output int out0 = 123; }
196	both ""
197		precision highp float;
198		${DECLARATIONS}
199		void main()
200		{
201			out0 = 0X7b;
202			${OUTPUT}
203		}
204	""
205end
206
207case int_4
208	values { output int out0 = 123; }
209	both ""
210		precision highp float;
211		${DECLARATIONS}
212		void main()
213		{
214			out0 = 0173;
215			${OUTPUT}
216		}
217	""
218end
219
220case bool_0
221	values { output bool out0 = true; }
222	both ""
223		precision highp float;
224		${DECLARATIONS}
225		void main()
226		{
227			out0 = true;
228			${OUTPUT}
229		}
230	""
231end
232
233case bool_1
234	values { output bool out0 = false; }
235	both ""
236		precision highp float;
237		${DECLARATIONS}
238		void main()
239		{
240			out0 = false;
241			${OUTPUT}
242		}
243	""
244end
245
246case const_float_global
247	 values { output float out0 = 1000.0; }
248
249	 both ""
250		  precision mediump float;
251		  ${DECLARATIONS}
252		  const float theConstant = 1000.0;
253		  void main()
254		  {
255				out0 = theConstant;
256				${OUTPUT}
257		  }
258	 ""
259end
260
261case const_float_main
262	 values { output float out0 = -1000.0; }
263
264	 both ""
265		  precision mediump float;
266		  ${DECLARATIONS}
267		  void main()
268		  {
269			    const float theConstant = -1000.0;
270				out0 = theConstant;
271				${OUTPUT}
272		  }
273	 ""
274end
275
276case const_float_function
277	 values { output float out0 = -0.012; }
278
279	 both ""
280		  precision mediump float;
281		  ${DECLARATIONS}
282		  float func()
283		  {
284			    const float theConstant = -0.012;
285				return theConstant;
286		  }
287		  void main()
288		  {
289				out0 = func();
290				${OUTPUT}
291		  }
292	 ""
293end
294
295case const_float_scope
296	 values { output float out0 = 1.0; }
297
298	 both ""
299		  precision mediump float;
300		  ${DECLARATIONS}
301		  void main()
302		  {
303				{
304					 const float theConstant = 1.0;
305					 out0 = theConstant;
306			    }
307				${OUTPUT}
308		  }
309	 ""
310end
311
312case const_float_scope_shawdowing_1
313	 values { output float out0 = 1.0; }
314
315	 both ""
316		  precision mediump float;
317		  ${DECLARATIONS}
318		  void main()
319		  {
320			    const float theConstant = 100.0;
321				{
322					 const float theConstant = 1.0;
323					 out0 = theConstant;
324			    }
325				${OUTPUT}
326		  }
327	 ""
328end
329
330case const_float_scope_shawdowing_2
331	 values { output float out0 = 1.0; }
332
333	 both ""
334		  precision mediump float;
335	      ${DECLARATIONS}
336		  const float theConstant = 100.0;
337		  void main()
338		  {
339				{
340					 const float theConstant = 1.0;
341					 out0 = theConstant;
342			    }
343				${OUTPUT}
344		  }
345	 ""
346end
347
348case const_float_scope_shawdowing_3
349	 values { output float out0 = 1.0; }
350
351	 both ""
352		  precision mediump float;
353	      ${DECLARATIONS}
354		  const float theConstant = 100.0;
355		  void main()
356		  {
357			    const float theConstant = -100.0;
358				{
359					 const float theConstant = 1.0;
360					 out0 = theConstant;
361			    }
362				${OUTPUT}
363		  }
364	 ""
365end
366
367case const_float_scope_shawdowing_4
368	 values { output float out0 = 2.0; }
369
370	 both ""
371		  precision mediump float;
372	      ${DECLARATIONS}
373		  const float theConstant = 100.0;
374		  float func()
375		  {
376				const float theConstant = 2.0;
377				return theConstant;
378		  }
379		  void main()
380		  {
381			    const float theConstant = -100.0;
382				{
383					 const float theConstant = 1.0;
384					 out0 = func();
385			    }
386				${OUTPUT}
387		  }
388	 ""
389end
390
391case const_float_operations_with_const
392	 values { output float out0 = 21.0; }
393
394	 both ""
395		  precision mediump float;
396	      ${DECLARATIONS}
397		  const float theGlobalConstant = 10.0;
398		  float func()
399		  {
400				const float theConstant = 2.0;
401				return theConstant;
402		  }
403		  void main()
404		  {
405			    const float theConstant = -100.0;
406				{
407					 const float theConstant = 1.0;
408					 out0 = func() * theGlobalConstant + theConstant;
409			    }
410				${OUTPUT}
411		  }
412	 ""
413end
414
415case const_float_assignment_1
416	 values { output float out0 = 10.0; }
417
418	 both ""
419		  precision mediump float;
420	      ${DECLARATIONS}
421		  void main()
422		  {
423			    const float theConstant1 = 10.0;
424				const float theConstant2 = theConstant1;
425				out0 = theConstant2;
426				${OUTPUT}
427		  }
428	 ""
429end
430
431case const_float_assignment_2
432	 values { output float out0 = 10.0; }
433
434	 both ""
435		  precision mediump float;
436	      ${DECLARATIONS}
437		  void main()
438		  {
439			    const float theConstant1 = 10.0;
440				{
441					const float theConstant2 = theConstant1;
442					out0 = theConstant2;
443				}
444				${OUTPUT}
445		  }
446	 ""
447end
448
449case const_float_assignment_3
450	 values { output float out0 = 10.0; }
451
452	 both ""
453		  precision mediump float;
454	      ${DECLARATIONS}
455	      const float theConstant1 = 10.0;
456		  void main()
457		  {
458				const float theConstant2 = theConstant1;
459				out0 = theConstant2;
460				${OUTPUT}
461		  }
462	 ""
463end
464
465case const_float_assignment_4
466	 values { output float out0 = 10.0; }
467
468	 both ""
469		  precision mediump float;
470	      ${DECLARATIONS}
471	      const float theConstant1 = 10.0;
472		  float func()
473		  {
474				const float theConstant2 = theConstant1;
475				return theConstant2;
476		  }
477		  void main()
478		  {
479				out0 = func();
480				${OUTPUT}
481		  }
482	 ""
483end
484
485case const_float_assign_uniform
486	 expect compile_fail
487	 values { output float out0 = 10.0; }
488	 both ""
489		  precision mediump float;
490	      ${DECLARATIONS}
491		  uniform float theUniform;
492		  void main()
493		  {
494				const float theConstant = theUniform;
495				out0 = theConstant;
496				${OUTPUT}
497		  }
498	 ""
499end
500
501case const_float_assign_varying
502	 expect compile_fail
503	 values { output float out0 = 10.0; }
504	 vertex ""
505	      ${VERTEX_DECLARATIONS}
506		  varying float theVarying;
507		  void main()
508		  {
509				theVarying = 1.0;
510				gl_Position = vec(1.0);
511		  }
512	 ""
513	 fragment ""
514		  precision mediump float;
515	      ${FRAGMENT_DECLARATIONS}
516		  varying float theVarying;
517		  void main()
518		  {
519				const float theConstant = theVarying;
520				out0 = theConstant;
521				${FRAGMENT_OUTPUT}
522		  }
523	 ""
524end
525
526case const_float_function_gotcha
527	 desc "Function constant parameters are not really constants, so using them as constant expressions should fail."
528	 expect compile_fail
529	 values { output float out0 = 20.0; }
530	 both ""
531		  precision mediump float;
532	      ${DECLARATIONS}
533		  float func(const float gotcha)
534		  {
535				const float theConstant2 = gotcha;
536				return theConstant2*2.0;
537		  }
538		  void main()
539		  {
540			    const float theConstant = 10.0;
541				out0 = func(theConstant);
542				${OUTPUT}
543		  }
544	 ""
545end
546
547case const_float_from_int
548	 values { output float out0 = 10.0; }
549
550	 both ""
551		  precision mediump float;
552	      ${DECLARATIONS}
553	      const float theConstant = float(10);
554		  void main()
555		  {
556				out0 = theConstant;
557				${OUTPUT}
558		  }
559	 ""
560end
561
562case const_float_from_vec2
563	 values { output float out0 = 10.0; }
564
565	 both ""
566		  precision mediump float;
567	      ${DECLARATIONS}
568	      const float theConstant = vec2(1.0, 10.0).y;
569		  void main()
570		  {
571				out0 = theConstant;
572				${OUTPUT}
573		  }
574	 ""
575end
576
577case const_float_from_vec3
578	 values { output float out0 = 10.0; }
579
580	 both ""
581		  precision mediump float;
582	      ${DECLARATIONS}
583	      const float theConstant = vec3(1.0, 10.0, 20.0).y;
584		  void main()
585		  {
586				out0 = theConstant;
587				${OUTPUT}
588		  }
589	 ""
590end
591
592case const_float_from_vec4
593	 values { output float out0 = 10.0; }
594
595	 both ""
596		  precision mediump float;
597	      ${DECLARATIONS}
598	      const float theConstant = vec4(1.0, 10.0, 20.0, -10.0).y;
599		  void main()
600		  {
601				out0 = theConstant;
602				${OUTPUT}
603		  }
604	 ""
605end
606
607case const_float_assign_variable_1
608	 expect compile_fail
609	 values { output float out0 = 20.0; }
610	 both ""
611		  precision mediump float;
612	      ${DECLARATIONS}
613		  void main()
614		  {
615				float theVariable = 20.0;
616				const float theConstant = theVariable;
617				out0 = theConstant;
618				${OUTPUT}
619		  }
620	 ""
621end
622
623case const_float_assign_variable_2
624	 expect compile_fail
625	 values { output float out0 = 50.0; }
626	 both ""
627		  precision mediump float;
628	      ${DECLARATIONS}
629		  void main()
630		  {
631				float theVariable = 20.0;
632				theVariable += 30.0;
633				const float theConstant = theVariable;
634				out0 = theConstant;
635				${OUTPUT}
636		  }
637	 ""
638end
639
640case const_float_assign_user_func
641	 expect compile_fail
642	 values { output float out0 = 50.0; }
643	 both ""
644		  precision mediump float;
645	      ${DECLARATIONS}
646		  float func()
647		  {
648				return 50.0;
649		  }
650		  void main()
651		  {
652				const float theConstant = func();
653				out0 = theConstant;
654				${OUTPUT}
655		  }
656	 ""
657end
658