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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/glsl/misc/shader-with-non-reserved-words.html

Issue 10399113: Roll webgl conformance tests to r17874: part 2, adding r17874 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 7 months 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2
3 /*
4 ** Copyright (c) 2012 The Khronos Group Inc.
5 **
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
16 **
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
24 */
25
26 -->
27
28 <!DOCTYPE html>
29 <html>
30 <head>
31 <meta charset="utf-8">
32 <title>WebGL GLSL Conformance Tests - Non Reserved Words</title>
33 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
34 <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
35 <script src="../../../resources/js-test-pre.js"></script>
36 <script src="../../resources/webgl-test-utils.js"></script>
37 <script src="../../resources/glsl-conformance-test.js"></script>
38 </head>
39 <body>
40 <div id="description"></div>
41 <div id="console"></div>
42 <script id="vertexShader0" type="text/something-not-javascript">
43 struct $replaceMe {
44 vec4 $replaceMe;
45 };
46 struct Foo {
47 $replaceMe $replaceMe;
48 };
49 attribute vec4 position;
50 void main()
51 {
52 Foo f;
53 f.$replaceMe.$replaceMe = position;
54 gl_Position = f.$replaceMe.$replaceMe;
55 }
56 </script>
57 <script id="fragmentShader0" type="text/something-not-javascript">
58 precision mediump float;
59 vec4 $replaceMe() {
60 return vec4(0,1,0,1);
61 }
62 void main()
63 {
64 gl_FragColor = $replaceMe();
65 }
66 </script>
67 <script id="vertexShader1" type="text/something-not-javascript">
68 attribute vec4 $replaceMe;
69 void main()
70 {
71 gl_Position = $replaceMe;
72 }
73 </script>
74 <script id="fragmentShader1" type="text/something-not-javascript">
75 precision mediump float;
76 vec4 foo(vec4 $replaceMe) {
77 return $replaceMe;
78 }
79 void main()
80 {
81 gl_FragColor = foo(vec4(1,0,1,1));
82 }
83 </script>
84 <script id="vertexShader2" type="text/something-not-javascript">
85 varying vec4 $replaceMe;
86 attribute vec4 position;
87 void main()
88 {
89 gl_Position = position;
90 $replaceMe = position;
91 }
92 </script>
93 <script id="fragmentShader2" type="text/something-not-javascript">
94 precision mediump float;
95 varying vec4 $replaceMe;
96 void main()
97 {
98 gl_FragColor = $replaceMe;
99 }
100 </script>
101 <script id="vertexShader3" type="text/something-not-javascript">
102 attribute vec4 position;
103 void main()
104 {
105 gl_Position = position;
106 }
107 </script>
108 <script id="fragmentShader3" type="text/something-not-javascript">
109 precision mediump float;
110 uniform vec4 $replaceMe;
111 void main()
112 {
113 gl_FragColor = $replaceMe;
114 }
115 </script>
116 <script>
117 var DXWords = [
118 "Buffer",
119 "double",
120 "uint",
121 "half",
122 "dword",
123 "string",
124 "texture",
125 "pixelshader",
126 "vertexshader",
127 "switch",
128 "min16float",
129 "min10float",
130 "min16int",
131 "min12int",
132 "min16uint",
133 "vector",
134 "matrix",
135 "float2",
136 "float3",
137 "float4",
138 "float1x1",
139 "float1x2",
140 "float1x3",
141 "float1x4",
142 "float2x1",
143 "float2x2",
144 "float2x3",
145 "float2x4",
146 "float3x1",
147 "float3x2",
148 "float3x3",
149 "float3x4",
150 "float4x1",
151 "float4x2",
152 "float4x3",
153 "float4x4",
154 "int1x1",
155 "int1x2",
156 "int1x3",
157 "int1x4",
158 "int2x1",
159 "int2x2",
160 "int2x3",
161 "int2x4",
162 "int3x1",
163 "int3x2",
164 "int3x3",
165 "int3x4",
166 "int4x1",
167 "int4x2",
168 "int4x3",
169 "int4x4",
170 "double1x1",
171 "double1x2",
172 "double1x3",
173 "double1x4",
174 "double2x1",
175 "double2x2",
176 "double2x3",
177 "double2x4",
178 "double3x1",
179 "double3x2",
180 "double3x3",
181 "double3x4",
182 "double4x1",
183 "double4x2",
184 "double4x3",
185 "double4x4",
186 "abort",
187 "abs",
188 "acos",
189 "all",
190 "AllMemoryBarrier",
191 "AllMemoryBarrierWithGroupSync",
192 "any",
193 "asdouble",
194 "asfloat",
195 "asin",
196 "asint",
197 "asint",
198 "asuint",
199 "asuint",
200 "atan",
201 "atan2",
202 "ceil",
203 "clamp",
204 "clip",
205 "cos",
206 "cosh",
207 "countbits",
208 "cross",
209 "D3DCOLORtoUBYTE4",
210 "ddx",
211 "ddx_coarse",
212 "ddx_fine",
213 "ddy",
214 "ddy_coarse",
215 "ddy_fine",
216 "degrees",
217 "determinant",
218 "DeviceMemoryBarrier",
219 "DeviceMemoryBarrierWithGroupSync",
220 "distance",
221 "dot",
222 "dst",
223 "errorf",
224 "EvaluateAttributeAtCentroid",
225 "EvaluateAttributeAtSample",
226 "EvaluateAttributeSnapped",
227 "exp",
228 "exp2",
229 "f16tof32",
230 "f32tof16",
231 "faceforward",
232 "firstbithigh",
233 "firstbitlow",
234 "floor",
235 "fma",
236 "fmod",
237 "frac",
238 "frexp",
239 "fwidth",
240 "GetRenderTargetSampleCount",
241 "GetRenderTargetSamplePosition",
242 "GroupMemoryBarrier",
243 "GroupMemoryBarrierWithGroupSync",
244 "InterlockedAdd",
245 "InterlockedAnd",
246 "InterlockedCompareExchange",
247 "InterlockedCompareStore",
248 "InterlockedExchange",
249 "InterlockedMax",
250 "InterlockedMin",
251 "InterlockedOr",
252 "InterlockedXor",
253 "isfinite",
254 "isinf",
255 "isnan",
256 "ldexp",
257 "length",
258 "lerp",
259 "lit",
260 "log",
261 "log10",
262 "log2",
263 "mad",
264 "max",
265 "min",
266 "modf",
267 "msad4",
268 "mul",
269 "noise",
270 "normalize",
271 "pow",
272 "printf",
273 "Process2DQuadTessFactorsAvg",
274 "Process2DQuadTessFactorsMax",
275 "Process2DQuadTessFactorsMin",
276 "ProcessIsolineTessFactors",
277 "ProcessQuadTessFactorsAvg",
278 "ProcessQuadTessFactorsMax",
279 "ProcessQuadTessFactorsMin",
280 "ProcessTriTessFactorsAvg",
281 "ProcessTriTessFactorsMax",
282 "ProcessTriTessFactorsMin",
283 "radians",
284 "rcp",
285 "reflect",
286 "refract",
287 "reversebits",
288 "round",
289 "rsqrt",
290 "saturate",
291 "sign",
292 "sin",
293 "sincos",
294 "sinh",
295 "smoothstep",
296 "sqrt",
297 "step",
298 "tan",
299 "tanh",
300 "tex1D",
301 "tex1D",
302 "tex1Dbias",
303 "tex1Dgrad",
304 "tex1Dlod",
305 "tex1Dproj",
306 "tex2D",
307 "tex2D",
308 "tex2Dbias",
309 "tex2Dgrad",
310 "tex2Dlod",
311 "tex2Dproj",
312 "tex3D",
313 "tex3D",
314 "tex3Dbias",
315 "tex3Dgrad",
316 "tex3Dlod",
317 "tex3Dproj",
318 "texCUBE",
319 "texCUBE",
320 "texCUBEbias",
321 "texCUBEgrad",
322 "texCUBElod",
323 "texCUBEproj",
324 "transpose",
325 "trunc"
326 ];
327
328 var GLSL_4_20_11_words = [
329 "attribute",
330 "const",
331 "uniform",
332 "varying",
333 "coherent",
334 "volatile",
335 "restrict",
336 "readonly",
337 "writeonly",
338 "atomic_uint",
339 "layout",
340 "centroid",
341 "flat",
342 "smooth",
343 "noperspective",
344 "patch",
345 "sample",
346 "break",
347 "continue",
348 "do",
349 "for",
350 "while",
351 "switch",
352 "case",
353 "default",
354 "if",
355 "else",
356 "subroutine",
357 "in",
358 "out",
359 "inout",
360 "float",
361 "double",
362 "int",
363 "void",
364 "bool",
365 "true",
366 "false",
367 "invariant",
368 "discard",
369 "return",
370 "mat2",
371 "mat3",
372 "mat4",
373 "dmat2",
374 "dmat3",
375 "dmat4",
376 "mat2x2",
377 "mat2x3",
378 "mat2x4",
379 "dmat2x2",
380 "dmat2x3",
381 "dmat2x4",
382 "mat3x2",
383 "mat3x3",
384 "mat3x4",
385 "dmat3x2",
386 "dmat3x3",
387 "dmat3x4",
388 "mat4x2",
389 "mat4x3",
390 "mat4x4",
391 "dmat4x2",
392 "dmat4x3",
393 "dmat4x4",
394 "vec2",
395 "vec3",
396 "vec4",
397 "ivec2",
398 "ivec3",
399 "ivec4",
400 "bvec2",
401 "bvec3",
402 "bvec4",
403 "dvec2",
404 "dvec3",
405 "dvec4",
406 "uint",
407 "uvec2",
408 "uvec3",
409 "uvec4",
410 "lowp",
411 "mediump",
412 "highp",
413 "precision",
414 "sampler1D",
415 "sampler2D",
416 "sampler3D",
417 "samplerCube",
418 "sampler1DShadow",
419 "sampler2DShadow",
420 "samplerCubeShadow",
421 "sampler1DArray",
422 "sampler2DArray",
423 "sampler1DArrayShadow",
424 "sampler2DArrayShadow",
425 "isampler1D",
426 "isampler2D",
427 "isampler3D",
428 "isamplerCube",
429 "isampler1DArray",
430 "isampler2DArray",
431 "usampler1D",
432 "usampler2D",
433 "usampler3D",
434 "usamplerCube",
435 "usampler1DArray",
436 "usampler2DArray",
437 "sampler2DRect",
438 "sampler2DRectShadow",
439 "isampler2DRect",
440 "usampler2DRect",
441 "samplerBuffer",
442 "isamplerBuffer",
443 "usamplerBuffer",
444 "sampler2DMS",
445 "isampler2DMS",
446 "usampler2DMS",
447 "sampler2DMSArray",
448 "isampler2DMSArray",
449 "usampler2DMSArray",
450 "samplerCubeArray",
451 "samplerCubeArrayShadow",
452 "isamplerCubeArray",
453 "usamplerCubeArray",
454 "image1D",
455 "iimage1D",
456 "uimage1D",
457 "image2D",
458 "iimage2D",
459 "uimage2D",
460 "image3D",
461 "iimage3D",
462 "uimage3D",
463 "image2DRect",
464 "iimage2DRect",
465 "uimage2DRect",
466 "imageCube",
467 "iimageCube",
468 "uimageCube",
469 "imageBuffer",
470 "iimageBuffer",
471 "uimageBuffer",
472 "image1DArray",
473 "iimage1DArray",
474 "uimage1DArray",
475 "image2DArray",
476 "iimage2DArray",
477 "uimage2DArray",
478 "imageCubeArray",
479 "iimageCubeArray",
480 "uimageCubeArray",
481 "image2DMS",
482 "iimage2DMS",
483 "uimage2DMS",
484 "image2DMSArray",
485 "iimage2DMSArray",
486 "uimage2DMSArray",
487 "struct"
488 ];
489
490 var GLSL_4_20_11_future_words = [
491 "common",
492 "partition",
493 "active",
494 "asm",
495 "class",
496 "union",
497 "enum",
498 "typedef",
499 "template",
500 "this",
501 "packed",
502 "resource",
503 "goto",
504 "inline",
505 "noinline",
506 "public",
507 "static",
508 "extern",
509 "external",
510 "interface",
511 "long",
512 "short",
513 "half",
514 "fixed",
515 "unsigned",
516 "superp",
517 "input",
518 "output",
519 "hvec2",
520 "hvec3",
521 "hvec4",
522 "fvec2",
523 "fvec3",
524 "fvec4",
525 "sampler3DRect",
526 "filter",
527 "sizeof",
528 "cast",
529 "namespace",
530 "using",
531 "row_major"
532 ];
533
534 var GLSL_1_0_17_words = [
535 "attribute",
536 "const",
537 "uniform",
538 "varying",
539 "break",
540 "continue",
541 "do",
542 "for",
543 "while",
544 "if",
545 "else",
546 "in",
547 "out",
548 "inout",
549 "float",
550 "int",
551 "void",
552 "bool",
553 "true",
554 "false",
555 "lowp",
556 "mediump",
557 "highp",
558 "precision",
559 "invariant",
560 "discard",
561 "return",
562 "mat2",
563 "mat3",
564 "mat4",
565 "vec2",
566 "vec3",
567 "vec4",
568 "ivec2",
569 "ivec3",
570 "ivec4",
571 "bvec2",
572 "bvec3",
573 "bvec4",
574 "sampler2D",
575 "samplerCube",
576 "struct"
577 ]
578
579 var GLSL_1_0_17_FutureWords = [
580 "asm",
581 "class",
582 "union",
583 "enum",
584 "typedef",
585 "template",
586 "this",
587 "packed",
588 "goto",
589 "switch",
590 "default",
591 "inline",
592 "noinline",
593 "volatile",
594 "public",
595 "static",
596 "extern",
597 "external",
598 "interface",
599 "flat",
600 "long",
601 "short",
602 "double",
603 "half",
604 "fixed",
605 "unsigned",
606 "superp",
607 "input",
608 "output",
609 "hvec2",
610 "hvec3",
611 "hvec4",
612 "dvec2",
613 "dvec3",
614 "dvec4",
615 "fvec2",
616 "fvec3",
617 "fvec4",
618 "sampler1D",
619 "sampler3D",
620 "sampler1DShadow",
621 "sampler2DShadow",
622 "sampler2DRect",
623 "sampler3DRect",
624 "sampler2DRectShadow",
625 "sizeof",
626 "cast",
627 "namespace",
628 "using"
629 ];
630
631 description();
632
633 var wtu = WebGLTestUtils;
634 var gl = wtu.create3DContext();
635 var c = document.getElementById("console");
636
637 var badWords = [
638 { words: DXWords },
639 { words: GLSL_4_20_11_words, },
640 { words: GLSL_4_20_11_future_words, }
641 ];
642
643 var reservedWordsLists = [
644 GLSL_1_0_17_words,
645 GLSL_1_0_17_FutureWords
646 ];
647
648 var reservedWords = { };
649 for (var ii = 0; ii < reservedWordsLists.length; ++ii) {
650 var list = reservedWordsLists[ii];
651 for (var jj = 0; jj < list.length; ++jj) {
652 reservedWords[list[jj]] = true;
653 }
654 }
655
656 var checkedWords = {};
657
658 var src = [];
659 for (var ii = 0; ii < 4; ++ii) {
660 var vsrc = document.getElementById("vertexShader" + ii).text;
661 var fsrc = document.getElementById("fragmentShader" + ii).text;
662 src.push({vsrc: vsrc, fsrc: fsrc});
663 }
664
665 var badWordNdx = 0;
666 var listNdx = 0;
667
668 function testNextWord() {
669 var list = badWords[badWordNdx].words;
670 if (listNdx >= list.length) {
671 ++badWordNdx;
672 if (badWordNdx >= badWords.length) {
673 finishTest();
674 return;
675 }
676 listNdx = 0;
677 list = badWords[badWordNdx].words;
678 }
679 testWord(list[listNdx]);
680 ++listNdx;
681 setTimeout(testNextWord,1);
682 }
683 testNextWord();
684
685 function testWord(word) {
686 if (word in reservedWords || word in checkedWords) {
687 return;
688 }
689 checkedWords[word] = true;
690 debug("");
691 debug("testing: " + word);
692
693 for (var ii = 0; ii < src.length; ++ii) {
694 var vs = src[ii].vsrc.replace(/\$replaceMe/g, word);
695 var fs = src[ii].fsrc.replace(/\$replaceMe/g, word);
696
697 wtu.addShaderSource(c, "vertex shader", vs);
698 wtu.addShaderSource(c, "fragment shader", fs);
699
700 var success = true;
701 var program = wtu.loadProgram(gl, vs, fs, function(msg) {
702 debug(msg);
703 success = false;
704 });
705 if (success) {
706 testPassed("shader with: '" + word + "' compiled");
707 } else {
708 testFailed("shader with: '" + word + "' failed to compile");
709 }
710 if (program) {
711 gl.deleteProgram(program);
712 }
713 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "should be no GL errors");
714 }
715 }
716
717
718 successfullyParsed = true;
719 </script>
720 </body>
721 </html>
722
723
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698