xref: /aosp_15_r20/external/deqp/data/gles2/shaders/linkage.test (revision 35238bce31c2a825756842865a792f8cf7f89930)
1# not declared in vertex shader, declared in fragment shader
2case varying_1
3    desc "varying declared in fragment shader, no reference in vertex shader"
4    values { output float out0 = 1.0; }
5    vertex ""
6        ${VERTEX_DECLARATIONS}
7        void main()
8        {
9            ${VERTEX_OUTPUT}
10        }
11    ""
12    fragment ""
13        precision mediump float;
14        varying mediump float var;
15        ${FRAGMENT_DECLARATIONS}
16        void main()
17        {
18            out0 = 1.0;
19            ${FRAGMENT_OUTPUT}
20        }
21    ""
22end
23
24# declared in vertex shader, no reference in frag shader
25case varying_2
26    desc "varying declared in vertex shader, no reference in fragment shader"
27    vertex ""
28        ${VERTEX_DECLARATIONS}
29        varying mediump float var;
30        void main()
31        {
32            ${VERTEX_OUTPUT}
33        }
34    ""
35    fragment ""
36        void main()
37        {
38            gl_FragColor = vec4(1.0);
39        }
40    ""
41end
42
43# declared in vertex shader, declared in frag shader
44case varying_3
45    desc "varying declared in both vertex and fragment shader, but not used"
46    vertex ""
47        ${VERTEX_DECLARATIONS}
48        varying mediump float var;
49        void main()
50        {
51            ${VERTEX_OUTPUT}
52        }
53    ""
54    fragment ""
55        varying mediump float var;
56        void main()
57        {
58            gl_FragColor = vec4(1.0);
59        }
60    ""
61end
62
63# declared in vertex shader, static use in frag shader
64case varying_4
65    desc "varying declared in both shaders, statically used in fragment shader"
66    values { uniform bool u_false = false; }
67    vertex ""
68        ${VERTEX_DECLARATIONS}
69        varying mediump float var;
70        void main()
71        {
72            ${VERTEX_OUTPUT}
73        }
74    ""
75    fragment ""
76        varying mediump float var;
77        uniform bool u_false;
78        void main()
79        {
80            if (u_false)
81                gl_FragColor = vec4(var);
82            else
83                gl_FragColor = vec4(1.0);
84        }
85    ""
86end
87
88# static use in vertex shader, no reference in fragment shader
89case varying_5
90    desc "varying declared and statically used in vertex shader, no reference in fragment shader"
91    values { uniform bool u_false = false; }
92    vertex ""
93        ${VERTEX_DECLARATIONS}
94        varying mediump float var;
95        void main()
96        {
97            if (u_false)
98                var = 1.0;
99            ${VERTEX_OUTPUT}
100        }
101    ""
102    fragment ""
103        void main()
104        {
105            gl_FragColor = vec4(1.0);
106        }
107    ""
108end
109
110# static use in vertex shader, declared in fragment shader
111case varying_6
112    desc "varying declared and statically used in vertex shader, only declared in fragment shader"
113    values { uniform bool u_false = false; }
114    vertex ""
115        ${VERTEX_DECLARATIONS}
116        varying mediump float var;
117        void main()
118        {
119            if (u_false)
120                var = 1.0;
121            ${VERTEX_OUTPUT}
122        }
123    ""
124    fragment ""
125        varying mediump float var;
126        void main()
127        {
128            gl_FragColor = vec4(1.0);
129        }
130    ""
131end
132
133# static use in vertex shader, used in fragment shader
134case varying_7
135    desc "varying statically used in both vertex and fragment shader"
136    values { uniform bool u_false = false; }
137    vertex ""
138        ${VERTEX_DECLARATIONS}
139        varying mediump float var;
140        void main()
141        {
142            if (u_false)
143                var = 1.0;
144            ${VERTEX_OUTPUT}
145        }
146    ""
147    fragment ""
148        ${FRAGMENT_DECLARATIONS}
149        varying mediump float var;
150        void main()
151        {
152            if (u_false)
153                gl_FragColor = vec4(var);
154            else
155                gl_FragColor = vec4(1.0);
156        }
157    ""
158end
159
160case varying_type_float
161    desc "varying of type float"
162    values
163    {
164        input float in0 = [ -1.25 | -25.65 | 1.0 | 2.25 | 3.4 | 16.0 ];
165        output float out0 = [ -1.25 | -25.65 | 1.0 | 2.25 | 3.4 | 16.0 ];
166    }
167    vertex ""
168        ${VERTEX_DECLARATIONS}
169        varying mediump float var;
170        void main()
171        {
172            var = in0;
173            ${VERTEX_OUTPUT}
174        }
175    ""
176    fragment ""
177        precision mediump float;
178        ${FRAGMENT_DECLARATIONS}
179        varying float var;
180        void main()
181        {
182            out0 = var;
183            ${FRAGMENT_OUTPUT}
184        }
185    ""
186end
187
188case varying_type_vec2
189    desc "varying of type vec2"
190    values
191    {
192        input vec2 in0 = [ vec2(-1.25, 1.25) | vec2(-25.65, -7.25) | vec2(0.0, 1.0) | vec2(2.25, 2.25) | vec2(3.4, 9.5) | vec2(16.0, 32.0) ];
193        output vec2 out0 = [ vec2(-1.25, 1.25) | vec2(-25.65, -7.25) | vec2(0.0, 1.0) | vec2(2.25, 2.25) | vec2(3.4, 9.5) | vec2(16.0, 32.0) ];
194    }
195    vertex ""
196        ${VERTEX_DECLARATIONS}
197        varying mediump vec2 var;
198        void main()
199        {
200            var = in0;
201            ${VERTEX_OUTPUT}
202        }
203    ""
204    fragment ""
205        precision mediump float;
206        ${FRAGMENT_DECLARATIONS}
207        varying vec2 var;
208        void main()
209        {
210            out0 = var;
211            ${FRAGMENT_OUTPUT}
212        }
213    ""
214end
215
216case varying_type_vec3
217    desc "varying of type vec3"
218    values
219    {
220        input vec3 in0 = [ vec3(-1.25, 1.25, -9.5) | vec3(-25.65, -7.25, 14.21) | vec3(0.0, 1.0, -1.0) | vec3(2.25, 2.25, 22.5) | vec3(3.4, 9.5, 19.5) | vec3(16.0, 32.0, -64.0) ];
221        output vec3 out0 = [ vec3(-1.25, 1.25, -9.5) | vec3(-25.65, -7.25, 14.21) | vec3(0.0, 1.0, -1.0) | vec3(2.25, 2.25, 22.5) | vec3(3.4, 9.5, 19.5) | vec3(16.0, 32.0, -64.0) ];
222    }
223    vertex ""
224        ${VERTEX_DECLARATIONS}
225        varying mediump vec3 var;
226        void main()
227        {
228            var = in0;
229            ${VERTEX_OUTPUT}
230        }
231    ""
232    fragment ""
233        precision mediump float;
234        ${FRAGMENT_DECLARATIONS}
235        varying vec3 var;
236        void main()
237        {
238            out0 = var;
239            ${FRAGMENT_OUTPUT}
240        }
241    ""
242end
243
244case varying_type_vec4
245    desc "varying of type vec4"
246    values
247    {
248        input vec4 in0 = [ vec4(-1.25, 1.25, -9.5, -12.2) | vec4(-25.65, -7.25, 14.21, -77.7) | vec4(0.0, 1.0, -1.0, 2.0) | vec4(2.25, 2.25, 22.5, 225.0) | vec4(3.4, 9.5, 19.5, 29.5) | vec4(16.0, 32.0, -64.0, -128.0) ];
249        output vec4 out0 = [ vec4(-1.25, 1.25, -9.5, -12.2) | vec4(-25.65, -7.25, 14.21, -77.7) | vec4(0.0, 1.0, -1.0, 2.0) | vec4(2.25, 2.25, 22.5, 225.0) | vec4(3.4, 9.5, 19.5, 29.5) | vec4(16.0, 32.0, -64.0, -128.0) ];
250    }
251    vertex ""
252        ${VERTEX_DECLARATIONS}
253        varying mediump vec4 var;
254        void main()
255        {
256            var = in0;
257            ${VERTEX_OUTPUT}
258        }
259    ""
260    fragment ""
261        precision mediump float;
262        ${FRAGMENT_DECLARATIONS}
263        varying vec4 var;
264        void main()
265        {
266            out0 = var;
267            ${FRAGMENT_OUTPUT}
268        }
269    ""
270end
271
272case varying_type_mat2
273    desc "varying of type mat2"
274    values
275    {
276        input mat2 in0 = [ mat2(1.0, 1.0, 1.0, 1.0) | mat2(-1.25, 1.25, -9.5, -12.2) | mat2(-25.65, -7.25, 14.21, -77.7) | mat2(0.0, 1.0, -1.0, 2.0) | mat2(2.25, 2.25, 22.5, 225.0) | mat2(3.4, 9.5, 19.5, 29.5) | mat2(16.0, 32.0, -64.0, -128.0) ];
277        output mat2 out0 = [ mat2(1.0, 1.0, 1.0, 1.0) | mat2(-1.25, 1.25, -9.5, -12.2) | mat2(-25.65, -7.25, 14.21, -77.7) | mat2(0.0, 1.0, -1.0, 2.0) | mat2(2.25, 2.25, 22.5, 225.0) | mat2(3.4, 9.5, 19.5, 29.5) | mat2(16.0, 32.0, -64.0, -128.0) ];
278    }
279    vertex ""
280        ${VERTEX_DECLARATIONS}
281        varying mediump mat2 var;
282        void main()
283        {
284            var = in0;
285            ${VERTEX_OUTPUT}
286        }
287    ""
288    fragment ""
289        precision mediump float;
290        ${FRAGMENT_DECLARATIONS}
291        varying mat2 var;
292        void main()
293        {
294            out0 = var;
295            ${FRAGMENT_OUTPUT}
296        }
297    ""
298end
299
300case varying_type_mat3
301    desc "varying of type mat3"
302    values
303    {
304        input mat3 in0 = [ mat3(-1.25, 1.25, -9.5, -12.2, -25.65, -7.25, 14.21, -77.7, 9.9) | mat3(0.0, 1.0, -1.0, 2.0, 2.25, 2.25, 22.5, 225.0, -9.9) | mat3(3.4, 9.5, 19.5, 29.5, 16.0, 32.0, -64.0, -128.0, 256.0) ];
305        output mat3 out0 = [ mat3(-1.25, 1.25, -9.5, -12.2, -25.65, -7.25, 14.21, -77.7, 9.9) | mat3(0.0, 1.0, -1.0, 2.0, 2.25, 2.25, 22.5, 225.0, -9.9) | mat3(3.4, 9.5, 19.5, 29.5, 16.0, 32.0, -64.0, -128.0, 256.0) ];
306    }
307    vertex ""
308        ${VERTEX_DECLARATIONS}
309        varying mediump mat3 var;
310        void main()
311        {
312            var = in0;
313            ${VERTEX_OUTPUT}
314        }
315    ""
316    fragment ""
317        precision mediump float;
318        ${FRAGMENT_DECLARATIONS}
319        varying mat3 var;
320        void main()
321        {
322            out0 = var;
323            ${FRAGMENT_OUTPUT}
324        }
325    ""
326end
327
328case varying_type_mat4
329    desc "varying of type mat4"
330    values
331    {
332        input mat4 in0 = [ mat4(-1.25, 1.25, -9.5, -12.2, -25.65, -7.25, 14.21, -77.7, 0.0, 1.0, -1.0, 2.0, 2.25, 2.25, 22.5, 225.0) ];
333        output mat4 out0 = [ mat4(-1.25, 1.25, -9.5, -12.2, -25.65, -7.25, 14.21, -77.7, 0.0, 1.0, -1.0, 2.0, 2.25, 2.25, 22.5, 225.0) ];
334    }
335    vertex ""
336        ${VERTEX_DECLARATIONS}
337        varying mediump mat4 var;
338        void main()
339        {
340            var = in0;
341            ${VERTEX_OUTPUT}
342        }
343    ""
344    fragment ""
345        precision mediump float;
346        ${FRAGMENT_DECLARATIONS}
347        varying mat4 var;
348        void main()
349        {
350            out0 = var;
351            ${FRAGMENT_OUTPUT}
352        }
353    ""
354end
355
356# differing precision tests
357case varying_differing_precision_1
358    desc "varying declared as highp in vertex shader, but mediump in fragment shader"
359    values
360    {
361        input float in0 = [ -1.25 | -25.55 | 1.0 | 2.25 | 3.4 | 16.0 ];
362        output float out0 = [ -1.25 | -25.55 | 1.0 | 2.25 | 3.4 | 16.0 ];
363    }
364
365    vertex ""
366        ${VERTEX_DECLARATIONS}
367        varying highp float var;
368        void main()
369        {
370            var = in0;
371            ${VERTEX_OUTPUT}
372        }
373    ""
374    fragment ""
375        precision mediump float;
376        ${FRAGMENT_DECLARATIONS}
377        varying mediump float var;
378        void main()
379        {
380            out0 = var;
381            ${FRAGMENT_OUTPUT}
382        }
383    ""
384end
385
386# differing precision tests
387case varying_differing_precision_2
388    desc "varying declared as highp in vertex shader, but lowp in fragment shader"
389    values
390    {
391        input float in0 = [ -1.25 | -25.56 | 1.0 | 2.25 | 3.4 | 16.0 ];
392        output float out0 = [ -1.25 | -25.56 | 1.0 | 2.25 | 3.4 | 16.0 ];
393    }
394
395    vertex ""
396        ${VERTEX_DECLARATIONS}
397        varying highp vec2 var;
398        void main()
399        {
400            var = vec2(in0, 2.0*in0);
401            ${VERTEX_OUTPUT}
402        }
403    ""
404    fragment ""
405        precision mediump float;
406        ${FRAGMENT_DECLARATIONS}
407        varying lowp vec2 var;
408        void main()
409        {
410            out0 = var.y - var.x;
411            ${FRAGMENT_OUTPUT}
412        }
413    ""
414end
415
416# differing precision tests
417case varying_differing_precision_3
418    desc "varying declared as lowp in vertex shader, but mediump in fragment shader"
419    values
420    {
421        input float in0 = [ -1.25 | -25.0 | 1.0 | 2.25 | 3.4 | 16.0 ];
422        output float out0 = [ -1.25 | -25.0 | 1.0 | 2.25 | 3.4 | 16.0 ];
423    }
424
425    vertex ""
426        ${VERTEX_DECLARATIONS}
427        varying lowp vec4 var;
428        void main()
429        {
430            var = vec4(in0, 2.0*in0, -in0, -in0);
431            ${VERTEX_OUTPUT}
432        }
433    ""
434    fragment ""
435        precision mediump float;
436        ${FRAGMENT_DECLARATIONS}
437        varying mediump vec4 var;
438        void main()
439        {
440            out0 = var.x + var.y + var.z + var.w;
441            ${FRAGMENT_OUTPUT}
442        }
443    ""
444end
445
446# mismatched type, static use but no runtime use in the fragment shader
447case varying_type_mismatch_1
448    desc "varying type mismatch (float vs. vec2), static use but no runtime use in the fragment shader"
449    expect link_fail
450    vertex ""
451        ${VERTEX_DECLARATIONS}
452        varying mediump float var;
453        void main()
454        {
455            var = 2.0;
456            ${VERTEX_OUTPUT}
457        }
458    ""
459    fragment ""
460        varying mediump vec2 var;
461        void main()
462        {
463            if (false)
464            {
465                gl_FragColor = vec4(var.y);
466            }
467            else
468            {
469                ${FRAG_COLOR} = vec4(1.0);
470            }
471        }
472    ""
473end
474
475# mismatched type, varyings used
476case varying_type_mismatch_2
477    desc "varying type mismatch (float vs. vec2)"
478    expect link_fail
479    vertex ""
480        ${VERTEX_DECLARATIONS}
481        varying mediump float var;
482        void main()
483        {
484            var = 2.0;
485            ${VERTEX_OUTPUT}
486        }
487    ""
488    fragment ""
489        varying mediump vec2 var;
490        void main()
491        {
492            gl_FragColor = var.xyyx;
493        }
494    ""
495end
496
497# no declaration in vertex shader, but static use in fragment
498case varying_illegal_usage_1
499    desc "varying not declared in vertex shader, but statically used in fragment shader"
500    expect link_fail
501    vertex ""
502        ${VERTEX_DECLARATIONS}
503        void main()
504        {
505            ${VERTEX_OUTPUT}
506        }
507    ""
508    fragment ""
509        varying mediump float var;
510        void main()
511        {
512            gl_FragColor = vec4(var);
513        }
514    ""
515end
516
517# integer varyings not allowed
518case invalid_varying_type_int
519    desc "integer varying used"
520    expect compile_fail
521    vertex ""
522        ${VERTEX_DECLARATIONS}
523        varying mediump int var;
524        void main()
525        {
526            ${VERTEX_OUTPUT}
527        }
528    ""
529    fragment ""
530        varying mediump int var;
531        void main()
532        {
533            gl_FragColor = vec4(1.0);
534        }
535    ""
536end
537
538# bool varyings not allowed
539case invalid_varying_type_bool
540    desc "boolean varying used"
541    expect compile_fail
542    vertex ""
543        ${VERTEX_DECLARATIONS}
544        varying bool var;
545        void main()
546        {
547            ${VERTEX_OUTPUT}
548        }
549    ""
550    fragment ""
551        varying bool var;
552        void main()
553        {
554            gl_FragColor = vec4(1.0);
555        }
556    ""
557end
558
559# struct varyings not allowed
560case invalid_varying_type_struct
561    desc "struct varying used"
562    expect compile_fail
563    vertex ""
564        ${VERTEX_DECLARATIONS}
565        varying struct { mediump float foo; } var;
566        void main()
567        {
568            ${VERTEX_OUTPUT}
569        }
570    ""
571    fragment ""
572        varying struct { mediump float foo; } var;
573        void main()
574        {
575            gl_FragColor = vec4(1.0);
576        }
577    ""
578end
579
580case varying_readback_1
581    desc "read back (an already written) varying in the vertex shader"
582    values
583    {
584        input float in0 = [ 1.0 | 0.0 | -2.0 | 10.0 ];
585        output float out0 = [ 3.0 | 0.0 | -6.0 | 30.0 ];
586    }
587    vertex ""
588        precision mediump float;
589        ${VERTEX_DECLARATIONS}
590        varying float var1;
591        varying float var2;
592
593        void main()
594        {
595            var1 = in0;
596            var2 = var1 + in0;
597            ${VERTEX_OUTPUT}
598        }
599    ""
600    fragment ""
601        precision mediump float;
602        ${FRAGMENT_DECLARATIONS}
603        varying float var1;
604        varying float var2;
605
606        void main()
607        {
608            out0 = var1 + var2;
609            ${FRAGMENT_OUTPUT}
610        }
611    ""
612end
613
614case varying_writeback_1
615    desc "write back a varying in the fragment shader"
616    expect compile_fail
617    vertex ""
618        precision mediump float;
619        ${VERTEX_DECLARATIONS}
620        varying float var1;
621        varying float var2;
622
623        void main()
624        {
625            var1 = in0;
626            var2 = var1 + in0;
627            ${VERTEX_OUTPUT}
628        }
629    ""
630    fragment ""
631        precision mediump float;
632        ${FRAGMENT_DECLARATIONS}
633        varying float var1;
634        varying float var2;
635
636        void main()
637        {
638            var2 = var1;
639            out0 = var1;
640            ${FRAGMENT_OUTPUT}
641        }
642    ""
643end
644
645# Struct linkage handling
646case uniform_struct
647    desc "Same uniform struct in both shaders"
648    values {
649        uniform float val.a = 1.0;
650        uniform float val.b = 2.0;
651        output float out0 = 3.0;
652    }
653    vertex ""
654        ${VERTEX_DECLARATIONS}
655        struct Struct {mediump float a; mediump float b;};
656        uniform Struct val;
657        varying mediump float dummy;
658        void main()
659        {
660            dummy = val.a + val.b;
661            ${VERTEX_OUTPUT}
662        }
663    ""
664    fragment ""
665        precision mediump float;
666        struct Struct {mediump float a; mediump float b;};
667        uniform Struct val;
668        varying mediump float dummy;
669        ${FRAGMENT_DECLARATIONS}
670        void main()
671        {
672            out0 = val.b + val.a;
673            out0 = out0 + dummy;
674            out0 = out0 - dummy;
675            ${FRAGMENT_OUTPUT}
676        }
677    ""
678end
679
680case uniform_struct_vertex_only
681    desc "Uniform struct declared in both, used only in vertex."
682    values {
683        uniform float val.a = 1.0;
684        uniform float val.b = 2.0;
685        output float out0 = 3.0;
686    }
687    vertex ""
688        ${VERTEX_DECLARATIONS}
689        struct Struct {mediump float a; mediump float b;};
690        uniform Struct val;
691        varying mediump float res;
692        void main()
693        {
694            res = val.a + val.b;
695            ${VERTEX_OUTPUT}
696        }
697    ""
698    fragment ""
699        precision mediump float;
700        struct Struct {mediump float a; mediump float b;};
701        uniform Struct val;
702        varying mediump float res;
703        ${FRAGMENT_DECLARATIONS}
704        void main()
705        {
706            out0 = res;
707            ${FRAGMENT_OUTPUT}
708        }
709    ""
710end
711
712case uniform_struct_fragment_only
713    desc "Uniform struct declared in both, used only in fragment."
714    values {
715        uniform float val.a = 1.0;
716        uniform float val.b = 2.0;
717        output float out0 = 3.0;
718    }
719    vertex ""
720        ${VERTEX_DECLARATIONS}
721        struct Struct {mediump float a; mediump float b;};
722        uniform Struct val;
723        void main()
724        {
725            ${VERTEX_OUTPUT}
726        }
727    ""
728    fragment ""
729        precision mediump float;
730        struct Struct {mediump float a; mediump float b;};
731        uniform Struct val;
732        ${FRAGMENT_DECLARATIONS}
733        void main()
734        {
735            out0 = val.a + val.b;
736            ${FRAGMENT_OUTPUT}
737        }
738    ""
739end
740
741case uniform_struct_partial
742    desc "Uniform struct declared in both, used partially in both."
743    values {
744        uniform float val.a = 1.0;
745        uniform float val.b = 2.0;
746        output float out0 = 3.0;
747    }
748    vertex ""
749        ${VERTEX_DECLARATIONS}
750        struct Struct {mediump float a; mediump float b;};
751        uniform Struct val;
752        varying mediump float res;
753        void main()
754        {
755            res = val.a;
756            ${VERTEX_OUTPUT}
757        }
758    ""
759    fragment ""
760        precision mediump float;
761        struct Struct {mediump float a; mediump float b;};
762        uniform Struct val;
763        ${FRAGMENT_DECLARATIONS}
764        varying mediump float res;
765        void main()
766        {
767            out0 = res + val.b;
768            ${FRAGMENT_OUTPUT}
769        }
770    ""
771end
772
773case uniform_struct_vec4
774    desc "Same uniform struct in both shaders. Datatype vec4"
775    values {
776        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
777        uniform vec4 val.b = vec4(1.0, 2.0, 3.0, 4.0);
778        output float out0 = 3.0;
779    }
780    vertex ""
781        ${VERTEX_DECLARATIONS}
782        struct Struct {mediump vec4 a; mediump vec4 b;};
783        uniform Struct val;
784        varying mediump float dummy;
785        void main()
786        {
787            dummy = val.a.x + val.b.y;
788            ${VERTEX_OUTPUT}
789        }
790    ""
791    fragment ""
792        precision mediump float;
793        struct Struct {mediump vec4 a; mediump vec4 b;};
794        uniform Struct val;
795        varying mediump float dummy;
796        ${FRAGMENT_DECLARATIONS}
797        void main()
798        {
799            out0 = val.b.y + val.a.x;
800            out0 = out0 + dummy;
801            out0 = out0 - dummy;
802            ${FRAGMENT_OUTPUT}
803        }
804    ""
805end
806
807case uniform_struct_vertex_only_vec4
808    desc "Uniform struct declared in both, used only in vertex. Datatype vec4    "
809    values {
810        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
811        uniform vec4 val.b = vec4(1.0, 2.0, 3.0, 4.0);
812        output float out0 = 3.0;
813    }
814    vertex ""
815        ${VERTEX_DECLARATIONS}
816        struct Struct {mediump vec4 a; mediump vec4 b;};
817        uniform Struct val;
818        varying mediump float res;
819        void main()
820        {
821            res = val.a.x + val.b.y;
822            ${VERTEX_OUTPUT}
823        }
824    ""
825    fragment ""
826        precision mediump float;
827        struct Struct {mediump vec4 a; mediump vec4 b;};
828        uniform Struct val;
829        varying mediump float res;
830        ${FRAGMENT_DECLARATIONS}
831        void main()
832        {
833            out0 = res;
834            ${FRAGMENT_OUTPUT}
835        }
836    ""
837end
838
839case uniform_struct_fragment_only_vec4
840    desc "Uniform struct declared in both, used only in fragment. Datatype vec4"
841    values {
842        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
843        uniform vec4 val.b = vec4(1.0, 2.0, 3.0, 4.0);
844        output float out0 = 3.0;
845    }
846    vertex ""
847        ${VERTEX_DECLARATIONS}
848        struct Struct {mediump vec4 a; mediump vec4 b;};
849        uniform Struct val;
850        void main()
851        {
852            ${VERTEX_OUTPUT}
853        }
854    ""
855    fragment ""
856        precision mediump float;
857        struct Struct {mediump vec4 a; mediump vec4 b;};
858        uniform Struct val;
859        ${FRAGMENT_DECLARATIONS}
860        void main()
861        {
862            out0 = val.a.x + val.b.y;
863            ${FRAGMENT_OUTPUT}
864        }
865    ""
866end
867
868case uniform_struct_partial_vec4
869    desc "Uniform struct declared in both, used partially in both. Datatype vec4"
870    values {
871        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
872        uniform vec4 val.b = vec4(1.0, 2.0, 3.0, 4.0);
873        output float out0 = 3.0;
874    }
875    vertex ""
876        ${VERTEX_DECLARATIONS}
877        struct Struct {mediump vec4 a; mediump vec4 b;};
878        uniform Struct val;
879        varying mediump float res;
880        void main()
881        {
882            res = val.a.x;
883            ${VERTEX_OUTPUT}
884        }
885    ""
886    fragment ""
887        precision mediump float;
888        struct Struct {mediump vec4 a; mediump vec4 b;};
889        uniform Struct val;
890        ${FRAGMENT_DECLARATIONS}
891        varying mediump float res;
892        void main()
893        {
894            out0 = res + val.b.y;
895            ${FRAGMENT_OUTPUT}
896        }
897    ""
898end
899
900case uniform_struct_vec4_vec3
901    desc "Same uniform struct in both shaders. Datatype vec4 and vec3"
902    values {
903        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
904        uniform vec3 val.b = vec3(1.0, 2.0, 3.0);
905        output float out0 = 3.0;
906    }
907    vertex ""
908        ${VERTEX_DECLARATIONS}
909        struct Struct {mediump vec4 a; mediump vec3 b;};
910        uniform Struct val;
911        varying mediump float dummy;
912        void main()
913        {
914            dummy = val.a.x + val.b.y;
915            ${VERTEX_OUTPUT}
916        }
917    ""
918    fragment ""
919        precision mediump float;
920        struct Struct {mediump vec4 a; mediump vec3 b;};
921        uniform Struct val;
922        varying mediump float dummy;
923        ${FRAGMENT_DECLARATIONS}
924        void main()
925        {
926            out0 = val.b.y + val.a.x;
927            out0 = out0 + dummy;
928            out0 = out0 - dummy;
929            ${FRAGMENT_OUTPUT}
930        }
931    ""
932end
933
934case uniform_struct_vertex_only_vec4_vec3
935    desc "Uniform struct declared in both, used only in vertex. Datatype vec4 and vec3"
936    values {
937        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
938        uniform vec3 val.b = vec3(1.0, 2.0, 3.0);
939        output float out0 = 3.0;
940    }
941    vertex ""
942        ${VERTEX_DECLARATIONS}
943        struct Struct {mediump vec4 a; mediump vec3 b;};
944        uniform Struct val;
945        varying mediump float res;
946        void main()
947        {
948            res = val.a.x + val.b.y;
949            ${VERTEX_OUTPUT}
950        }
951    ""
952    fragment ""
953        precision mediump float;
954        struct Struct {mediump vec4 a; mediump vec3 b;};
955        uniform Struct val;
956        varying mediump float res;
957        ${FRAGMENT_DECLARATIONS}
958        void main()
959        {
960            out0 = res;
961            ${FRAGMENT_OUTPUT}
962        }
963    ""
964end
965
966case uniform_struct_fragment_only_vec4_vec3
967    desc "Uniform struct declared in both, used only in fragment. Datatype vec4 and vec3"
968    values {
969        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
970        uniform vec3 val.b = vec3(1.0, 2.0, 3.0);
971        output float out0 = 3.0;
972    }
973    vertex ""
974        ${VERTEX_DECLARATIONS}
975        struct Struct {mediump vec4 a; mediump vec3 b;};
976        uniform Struct val;
977        void main()
978        {
979            ${VERTEX_OUTPUT}
980        }
981    ""
982    fragment ""
983        precision mediump float;
984        struct Struct {mediump vec4 a; mediump vec3 b;};
985        uniform Struct val;
986        ${FRAGMENT_DECLARATIONS}
987        void main()
988        {
989            out0 = val.a.x + val.b.y;
990            ${FRAGMENT_OUTPUT}
991        }
992    ""
993end
994
995case uniform_struct_partial_vec4_vec3
996    desc "Uniform struct declared in both, used partially in both. Datatype vec4 and vec3"
997    values {
998        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
999        uniform vec3 val.b = vec3(1.0, 2.0, 3.0);
1000        output float out0 = 3.0;
1001    }
1002    vertex ""
1003        ${VERTEX_DECLARATIONS}
1004        struct Struct {mediump vec4 a; mediump vec3 b;};
1005        uniform Struct val;
1006        varying mediump float res;
1007        void main()
1008        {
1009            res = val.a.x;
1010            ${VERTEX_OUTPUT}
1011        }
1012    ""
1013    fragment ""
1014        precision mediump float;
1015        struct Struct {mediump vec4 a; mediump vec3 b;};
1016        uniform Struct val;
1017        ${FRAGMENT_DECLARATIONS}
1018        varying mediump float res;
1019        void main()
1020        {
1021            out0 = res + val.b.y;
1022            ${FRAGMENT_OUTPUT}
1023        }
1024    ""
1025end
1026
1027case uniform_struct_vec4_float
1028    desc "Same uniform struct in both shaders. Datatype vec4 and float"
1029    values {
1030        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
1031        uniform float val.b = 2.0;
1032        output float out0 = 3.0;
1033    }
1034    vertex ""
1035        ${VERTEX_DECLARATIONS}
1036        struct Struct {mediump vec4 a; mediump float b;};
1037        uniform Struct val;
1038        varying mediump float dummy;
1039        void main()
1040        {
1041            dummy = val.a.x + val.b;
1042            ${VERTEX_OUTPUT}
1043        }
1044    ""
1045    fragment ""
1046        precision mediump float;
1047        struct Struct {mediump vec4 a; mediump float b;};
1048        uniform Struct val;
1049        varying mediump float dummy;
1050        ${FRAGMENT_DECLARATIONS}
1051        void main()
1052        {
1053            out0 = val.b + val.a.x;
1054            out0 = out0 + dummy;
1055            out0 = out0 - dummy;
1056            ${FRAGMENT_OUTPUT}
1057        }
1058    ""
1059end
1060
1061case uniform_struct_vertex_only_vec4_float
1062    desc "Uniform struct declared in both, used only in vertex. Datatype vec4 and float"
1063    values {
1064        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
1065        uniform float val.b = 2.0;
1066        output float out0 = 3.0;
1067    }
1068    vertex ""
1069        ${VERTEX_DECLARATIONS}
1070        struct Struct {mediump vec4 a; mediump float b;};
1071        uniform Struct val;
1072        varying mediump float res;
1073        void main()
1074        {
1075            res = val.a.x + val.b;
1076            ${VERTEX_OUTPUT}
1077        }
1078    ""
1079    fragment ""
1080        precision mediump float;
1081        struct Struct {mediump vec4 a; mediump float b;};
1082        uniform Struct val;
1083        varying mediump float res;
1084        ${FRAGMENT_DECLARATIONS}
1085        void main()
1086        {
1087            out0 = res;
1088            ${FRAGMENT_OUTPUT}
1089        }
1090    ""
1091end
1092
1093case uniform_struct_fragment_only_vec4_float
1094    desc "Uniform struct declared in both, used only in fragment. Datatype vec4 and float"
1095    values {
1096        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
1097        uniform float val.b = 2.0;
1098        output float out0 = 3.0;
1099    }
1100    vertex ""
1101        ${VERTEX_DECLARATIONS}
1102        struct Struct {mediump vec4 a; mediump float b;};
1103        uniform Struct val;
1104        void main()
1105        {
1106            ${VERTEX_OUTPUT}
1107        }
1108    ""
1109    fragment ""
1110        precision mediump float;
1111        struct Struct {mediump vec4 a; mediump float b;};
1112        uniform Struct val;
1113        ${FRAGMENT_DECLARATIONS}
1114        void main()
1115        {
1116            out0 = val.a.x + val.b;
1117            ${FRAGMENT_OUTPUT}
1118        }
1119    ""
1120end
1121
1122case uniform_struct_partial_vec4_float
1123    desc "Uniform struct declared in both, used partially in both. Datatype vec4 and float"
1124    values {
1125        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
1126        uniform float val.b = 2.0;
1127        output float out0 = 3.0;
1128    }
1129    vertex ""
1130        ${VERTEX_DECLARATIONS}
1131        struct Struct {mediump vec4 a; mediump float b;};
1132        uniform Struct val;
1133        varying mediump float res;
1134        void main()
1135        {
1136            res = val.a.x;
1137            ${VERTEX_OUTPUT}
1138        }
1139    ""
1140    fragment ""
1141        precision mediump float;
1142        struct Struct {mediump vec4 a; mediump float b;};
1143        uniform Struct val;
1144        ${FRAGMENT_DECLARATIONS}
1145        varying mediump float res;
1146        void main()
1147        {
1148            out0 = res + val.b;
1149            ${FRAGMENT_OUTPUT}
1150        }
1151    ""
1152end
1153
1154case uniform_struct_partial_vec4_struct
1155    desc "Uniform struct declared in both, used partially in both. Datatype vec4 and struct with vec4"
1156    values {
1157        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
1158        uniform vec4 val.b.c = vec4(1.0, 2.0, 3.0, 4.0);
1159        output float out0 = 3.0;
1160    }
1161    vertex ""
1162        ${VERTEX_DECLARATIONS}
1163        struct Inner {mediump vec4 c;};
1164        struct Struct {mediump vec4 a; Inner b;};
1165        uniform Struct val;
1166        varying mediump float res;
1167        void main()
1168        {
1169            res = val.a.x;
1170            ${VERTEX_OUTPUT}
1171        }
1172    ""
1173    fragment ""
1174        precision mediump float;
1175        struct Inner {mediump vec4 c;};
1176        struct Struct {mediump vec4 a; Inner b;};
1177        uniform Struct val;
1178        ${FRAGMENT_DECLARATIONS}
1179        varying mediump float res;
1180        void main()
1181        {
1182            out0 = res + val.b.c.y;
1183            ${FRAGMENT_OUTPUT}
1184        }
1185    ""
1186end
1187
1188
1189
1190case uniform_struct_partial_vec4_vec3_struct
1191    desc "Uniform struct declared in both, used partially in both. Datatype vec4 and struct with vec3"
1192    values {
1193        uniform vec4 val.a = vec4(1.0, 2.0, 3.0, 4.0);
1194        uniform vec3 val.b.c = vec3(1.0, 2.0, 3.0);
1195        output float out0 = 3.0;
1196    }
1197    vertex ""
1198        ${VERTEX_DECLARATIONS}
1199        struct Inner {mediump vec3 c;};
1200        struct Struct {mediump vec4 a; Inner b;};
1201        uniform Struct val;
1202        varying mediump float res;
1203        void main()
1204        {
1205            res = val.a.x;
1206            ${VERTEX_OUTPUT}
1207        }
1208    ""
1209    fragment ""
1210        precision mediump float;
1211        struct Inner {mediump vec3 c;};
1212        struct Struct {mediump vec4 a; Inner b;};
1213        uniform Struct val;
1214        ${FRAGMENT_DECLARATIONS}
1215        varying mediump float res;
1216        void main()
1217        {
1218            out0 = res + val.b.c.y;
1219            ${FRAGMENT_OUTPUT}
1220        }
1221    ""
1222end
1223
1224case uniform_struct_partial_vec2_vec3
1225    desc "Uniform struct declared in both, used partially in both. Datatype vec2 and vec3"
1226    values {
1227        uniform vec2 val.a = vec2(1.0, 2.0);
1228        uniform vec3 val.b = vec3(1.0, 2.0, 3.0);
1229        output float out0 = 3.0;
1230    }
1231    vertex ""
1232        ${VERTEX_DECLARATIONS}
1233        struct Struct {mediump vec2 a; mediump vec3 b;};
1234        uniform Struct val;
1235        varying mediump float res;
1236        void main()
1237        {
1238            res = val.a.x;
1239            ${VERTEX_OUTPUT}
1240        }
1241    ""
1242    fragment ""
1243        precision mediump float;
1244        struct Struct {mediump vec2 a; mediump vec3 b;};
1245        uniform Struct val;
1246        ${FRAGMENT_DECLARATIONS}
1247        varying mediump float res;
1248        void main()
1249        {
1250            out0 = res + val.b.y;
1251            ${FRAGMENT_OUTPUT}
1252        }
1253    ""
1254end
1255
1256case uniform_struct_partial_vec2_int
1257    desc "Uniform struct declared in both, used partially in both. Datatype vec2 and int"
1258    values {
1259        uniform vec2 val.a = vec2(1.0, 2.0);
1260        uniform int val.b = 2;
1261        output float out0 = 3.0;
1262    }
1263    vertex ""
1264        ${VERTEX_DECLARATIONS}
1265        struct Struct {mediump vec2 a; mediump int b;};
1266        uniform Struct val;
1267        varying mediump float res;
1268        void main()
1269        {
1270            res = val.a.x;
1271            ${VERTEX_OUTPUT}
1272        }
1273    ""
1274    fragment ""
1275        precision mediump float;
1276        struct Struct {mediump vec2 a; mediump int b;};
1277        uniform Struct val;
1278        ${FRAGMENT_DECLARATIONS}
1279        varying mediump float res;
1280        void main()
1281        {
1282            out0 = res + float(val.b);
1283            ${FRAGMENT_OUTPUT}
1284        }
1285    ""
1286end
1287
1288case uniform_struct_partial_int_float
1289    desc "Uniform struct declared in both, used partially in both. Datatype int and float"
1290    values {
1291        uniform float val.a = 1.0;
1292        uniform int val.b = 2;
1293        output float out0 = 3.0;
1294    }
1295    vertex ""
1296        ${VERTEX_DECLARATIONS}
1297        struct Struct {mediump float a; mediump int b;};
1298        uniform Struct val;
1299        varying mediump float res;
1300        void main()
1301        {
1302            res = val.a;
1303            ${VERTEX_OUTPUT}
1304        }
1305    ""
1306    fragment ""
1307        precision mediump float;
1308        struct Struct {mediump float a; mediump int b;};
1309        uniform Struct val;
1310        ${FRAGMENT_DECLARATIONS}
1311        varying mediump float res;
1312        void main()
1313        {
1314            out0 = res + float(val.b);
1315            ${FRAGMENT_OUTPUT}
1316        }
1317    ""
1318end
1319
1320case uniform_struct_partial_bvec2_vec2
1321    desc "Uniform struct declared in both, used partially in both. Datatype bvec2 and vec2"
1322    values {
1323        uniform bvec2 val.a = bvec2(true, true);
1324        uniform vec2 val.b = vec2(1.0, 2.0);
1325        output float out0 = 3.0;
1326    }
1327    vertex ""
1328        ${VERTEX_DECLARATIONS}
1329        struct Struct {bvec2 a; mediump vec2 b;};
1330        uniform Struct val;
1331        varying mediump float res;
1332        void main()
1333        {
1334            res = float(val.a.x);
1335            ${VERTEX_OUTPUT}
1336        }
1337    ""
1338    fragment ""
1339        precision mediump float;
1340        struct Struct {bvec2 a; mediump vec2 b;};
1341        uniform Struct val;
1342        ${FRAGMENT_DECLARATIONS}
1343        varying mediump float res;
1344        void main()
1345        {
1346            out0 = res + val.b.y;
1347            ${FRAGMENT_OUTPUT}
1348        }
1349    ""
1350end
1351
1352case uniform_struct_partial_ivec2_vec2
1353    desc "Uniform struct declared in both, used partially in both. Datatype ivec2 and vec2"
1354    values {
1355        uniform ivec2 val.a = ivec2(1, 2);
1356        uniform vec2 val.b = vec2(1.0, 2.0);
1357        output float out0 = 3.0;
1358    }
1359    vertex ""
1360        ${VERTEX_DECLARATIONS}
1361        struct Struct {mediump ivec2 a; mediump vec2 b;};
1362        uniform Struct val;
1363        varying mediump float res;
1364        void main()
1365        {
1366            res = vec2(val.a).x;
1367            ${VERTEX_OUTPUT}
1368        }
1369    ""
1370    fragment ""
1371        precision mediump float;
1372        struct Struct {mediump ivec2 a; mediump vec2 b;};
1373        uniform Struct val;
1374        ${FRAGMENT_DECLARATIONS}
1375        varying mediump float res;
1376        void main()
1377        {
1378            out0 = res + val.b.y;
1379            ${FRAGMENT_OUTPUT}
1380        }
1381    ""
1382end
1383
1384case uniform_struct_partial_ivec2_ivec2
1385    desc "Uniform struct declared in both, used partially in both. Datatype ivec2 and ivec2"
1386    values {
1387        uniform ivec2 val.a = ivec2(1, 2);
1388        uniform ivec2 val.b = ivec2(1, 2);
1389        output float out0 = 3.0;
1390    }
1391    vertex ""
1392        ${VERTEX_DECLARATIONS}
1393        struct Struct {mediump ivec2 a; mediump ivec2 b;};
1394        uniform Struct val;
1395        varying mediump float res;
1396        void main()
1397        {
1398            res = vec2(val.a).x;
1399            ${VERTEX_OUTPUT}
1400        }
1401    ""
1402    fragment ""
1403        precision mediump float;
1404        struct Struct {mediump ivec2 a; mediump ivec2 b;};
1405        uniform Struct val;
1406        ${FRAGMENT_DECLARATIONS}
1407        varying mediump float res;
1408        void main()
1409        {
1410            out0 = res + vec2(val.b).y;
1411            ${FRAGMENT_OUTPUT}
1412        }
1413    ""
1414end
1415
1416case uniform_struct_type_conflict_1
1417    desc "Fragment struct has one less member than fragment version"
1418    expect link_fail
1419    values {output float out0 = 3.0;}
1420    vertex ""
1421        ${VERTEX_DECLARATIONS}
1422        struct Struct {mediump float a; mediump float b;};
1423        uniform Struct val;
1424        varying mediump float res;
1425        void main()
1426        {
1427            res = val.a;
1428            ${VERTEX_OUTPUT}
1429        }
1430    ""
1431    fragment ""
1432        precision mediump float;
1433        struct Struct {mediump float a;};
1434        uniform Struct val;
1435        ${FRAGMENT_DECLARATIONS}
1436        varying mediump float res;
1437        void main()
1438        {
1439            out0 = res + val.a;
1440            ${FRAGMENT_OUTPUT}
1441        }
1442    ""
1443end
1444
1445case uniform_struct_type_conflict_2
1446    desc "Vertex struct has int, fragment struct has float."
1447    expect link_fail
1448    values {output float out0 = 3.0;}
1449    vertex ""
1450        ${VERTEX_DECLARATIONS}
1451        struct Struct {mediump int a;};
1452        uniform Struct val;
1453        varying mediump float res;
1454        void main()
1455        {
1456            res = float(val.a);
1457            ${VERTEX_OUTPUT}
1458        }
1459    ""
1460    fragment ""
1461        precision mediump float;
1462        struct Struct {mediump float a;};
1463        uniform Struct val;
1464        ${FRAGMENT_DECLARATIONS}
1465        varying mediump float res;
1466        void main()
1467        {
1468            out0 = val.a;
1469            ${FRAGMENT_OUTPUT}
1470        }
1471    ""
1472end
1473
1474case uniform_struct_type_conflict_3
1475    desc "Vertex struct has vec3, fragment struct has vec4."
1476    expect link_fail
1477    values {output float out0 = 3.0;}
1478    vertex ""
1479        ${VERTEX_DECLARATIONS}
1480        struct Struct {mediump vec3 a;};
1481        uniform Struct val;
1482        varying mediump float res;
1483        void main()
1484        {
1485            res = float(val.a.x);
1486            ${VERTEX_OUTPUT}
1487        }
1488    ""
1489    fragment ""
1490        precision mediump float;
1491        struct Struct {mediump vec4 a;};
1492        uniform Struct val;
1493        ${FRAGMENT_DECLARATIONS}
1494        varying mediump float res;
1495        void main()
1496        {
1497            out0 = val.a.x;
1498            ${FRAGMENT_OUTPUT}
1499        }
1500    ""
1501end
1502
1503case uniform_struct_precision_conflict_1
1504    desc "Vertex side struct has highp, fragment side struct mediump."
1505    expect link_fail
1506    values {output float out0 = 3.0;}
1507    vertex ""
1508        ${VERTEX_DECLARATIONS}
1509        struct Struct {highp float a;};
1510        uniform Struct val;
1511        varying mediump float res;
1512        void main()
1513        {
1514            res = val.a;
1515            ${VERTEX_OUTPUT}
1516        }
1517    ""
1518    fragment ""
1519        precision mediump float;
1520        struct Struct {mediump float a;};
1521        uniform Struct val;
1522        ${FRAGMENT_DECLARATIONS}
1523        varying mediump float res;
1524        void main()
1525        {
1526            out0 = val.a;
1527            ${FRAGMENT_OUTPUT}
1528        }
1529    ""
1530end
1531
1532case uniform_struct_precision_conflict_2
1533    desc "Vertex side struct has mediump, fragment side struct lowp."
1534    expect link_fail
1535    values {output float out0 = 3.0;}
1536    vertex ""
1537        ${VERTEX_DECLARATIONS}
1538        struct Struct {mediump float a;};
1539        uniform Struct val;
1540        varying mediump float res;
1541        void main()
1542        {
1543            res = val.a;
1544            ${VERTEX_OUTPUT}
1545        }
1546    ""
1547    fragment ""
1548        precision mediump float;
1549        struct Struct {lowp float a;};
1550        uniform Struct val;
1551        ${FRAGMENT_DECLARATIONS}
1552        varying mediump float res;
1553        void main()
1554        {
1555            out0 = val.a;
1556            ${FRAGMENT_OUTPUT}
1557        }
1558    ""
1559end
1560
1561case uniform_struct_precision_conflict_3
1562    desc "Vertex side struct has lowp, fragment side struct mediump."
1563    expect link_fail
1564    values {output float out0 = 3.0;}
1565    vertex ""
1566        ${VERTEX_DECLARATIONS}
1567        struct Struct {lowp float a;};
1568        uniform Struct val;
1569        varying mediump float res;
1570        void main()
1571        {
1572            res = val.a;
1573            ${VERTEX_OUTPUT}
1574        }
1575    ""
1576    fragment ""
1577        precision mediump float;
1578        struct Struct {mediump float a;};
1579        uniform Struct val;
1580        ${FRAGMENT_DECLARATIONS}
1581        varying mediump float res;
1582        void main()
1583        {
1584            out0 = val.a;
1585            ${FRAGMENT_OUTPUT}
1586        }
1587    ""
1588end
1589
1590case uniform_struct_precision_conflict_4
1591    desc "Vertex side struct has lowp, fragment side struct implicit mediump."
1592    expect link_fail
1593    values {output float out0 = 3.0;}
1594    vertex ""
1595        ${VERTEX_DECLARATIONS}
1596        struct Struct {lowp float a;};
1597        uniform Struct val;
1598        varying mediump float res;
1599        void main()
1600        {
1601            res = val.a;
1602            ${VERTEX_OUTPUT}
1603        }
1604    ""
1605    fragment ""
1606        precision mediump float;
1607        struct Struct {float a;};
1608        uniform Struct val;
1609        ${FRAGMENT_DECLARATIONS}
1610        varying mediump float res;
1611        void main()
1612        {
1613            out0 = val.a;
1614            ${FRAGMENT_OUTPUT}
1615        }
1616    ""
1617end
1618
1619case uniform_struct_use_case_rip
1620    desc "Complex Light struct from use case tests."
1621    values {
1622        uniform float val.constantAttenuation = 1.0;
1623        uniform float val.quadraticAttenuation = 1.0;
1624        output float out0 = 2.0;
1625    }
1626    vertex ""
1627         struct Light
1628         {
1629             mediump vec3    color;
1630             highp vec4        position;
1631             highp vec3        direction;
1632             mediump float    constantAttenuation;
1633             mediump float    linearAttenuation;
1634             mediump float    quadraticAttenuation;
1635        };
1636        ${VERTEX_DECLARATIONS}
1637        uniform Light val;
1638        varying mediump float res;
1639        void main()
1640        {
1641            res = val.constantAttenuation;
1642            ${VERTEX_OUTPUT}
1643        }
1644    ""
1645    fragment ""
1646         precision mediump float;
1647         struct Light
1648         {
1649             mediump vec3    color;
1650             highp vec4        position;
1651             highp vec3        direction;
1652             mediump float    constantAttenuation;
1653             mediump float    linearAttenuation;
1654             mediump float    quadraticAttenuation;
1655        };
1656        struct Struct {float a;};
1657        uniform Light val;
1658        ${FRAGMENT_DECLARATIONS}
1659        varying mediump float res;
1660        void main()
1661        {
1662            out0 = res + val.quadraticAttenuation;
1663            ${FRAGMENT_OUTPUT}
1664        }
1665    ""
1666end
1667
1668case uniform_struct_use_case_rip_sans_highp
1669    desc "Complex Light struct from use case tests, without highp usage"
1670    values {
1671        uniform float val.constantAttenuation = 1.0;
1672        uniform float val.quadraticAttenuation = 1.0;
1673        output float out0 = 2.0;
1674    }
1675    vertex ""
1676         struct Light
1677         {
1678             mediump vec3    color;
1679             mediump vec4    position;
1680             mediump vec3    direction;
1681             mediump float    constantAttenuation;
1682             mediump float    linearAttenuation;
1683             mediump float    quadraticAttenuation;
1684        };
1685        ${VERTEX_DECLARATIONS}
1686        uniform Light val;
1687        varying mediump float res;
1688        void main()
1689        {
1690            res = val.constantAttenuation;
1691            ${VERTEX_OUTPUT}
1692        }
1693    ""
1694    fragment ""
1695         precision mediump float;
1696         struct Light
1697         {
1698             mediump vec3    color;
1699             mediump vec4    position;
1700             mediump vec3    direction;
1701             mediump float    constantAttenuation;
1702             mediump float    linearAttenuation;
1703             mediump float    quadraticAttenuation;
1704        };
1705        struct Struct {float a;};
1706        uniform Light val;
1707        ${FRAGMENT_DECLARATIONS}
1708        varying mediump float res;
1709        void main()
1710        {
1711            out0 = res + val.quadraticAttenuation;
1712            ${FRAGMENT_OUTPUT}
1713        }
1714    ""
1715end
1716