summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/conformance/ogles/GL/build/CorrectFull_vert.vert
blob: 30f14ad27bd1bbd4708616e2a3477fbcb7e51349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
/*
Copyright (c) 2019 The Khronos Group Inc.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE.txt file.
*/


struct gtf_MaterialParameters
{
vec4 emission;
vec4 ambient;
vec4 diffuse;
vec4 specular;
float shininess;
};
struct gtf_LightSourceParameters
{
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec4 position;
vec4 halfVector;
vec3 spotDirection;
float spotExponent;
float spotCutoff;
float spotCosCutoff;
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
};
struct gtf_PointParameters {
float size;
float sizeMin;
float sizeMax;
float fadeThresholdSize;
float distanceConstantAttenuation;
float distanceLinearAttenuation;
float distanceQuadraticAttenuation;
};
struct gtf_DepthRangeParameters {
float near;
float far;
float diff;
};
struct gtf_LightModelParameters {
vec4 ambient;
};
struct gtf_LightModelProducts {
vec4 sceneColor;
};
struct gtf_LightProducts {
vec4 ambient;
vec4 diffuse;
vec4 specular;
};
struct gtf_FogParameters {
vec4 color;
float density;
float start;
float end;
float scale;
};
uniform int gtf_MaxFragmentUniformComponents;
uniform int gtf_MaxVertexUniformComponents;
uniform int gtf_MaxVertexTextureImageUnits;
uniform int gtf_MaxLights;
uniform int gtf_MaxClipPlanes;
uniform int gtf_MaxCombinedTextureImageUnits;
uniform int gtf_MaxTextureCoords;
uniform int gtf_MaxVertexAttribs;
uniform int gtf_MaxVaryingFloats;
uniform int gtf_MaxTextureUnits;
uniform int gtf_MaxDrawBuffers;
uniform int gtf_MaxTextureImageUnits;
uniform gtf_LightProducts gtf_FrontLightProduct[8];
uniform gtf_LightModelProducts gtf_FrontLightModelProduct;
uniform gtf_DepthRangeParameters gtf_DepthRange;
uniform gtf_FogParameters gtf_Fog;
uniform gtf_PointParameters gtf_Point;
uniform gtf_LightModelParameters gtf_LightModel;
varying vec4 gtf_FogFragCoord;
varying vec4 gtf_BackColor;
varying vec4 gtf_BackSecondaryColor;
varying vec4 gtf_FrontSecondaryColor;
varying vec4 gtf_TexCoord[2];
varying vec4 gtf_FrontColor;
uniform gtf_MaterialParameters gtf_FrontMaterial;
uniform gtf_LightSourceParameters gtf_LightSource[8];
attribute vec4 gtf_MultiTexCoord1;
attribute vec4 gtf_MultiTexCoord2;
attribute vec4 gtf_SecondaryColor;
attribute vec4 gtf_Color;
attribute vec4 gtf_MultiTexCoord3;
attribute vec4 gtf_MultiTexCoord0;
attribute vec4 gtf_Normal;
attribute vec4 gtf_Vertex;
uniform mat4 gtf_NormalMatrix;
uniform mat4 gtf_ProjectionMatrix;
uniform mat4 gtf_TextureMatrix[8];
uniform mat4 gtf_ModelViewMatrix;
uniform mat4 gtf_ModelViewProjectionMatrix;
void test_function(const in int in_int, inout int out_int);
int test_function1(in int in_int1, inout int in_out_int);

uniform float array_float[2];

struct nested
{
   int a;
   float f;
};

struct light1
{
   float intensity;
   vec3 position;
   int test_int[2];
   nested light2;
} lightVar;
light1 ll2;

void Assign (out light1 out1, in light1 in1)
{
    out1.intensity = in1.intensity;
     out1.position = in1.position;
  out1.test_int[0] = in1.test_int[0];
  out1.test_int[1] = in1.test_int[1];
       out1.light2 = in1.light2;
}

struct light3 {
    float i;
};

struct light4 {
    float i;
};

struct light5 {
    float i ;
    float a[2];
} light5_inst;

uniform light3 uniformLight3;

struct light6 {
    float i;
};
uniform light6 uniformLight6;

struct slight10{
     float f;
     };
struct slight9{
     slight10 light10;
     };
struct slight8{
     slight9 light9;
     };
struct light7 {
  slight8 light8;
} ;


light3 struct_var = light3(5.0);

// Attribtue variables can only be Global
attribute float flt_attrib;
attribute vec2 vec2_attrib;
attribute vec3 vec3_attrib;
attribute vec4 vec4_attrib;
attribute mat2 mat2_attrib;
attribute mat3 mat3_attrib;
attribute mat4 mat4_attrib;

uniform float flt_uniform;
uniform vec3 uniform_vec3;
uniform mat3 uniform_mat3;

uniform sampler2D samp[3];
uniform sampler2D samp1;

const struct light12 {
    int a;
} uniform_struct = light12(2);

varying vec3 varying_vec3;
varying vec2 varying_vec2;
varying vec4 varying_vec4;
varying mat4 varying_mat4;
varying mat2 varying_mat2;
varying mat3 varying_mat3;
varying float varying_flt;

float frequencies[2];

void test_function2(int func_int)
{
}

void test_function3(light3);
void test_function4(light5 ll20);
void test_function5(light1);
light6 test_function6(int a);

const float FloatConst1 = 3.0 * 8.0, floatConst2 = 4.0;
const bool BoolConst1 = true && true || false;
const bool BoolConst2 = false || !false && false;

void main(void)
{

    int test_int1 = 2;
    const int const_test_int1 = 2;

    struct structMain {
        float i;
    } testStruct;

    struct {
        structMain a;
    } aStruct;

    testStruct.i = 5.0 ;
    struct_var.i = 5.0;

    structMain newStruct, newStruct1;
    testStruct = newStruct;
    newStruct = newStruct1;

    lightVar.light2.f = 1.1;

    light1 ll1;
    ll1.light2.a = 1;

     const struct const_struct {
        float i;
    } const_struct_inst = const_struct(1.0);

    //ll1 = ll2;
    Assign (ll1, ll2);
    ll1.light2 = ll2.light2;
    ll1.light2 = ll1.light2;
    ll1.light2.f = ll2.light2.f;
    ll1.light2.f = ll1.light2.f;

    //    lightVar = ll2;
    //    ll2 = lightVar;
    Assign (lightVar, ll2);
    Assign (ll2, lightVar);

    light5 ll10;

    light7 ll7[4];
    structMain newStruct2[2];
    newStruct2[0].i = 1.1;

    ll7[0].light8.light9.light10.f = 1.1;


    bool test_bool4 = false ;

    bool test_bool5 = 1.2 > 3.0 ;

    int test_int2 =  047;
    int test_int4 =  0xa8;  // testing for hexadecimal numbers

    float test_float1 = 1.5;
    float test_float2 = .01;
    float test_float3 = 10.;
    float test_float4 = 10.01;
    float test_float5 = 23e+2;
    float test_float6 = 23E-3;
    float test_float8 = 23E2;
    bool test_bool6 = BoolConst1 && ! (test_int1 != 0) && ! BoolConst1  && ! (FloatConst1 != 0.0) && (FloatConst1 != 0.0) && (test_float1 != 0.0);

    vec4 color = vec4(0.0, 1.0, 0.0, 1.0);
    vec4 color2 = vec4(0.0);

    vec3 color4 = vec3(test_float8);

    ivec4 test_int_vect1 = ivec4(1.0,1.0,1.0,1.0);
    ivec3 test_int_vec3 = ivec3(1, 1, 1) ;

    bvec4 test_bool_vect1 = bvec4(1., 1., 1. , 1. );

    vec2 test_vec2 = vec2(1., 1.);
    vec2 test_vec3 = vec2(1., 1);
    vec4 test_vec4 = vec4(test_int_vect1);

    vec2 test_vec5 = vec2(color4);
    vec3 test_vec7 = vec3(color);
    vec3 test_vec8 = vec3(test_vec2, test_float4);
    vec3 test_vec9 = vec3(test_float4, test_vec2);

    vec4 test_vec10 = vec4(test_vec9, 0.01);
    vec4 test_vec11 = vec4(0.01, test_vec9);

    vec4 test_vec12 = vec4(test_vec2, test_vec2);

    mat2 test_mat2 = mat2(test_float3);
    mat3 test_mat3 = mat3(test_float3);
    mat4 test_mat4 = mat4(test_float3);

    mat2 test_mat7 = mat2(test_vec2, test_vec2);
    mat2 test_mat8 = mat2(01.01, 2.01, 3.01, 4.01);

    mat3 test_mat9 = mat3(test_vec7, test_vec7, test_vec7);
    mat4 test_mat10 = mat4(test_vec10, test_vec10, test_vec10, test_vec10);
    test_mat10[1] = test_vec10;


    mat2 test_mat12 = mat2(test_vec2, 0.01, 0.01);
    mat2 test_mat13 = mat2(0.01, 5., test_vec2);
    mat2 test_mat15 = mat2(0.1, 5., test_vec2 );

    //mat2 test_mat16 = mat2(test_mat9);
    //mat2 test_mat17 = mat2(test_mat10);

    float freq1[2];
    float freq2[25];

    for (int i=0; i<100; i++)
    {
      if (test_float1 < 1.0)
      {

      }
      else
      {
        break;
      }
    }

    freq2[1] = 1.9 ;
    const int array_index = 2;
    freq2[const_test_int1] = 1.9 ;
    freq2[array_index] = 1.8;

    const int const_int = 5;

    test_float1 = varying_flt;

    int out_int;
    int intArray[6];
    test_function(test_int1, test_int1);
    test_function(test_int1, intArray[2]);

    vec3 vv = vec3(test_function1(test_int1, out_int));
    bool bool_var = true;
    int test_int6 = int(bool_var);
    test_float1 = float(bool_var);
    test_float1 = float(test_int6);
    test_int6 = int(test_float1);
    bool_var = bool(test_int6);
    bool_var = bool(test_float1);
    test_float1 = float(test_vec9);

    test_vec2.x = 1.2;
    test_vec2.y = 1.4;
    test_vec2.xy;


    color.zy = test_vec2;

   test_vec2[1] = 1.1;

     test_mat2[0][0] = 1.1;

    test_float1 += 1.0;
    test_float1 -= 1.0;
    test_float1 *= 1.0;
    test_float1 /= 1.0;

    test_mat12 *= test_mat13 ;
    test_mat12  *= test_float1;
    test_vec2 *= test_float1;
    test_vec2 *= test_mat12;
    test_float1++;
    test_float1--;
    --test_float1;
    ++test_float1;
    test_float1;
    test_int1++;
    test_int1--;

    test_vec2 = test_vec2 + test_float1;
    test_vec2 = test_float1 + test_vec2;

    test_mat12 = test_mat12 * test_mat13;
    test_vec2 = test_vec2 * test_vec5;

    test_vec2++;
    test_mat2++;

    bool test_bool2 = test_float2 > test_float3;

    bool test_bool3 = test_int1 > test_int6 ;

    test_bool3 = test_vec2 == test_vec5;

    test_bool2 = test_bool3 && test_bool4;
    test_bool2 = test_bool3 || test_bool4;
    test_bool2 = test_bool3 ^^ test_bool4;

    test_bool2 = !test_bool3;

    test_bool3 = !(test_int1 > test_int6) ;

    test_float1 = test_int1 > test_int6 ? test_float2 : test_float3;
    test_vec2 = test_int1 > test_int6 ? test_vec2 : test_vec5;
    if(test_bool2)
        test_float1++;
    else
	test_float1--;

    if(test_float1 > test_float2)
        test_float1++;

    if( test_bool2 )
    {
        int if_int;
        test_float1++;
    }

    if(test_bool2)
       if(test_bool3)
           if(test_bool3)
	      test_float1++;

   for(int for_int=0; for_int < 5; for_int++)
   {
       // do nothing as such
   }


   for(int x1=0; x1 < 10; x1++)
   {
     if (!test_bool2)
       break;

     int for_int;
   }

   for(int x2=-10; x2 < 100; x2++)
   {
     test_bool2 = (test_float1 > test_float2);
     if (!test_bool2)
       break;
   }

   for(int for_int1 = 0; for_int1 < 100; for_int1++)
   {
     if (!test_bool2)
       break;

     int for_int;
   }

   for(int for_int1 = 0; for_int1 < 100; for_int1++)
   {
     if (!test_bool2)
       continue;

     int for_int;
   }


   for(int i=0; i<100; i++)
   {
     if (!(test_float1 > test_float2))
     {
       break;
     }

     break;
     continue;
   }

   for(int i=0; i<100; i++)
   {
     if (!test_bool2)
       break;

     break;
   }

   for (int i=0; i<100; i++)
   {
     int dowhile_int;
     dowhile_int = 3;

     if (!test_bool2)
       break;
   }

    gl_Position = vec4(2.0, 3.0, 1.0, 1.1);
    gl_Position = gtf_Vertex;


    // VERTEX SHADER BUILT-IN ATTRIBUTES

    vec4 builtInV4 = gtf_Color + gtf_SecondaryColor + gtf_Vertex + gtf_MultiTexCoord0 + gtf_MultiTexCoord1 + gtf_MultiTexCoord2 +  gtf_MultiTexCoord3;


    int builtInI = gtf_MaxLights + gtf_MaxClipPlanes + gtf_MaxTextureUnits + gtf_MaxTextureCoords + gtf_MaxVertexAttribs + gtf_MaxVertexUniformComponents + gtf_MaxVaryingFloats + gtf_MaxVertexTextureImageUnits + gtf_MaxCombinedTextureImageUnits + gtf_MaxTextureImageUnits + gtf_MaxFragmentUniformComponents + gtf_MaxDrawBuffers ;


    mat4 builtInM4 = gtf_ModelViewMatrix + gtf_ModelViewProjectionMatrix + gtf_ProjectionMatrix;

    gtf_NormalMatrix;

    gtf_TextureMatrix[gtf_MaxTextureCoords-1];
    gtf_TextureMatrix;

    gtf_DepthRange.near ;

    test_float1 = gtf_DepthRange.near;
    test_float1 = gtf_DepthRange.far;
    test_float1 = gtf_DepthRange.diff;

    gtf_Point.size;
    gtf_Point.sizeMin;
    gtf_Point.sizeMax;
    gtf_Point.fadeThresholdSize ;
    gtf_Point.distanceConstantAttenuation;
    gtf_Point.distanceLinearAttenuation ;
    gtf_Point.distanceQuadraticAttenuation;

    gtf_MaterialParameters test;
    gtf_FrontMaterial.emission;

    color = gtf_FrontMaterial.emission;
    color = gtf_FrontMaterial.ambient;
    color = gtf_FrontMaterial.diffuse;
    color = gtf_FrontMaterial.specular;
    test_float1 = gtf_FrontMaterial.shininess;

    gtf_LightSourceParameters lightSource;

    float builtInFloat1 = gtf_LightSource[0].spotExponent;
    color = gtf_LightSource[0].ambient;
    color = lightSource.ambient;
    color = lightSource.diffuse;
    color = lightSource.specular;
    color = lightSource.position;
    color = lightSource.halfVector;
    color4 = lightSource.spotDirection;
    test_float1 = lightSource.spotExponent;
    test_float1 = lightSource.spotCutoff;
    test_float1 = lightSource.spotCosCutoff;
    test_float1 = lightSource.constantAttenuation;
    test_float1 = lightSource.linearAttenuation;
    test_float1 = lightSource.quadraticAttenuation;

    color = gtf_LightModel.ambient;

    gtf_LightModelParameters lightModel;
    color = gtf_LightModel.ambient;
    color = lightModel.ambient;

    color = gtf_FrontLightModelProduct.sceneColor ;

    gtf_LightModelProducts lightModelProd;

    color = lightModelProd.sceneColor;
    color = gtf_FrontLightModelProduct.sceneColor;

    color = gtf_FrontLightProduct[0].ambient;
    color = gtf_FrontLightProduct[0].ambient;
    gtf_LightProducts lightProd;

    color =  lightProd.ambient;
    color =  lightProd.diffuse;
    color =  lightProd.specular;


    test_float1 = gtf_Fog.density ;
    test_float1 = gtf_Fog.start ;
    test_float1 = gtf_Fog.end  ;
    test_float1 = gtf_Fog.scale ;
    color = gtf_Fog.color ;

    gtf_FrontColor =  vec4(1.0, 1.0, 1.0, 1.0);
    gtf_BackColor =  vec4(1.0, 1.0, 1.0, 1.0);
    gtf_FrontSecondaryColor =  vec4(1.0, 1.0, 1.0, 1.0);
    gtf_BackSecondaryColor =  vec4(1.0, 1.0, 1.0, 1.0);


    // VARYING VARIABLES AVAILABLE IN FRAGMENT AND VERTEX SHADERS BOTH
    gtf_TexCoord[0] =  vec4(1.0, 1.0, 1.0, 1.0);
    gtf_FogFragCoord =  vec4(1.0, 1.0, 1.0, 1.0);

}

void test_function(const in int in_int, inout int out_int)
{
    out_int = 5;
    int i = 5;
    return ;
}

int test_function1(in int in_int1, inout int in_out_int)
{
   float ff;
   in_int1 = 5;
   return in_int1;
}

void test_function3(light3 ll)
{
    ll.i = 5.0;
    varying_flt = 1.2;
}

void test_function4(light5 ll20)
{
    ll20.i = 10.0;
}

void test_function5(light1 struct_light1)
{
    struct_light1.light2.a = 1;
    light5 ll5;
    struct_light1.light2.f = ll5.i;
    struct_light1.light2.f++;
    struct_light1.light2.a++;
}

light6 test_function6(int a)
{
    int x;
    light6 funcStruct;
    light7 funcStruct1;
    -x;
    x = x - x ;
    mat2 m;
    m++;
    -m;
    (m)++;
    return funcStruct;
}

float test_function7(light1 ll1, int light1 )
{
    float f;

    struct ss1 {
        int a;
    };

    return float(1);
}