Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: conformance/ogles/GL/build/CorrectFull_vert.vert

Issue 41993002: Add ToT WebGL conformance tests : part 9 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1
2 /*
3 ** Copyright (c) 2012 The Khronos Group Inc.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a
6 ** copy of this software and/or associated documentation files (the
7 ** "Materials"), to deal in the Materials without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Materials, and to
10 ** permit persons to whom the Materials are furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be included
14 ** in all copies or substantial portions of the Materials.
15 **
16 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
23 */
24
25
26 struct gtf_MaterialParameters
27 {
28 vec4 emission;
29 vec4 ambient;
30 vec4 diffuse;
31 vec4 specular;
32 float shininess;
33 };
34 struct gtf_LightSourceParameters
35 {
36 vec4 ambient;
37 vec4 diffuse;
38 vec4 specular;
39 vec4 position;
40 vec4 halfVector;
41 vec3 spotDirection;
42 float spotExponent;
43 float spotCutoff;
44 float spotCosCutoff;
45 float constantAttenuation;
46 float linearAttenuation;
47 float quadraticAttenuation;
48 };
49 struct gtf_PointParameters {
50 float size;
51 float sizeMin;
52 float sizeMax;
53 float fadeThresholdSize;
54 float distanceConstantAttenuation;
55 float distanceLinearAttenuation;
56 float distanceQuadraticAttenuation;
57 };
58 struct gtf_DepthRangeParameters {
59 float near;
60 float far;
61 float diff;
62 };
63 struct gtf_LightModelParameters {
64 vec4 ambient;
65 };
66 struct gtf_LightModelProducts {
67 vec4 sceneColor;
68 };
69 struct gtf_LightProducts {
70 vec4 ambient;
71 vec4 diffuse;
72 vec4 specular;
73 };
74 struct gtf_FogParameters {
75 vec4 color;
76 float density;
77 float start;
78 float end;
79 float scale;
80 };
81 uniform int gtf_MaxFragmentUniformComponents;
82 uniform int gtf_MaxVertexUniformComponents;
83 uniform int gtf_MaxVertexTextureImageUnits;
84 uniform int gtf_MaxLights;
85 uniform int gtf_MaxClipPlanes;
86 uniform int gtf_MaxCombinedTextureImageUnits;
87 uniform int gtf_MaxTextureCoords;
88 uniform int gtf_MaxVertexAttribs;
89 uniform int gtf_MaxVaryingFloats;
90 uniform int gtf_MaxTextureUnits;
91 uniform int gtf_MaxDrawBuffers;
92 uniform int gtf_MaxTextureImageUnits;
93 uniform gtf_LightProducts gtf_FrontLightProduct[8];
94 uniform gtf_LightModelProducts gtf_FrontLightModelProduct;
95 uniform gtf_DepthRangeParameters gtf_DepthRange;
96 uniform gtf_FogParameters gtf_Fog;
97 uniform gtf_PointParameters gtf_Point;
98 uniform gtf_LightModelParameters gtf_LightModel;
99 varying vec4 gtf_FogFragCoord;
100 varying vec4 gtf_BackColor;
101 varying vec4 gtf_BackSecondaryColor;
102 varying vec4 gtf_FrontSecondaryColor;
103 varying vec4 gtf_TexCoord[2];
104 varying vec4 gtf_FrontColor;
105 uniform gtf_MaterialParameters gtf_FrontMaterial;
106 uniform gtf_LightSourceParameters gtf_LightSource[8];
107 attribute vec4 gtf_MultiTexCoord1;
108 attribute vec4 gtf_MultiTexCoord2;
109 attribute vec4 gtf_SecondaryColor;
110 attribute vec4 gtf_Color;
111 attribute vec4 gtf_MultiTexCoord3;
112 attribute vec4 gtf_MultiTexCoord0;
113 attribute vec4 gtf_Normal;
114 attribute vec4 gtf_Vertex;
115 uniform mat4 gtf_NormalMatrix;
116 uniform mat4 gtf_ProjectionMatrix;
117 uniform mat4 gtf_TextureMatrix[8];
118 uniform mat4 gtf_ModelViewMatrix;
119 uniform mat4 gtf_ModelViewProjectionMatrix;
120 void test_function(const in int in_int, inout int out_int);
121 int test_function1(in int in_int1, inout int in_out_int);
122
123 uniform float array_float[2];
124
125 struct nested
126 {
127 int a;
128 float f;
129 };
130
131 struct light1
132 {
133 float intensity;
134 vec3 position;
135 int test_int[2];
136 nested light2;
137 } lightVar;
138 light1 ll2;
139
140 void Assign (out light1 out1, in light1 in1)
141 {
142 out1.intensity = in1.intensity;
143 out1.position = in1.position;
144 out1.test_int[0] = in1.test_int[0];
145 out1.test_int[1] = in1.test_int[1];
146 out1.light2 = in1.light2;
147 }
148
149 struct light3 {
150 float i;
151 };
152
153 struct light4 {
154 float i;
155 };
156
157 struct light5 {
158 float i ;
159 float a[2];
160 } light5_inst;
161
162 uniform light3 uniformLight3;
163
164 struct light6 {
165 float i;
166 };
167 uniform light6 uniformLight6;
168
169 struct slight10{
170 float f;
171 };
172 struct slight9{
173 slight10 light10;
174 };
175 struct slight8{
176 slight9 light9;
177 };
178 struct light7 {
179 slight8 light8;
180 } ;
181
182
183 light3 struct_var = light3(5.0);
184
185 // Attribtue variables can only be Global
186 attribute float flt_attrib;
187 attribute vec2 vec2_attrib;
188 attribute vec3 vec3_attrib;
189 attribute vec4 vec4_attrib;
190 attribute mat2 mat2_attrib;
191 attribute mat3 mat3_attrib;
192 attribute mat4 mat4_attrib;
193
194 uniform float flt_uniform;
195 uniform vec3 uniform_vec3;
196 uniform mat3 uniform_mat3;
197
198 uniform sampler2D samp[3];
199 uniform sampler2D samp1;
200
201 const struct light12 {
202 int a;
203 } uniform_struct = light12(2);
204
205 varying vec3 varying_vec3;
206 varying vec2 varying_vec2;
207 varying vec4 varying_vec4;
208 varying mat4 varying_mat4;
209 varying mat2 varying_mat2;
210 varying mat3 varying_mat3;
211 varying float varying_flt;
212
213 float frequencies[2];
214
215 void test_function2(int func_int)
216 {
217 }
218
219 void test_function3(light3);
220 void test_function4(light5 ll20);
221 void test_function5(light1);
222 light6 test_function6(int a);
223
224 const float FloatConst1 = 3.0 * 8.0, floatConst2 = 4.0;
225 const bool BoolConst1 = true && true || false;
226 const bool BoolConst2 = false || !false && false;
227
228 void main(void)
229 {
230
231 int test_int1 = 2;
232 const int const_test_int1 = 2;
233
234 struct structMain {
235 float i;
236 } testStruct;
237
238 struct {
239 structMain a;
240 } aStruct;
241
242 testStruct.i = 5.0 ;
243 struct_var.i = 5.0;
244
245 structMain newStruct, newStruct1;
246 testStruct = newStruct;
247 newStruct = newStruct1;
248
249 lightVar.light2.f = 1.1;
250
251 light1 ll1;
252 ll1.light2.a = 1;
253
254 const struct const_struct {
255 float i;
256 } const_struct_inst = const_struct(1.0);
257
258 //ll1 = ll2;
259 Assign (ll1, ll2);
260 ll1.light2 = ll2.light2;
261 ll1.light2 = ll1.light2;
262 ll1.light2.f = ll2.light2.f;
263 ll1.light2.f = ll1.light2.f;
264
265 // lightVar = ll2;
266 // ll2 = lightVar;
267 Assign (lightVar, ll2);
268 Assign (ll2, lightVar);
269
270 light5 ll10;
271
272 light7 ll7[4];
273 structMain newStruct2[2];
274 newStruct2[0].i = 1.1;
275
276 ll7[0].light8.light9.light10.f = 1.1;
277
278
279 bool test_bool4 = false ;
280
281 bool test_bool5 = 1.2 > 3.0 ;
282
283 int test_int2 = 047;
284 int test_int4 = 0xa8; // testing for hexadecimal numbers
285
286 float test_float1 = 1.5;
287 float test_float2 = .01;
288 float test_float3 = 10.;
289 float test_float4 = 10.01;
290 float test_float5 = 23e+2;
291 float test_float6 = 23E-3;
292 float test_float8 = 23E2;
293 bool test_bool6 = BoolConst1 && ! (test_int1 != 0) && ! BoolConst1 && ! (Fl oatConst1 != 0.0) && (FloatConst1 != 0.0) && (test_float1 != 0.0);
294
295 vec4 color = vec4(0.0, 1.0, 0.0, 1.0);
296 vec4 color2 = vec4(0.0);
297
298 vec3 color4 = vec3(test_float8);
299
300 ivec4 test_int_vect1 = ivec4(1.0,1.0,1.0,1.0);
301 ivec3 test_int_vec3 = ivec3(1, 1, 1) ;
302
303 bvec4 test_bool_vect1 = bvec4(1., 1., 1. , 1. );
304
305 vec2 test_vec2 = vec2(1., 1.);
306 vec2 test_vec3 = vec2(1., 1);
307 vec4 test_vec4 = vec4(test_int_vect1);
308
309 vec2 test_vec5 = vec2(color4);
310 vec3 test_vec7 = vec3(color);
311 vec3 test_vec8 = vec3(test_vec2, test_float4);
312 vec3 test_vec9 = vec3(test_float4, test_vec2);
313
314 vec4 test_vec10 = vec4(test_vec9, 0.01);
315 vec4 test_vec11 = vec4(0.01, test_vec9);
316
317 vec4 test_vec12 = vec4(test_vec2, test_vec2);
318
319 mat2 test_mat2 = mat2(test_float3);
320 mat3 test_mat3 = mat3(test_float3);
321 mat4 test_mat4 = mat4(test_float3);
322
323 mat2 test_mat7 = mat2(test_vec2, test_vec2);
324 mat2 test_mat8 = mat2(01.01, 2.01, 3.01, 4.01);
325
326 mat3 test_mat9 = mat3(test_vec7, test_vec7, test_vec7);
327 mat4 test_mat10 = mat4(test_vec10, test_vec10, test_vec10, test_vec10);
328 test_mat10[1] = test_vec10;
329
330
331 mat2 test_mat12 = mat2(test_vec2, 0.01, 0.01);
332 mat2 test_mat13 = mat2(0.01, 5., test_vec2);
333 mat2 test_mat15 = mat2(0.1, 5., test_vec2 );
334
335 //mat2 test_mat16 = mat2(test_mat9);
336 //mat2 test_mat17 = mat2(test_mat10);
337
338 float freq1[2];
339 float freq2[25];
340
341 for (int i=0; i<100; i++)
342 {
343 if (test_float1 < 1.0)
344 {
345
346 }
347 else
348 {
349 break;
350 }
351 }
352
353 freq2[1] = 1.9 ;
354 const int array_index = 2;
355 freq2[const_test_int1] = 1.9 ;
356 freq2[array_index] = 1.8;
357
358 const int const_int = 5;
359
360 test_float1 = varying_flt;
361
362 int out_int;
363 int intArray[6];
364 test_function(test_int1, test_int1);
365 test_function(test_int1, intArray[2]);
366
367 vec3 vv = vec3(test_function1(test_int1, out_int));
368 bool bool_var = true;
369 int test_int6 = int(bool_var);
370 test_float1 = float(bool_var);
371 test_float1 = float(test_int6);
372 test_int6 = int(test_float1);
373 bool_var = bool(test_int6);
374 bool_var = bool(test_float1);
375 test_float1 = float(test_vec9);
376
377 test_vec2.x = 1.2;
378 test_vec2.y = 1.4;
379 test_vec2.xy;
380
381
382 color.zy = test_vec2;
383
384 test_vec2[1] = 1.1;
385
386 test_mat2[0][0] = 1.1;
387
388 test_float1 += 1.0;
389 test_float1 -= 1.0;
390 test_float1 *= 1.0;
391 test_float1 /= 1.0;
392
393 test_mat12 *= test_mat13 ;
394 test_mat12 *= test_float1;
395 test_vec2 *= test_float1;
396 test_vec2 *= test_mat12;
397 test_float1++;
398 test_float1--;
399 --test_float1;
400 ++test_float1;
401 test_float1;
402 test_int1++;
403 test_int1--;
404
405 test_vec2 = test_vec2 + test_float1;
406 test_vec2 = test_float1 + test_vec2;
407
408 test_mat12 = test_mat12 * test_mat13;
409 test_vec2 = test_vec2 * test_vec5;
410
411 test_vec2++;
412 test_mat2++;
413
414 bool test_bool2 = test_float2 > test_float3;
415
416 bool test_bool3 = test_int1 > test_int6 ;
417
418 test_bool3 = test_vec2 == test_vec5;
419
420 test_bool2 = test_bool3 && test_bool4;
421 test_bool2 = test_bool3 || test_bool4;
422 test_bool2 = test_bool3 ^^ test_bool4;
423
424 test_bool2 = !test_bool3;
425
426 test_bool3 = !(test_int1 > test_int6) ;
427
428 test_float1 = test_int1 > test_int6 ? test_float2 : test_float3;
429 test_vec2 = test_int1 > test_int6 ? test_vec2 : test_vec5;
430 if(test_bool2)
431 test_float1++;
432 else
433 test_float1--;
434
435 if(test_float1 > test_float2)
436 test_float1++;
437
438 if( test_bool2 )
439 {
440 int if_int;
441 test_float1++;
442 }
443
444 if(test_bool2)
445 if(test_bool3)
446 if(test_bool3)
447 test_float1++;
448
449 for(int for_int=0; for_int < 5; for_int++)
450 {
451 // do nothing as such
452 }
453
454
455 for(int x1=0; x1 < 10; x1++)
456 {
457 if (!test_bool2)
458 break;
459
460 int for_int;
461 }
462
463 for(int x2=-10; x2 < 100; x2++)
464 {
465 test_bool2 = (test_float1 > test_float2);
466 if (!test_bool2)
467 break;
468 }
469
470 for(int for_int1 = 0; for_int1 < 100; for_int1++)
471 {
472 if (!test_bool2)
473 break;
474
475 int for_int;
476 }
477
478 for(int for_int1 = 0; for_int1 < 100; for_int1++)
479 {
480 if (!test_bool2)
481 continue;
482
483 int for_int;
484 }
485
486
487 for(int i=0; i<100; i++)
488 {
489 if (!(test_float1 > test_float2))
490 {
491 break;
492 }
493
494 break;
495 continue;
496 }
497
498 for(int i=0; i<100; i++)
499 {
500 if (!test_bool2)
501 break;
502
503 break;
504 }
505
506 for (int i=0; i<100; i++)
507 {
508 int dowhile_int;
509 dowhile_int = 3;
510
511 if (!test_bool2)
512 break;
513 }
514
515 gl_Position = vec4(2.0, 3.0, 1.0, 1.1);
516 gl_Position = gtf_Vertex;
517
518
519 // VERTEX SHADER BUILT-IN ATTRIBUTES
520
521 vec4 builtInV4 = gtf_Color + gtf_SecondaryColor + gtf_Vertex + gtf_MultiTexC oord0 + gtf_MultiTexCoord1 + gtf_MultiTexCoord2 + gtf_MultiTexCoord3;
522
523
524 int builtInI = gtf_MaxLights + gtf_MaxClipPlanes + gtf_MaxTextureUnits + gtf _MaxTextureCoords + gtf_MaxVertexAttribs + gtf_MaxVertexUniformComponents + gtf_ MaxVaryingFloats + gtf_MaxVertexTextureImageUnits + gtf_MaxCombinedTextureImageU nits + gtf_MaxTextureImageUnits + gtf_MaxFragmentUniformComponents + gtf_MaxDraw Buffers ;
525
526
527 mat4 builtInM4 = gtf_ModelViewMatrix + gtf_ModelViewProjectionMatrix + gtf_P rojectionMatrix;
528
529 gtf_NormalMatrix;
530
531 gtf_TextureMatrix[gtf_MaxTextureCoords-1];
532 gtf_TextureMatrix;
533
534 gtf_DepthRange.near ;
535
536 test_float1 = gtf_DepthRange.near;
537 test_float1 = gtf_DepthRange.far;
538 test_float1 = gtf_DepthRange.diff;
539
540 gtf_Point.size;
541 gtf_Point.sizeMin;
542 gtf_Point.sizeMax;
543 gtf_Point.fadeThresholdSize ;
544 gtf_Point.distanceConstantAttenuation;
545 gtf_Point.distanceLinearAttenuation ;
546 gtf_Point.distanceQuadraticAttenuation;
547
548 gtf_MaterialParameters test;
549 gtf_FrontMaterial.emission;
550
551 color = gtf_FrontMaterial.emission;
552 color = gtf_FrontMaterial.ambient;
553 color = gtf_FrontMaterial.diffuse;
554 color = gtf_FrontMaterial.specular;
555 test_float1 = gtf_FrontMaterial.shininess;
556
557 gtf_LightSourceParameters lightSource;
558
559 float builtInFloat1 = gtf_LightSource[0].spotExponent;
560 color = gtf_LightSource[0].ambient;
561 color = lightSource.ambient;
562 color = lightSource.diffuse;
563 color = lightSource.specular;
564 color = lightSource.position;
565 color = lightSource.halfVector;
566 color4 = lightSource.spotDirection;
567 test_float1 = lightSource.spotExponent;
568 test_float1 = lightSource.spotCutoff;
569 test_float1 = lightSource.spotCosCutoff;
570 test_float1 = lightSource.constantAttenuation;
571 test_float1 = lightSource.linearAttenuation;
572 test_float1 = lightSource.quadraticAttenuation;
573
574 color = gtf_LightModel.ambient;
575
576 gtf_LightModelParameters lightModel;
577 color = gtf_LightModel.ambient;
578 color = lightModel.ambient;
579
580 color = gtf_FrontLightModelProduct.sceneColor ;
581
582 gtf_LightModelProducts lightModelProd;
583
584 color = lightModelProd.sceneColor;
585 color = gtf_FrontLightModelProduct.sceneColor;
586
587 color = gtf_FrontLightProduct[0].ambient;
588 color = gtf_FrontLightProduct[0].ambient;
589 gtf_LightProducts lightProd;
590
591 color = lightProd.ambient;
592 color = lightProd.diffuse;
593 color = lightProd.specular;
594
595
596 test_float1 = gtf_Fog.density ;
597 test_float1 = gtf_Fog.start ;
598 test_float1 = gtf_Fog.end ;
599 test_float1 = gtf_Fog.scale ;
600 color = gtf_Fog.color ;
601
602 gtf_FrontColor = vec4(1.0, 1.0, 1.0, 1.0);
603 gtf_BackColor = vec4(1.0, 1.0, 1.0, 1.0);
604 gtf_FrontSecondaryColor = vec4(1.0, 1.0, 1.0, 1.0);
605 gtf_BackSecondaryColor = vec4(1.0, 1.0, 1.0, 1.0);
606
607
608 // VARYING VARIABLES AVAILABLE IN FRAGMENT AND VERTEX SHADERS BOTH
609 gtf_TexCoord[0] = vec4(1.0, 1.0, 1.0, 1.0);
610 gtf_FogFragCoord = vec4(1.0, 1.0, 1.0, 1.0);
611
612 }
613
614 void test_function(const in int in_int, inout int out_int)
615 {
616 out_int = 5;
617 int i = 5;
618 return ;
619 }
620
621 int test_function1(in int in_int1, inout int in_out_int)
622 {
623 float ff;
624 in_int1 = 5;
625 return in_int1;
626 }
627
628 void test_function3(light3 ll)
629 {
630 ll.i = 5.0;
631 varying_flt = 1.2;
632 }
633
634 void test_function4(light5 ll20)
635 {
636 ll20.i = 10.0;
637 }
638
639 void test_function5(light1 struct_light1)
640 {
641 struct_light1.light2.a = 1;
642 light5 ll5;
643 struct_light1.light2.f = ll5.i;
644 struct_light1.light2.f++;
645 struct_light1.light2.a++;
646 }
647
648 light6 test_function6(int a)
649 {
650 int x;
651 light6 funcStruct;
652 light7 funcStruct1;
653 -x;
654 x = x - x ;
655 mat2 m;
656 m++;
657 -m;
658 (m)++;
659 return funcStruct;
660 }
661
662 float test_function7(light1 ll1, int light1 )
663 {
664 float f;
665
666 struct ss1 {
667 int a;
668 };
669
670 return float(1);
671 }
OLDNEW
« no previous file with comments | « conformance/ogles/GL/build/CorrectExtension4_V100_frag.frag ('k') | conformance/ogles/GL/build/CorrectFuncOverload_frag.frag » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698