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

Side by Side Diff: third_party/webgl/conformance-suites/1.0.0/conformance/glsl-conformance.html

Issue 9360034: Remove everthing except conformance tests in the deps/third_party/webgl (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 10 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
OLDNEW
(Empty)
1 <!--
2 Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
7 "http://www.w3.org/TR/html4/loose.dtd">
8 <html>
9 <head>
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
11 <title>WebGL GLSL Conformance Tests</title>
12 <link rel="stylesheet" href="../resources/js-test-style.css"/>
13 <script src="../resources/desktop-gl-constants.js" type="text/javascript"></scri pt>
14 <script src="../resources/js-test-pre.js"></script>
15 <script src="resources/webgl-test-utils.js"></script>
16 </head>
17 <body>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="vshader" type="text/something-not-javascript">
21 attribute vec4 vPosition;
22 void main()
23 {
24 gl_Position = vPosition;
25 }
26 </script>
27 <script id="fshader" type="text/something-not-javascript">
28 precision mediump float;
29 void main()
30 {
31 gl_FragColor = vec4(1.0,0.0,0.0,1.0);
32 }
33 </script>
34 <script id="fshaderWithPrecision" type="text/something-not-javascript">
35 void main()
36 {
37 gl_FragColor = mediump vec4(1.0,0.0,0.0,1.0);
38 }
39 </script>
40 <script id="vshaderWithDefaultPrecision" type="text/something-not-javascript">
41 precision mediump float;
42 attribute vec4 vPosition;
43 void main()
44 {
45 gl_Position = vPosition;
46 }
47 </script>
48 <script id="fshaderWithDefaultPrecision" type="text/something-not-javascript">
49 precision mediump float;
50 void main()
51 {
52 gl_FragColor = vec4(1.0,0.0,0.0,1.0);
53 }
54 </script>
55 <script id="fshaderWithOutPrecision" type="text/something-not-javascript">
56 uniform vec4 color;
57 void main()
58 {
59 gl_FragColor = color;
60 }
61 </script>
62 <script id="fshaderWithInvalidIdentifier" type="text/something-not-javascript">
63 precision mediump float;
64 uniform float gl_foo;
65 void main()
66 {
67 gl_FragColor = vec4(gl_foo,0.0,0.0,1.0);
68 }
69 </script>
70 <script id="fshaderWithGL_ESeq1" type="text/something-not-javascript">
71 #if GL_ES == 1
72 precision mediump float;
73 void main()
74 {
75 gl_FragColor = vec4(0.0,0.0,0.0,1.0);
76 }
77 #else
78 foo
79 #endif
80 </script>
81 <script id="fshaderWithGLSLPreprocessorSymbol" type="text/something-not-javascri pt">
82 #if defined(GL_ES)
83 precision mediump float;
84 void main()
85 {
86 gl_FragColor = vec4(0.0,0.0,0.0,1.0);
87 }
88 #else
89 foo
90 #endif
91 </script>
92 <script id="fshaderWithVERSION100PreprocessorSymbol" type="text/something-not-ja vascript">
93 #if __VERSION__ == 100
94 precision mediump float;
95 void main()
96 {
97 gl_FragColor = vec4(0.0,0.0,0.0,1.0);
98 }
99 #else
100 foo
101 #endif
102 </script>
103 <script id="fshaderWithUndefinedPreprocessorSymbol" type="text/something-not-jav ascript">
104 #if UNDEFINED_FOO
105 // according to ES GLSL spec 3.4 undefined symbols should fail.
106 #else
107 precision mediump float;
108 void main()
109 {
110 gl_FragColor = vec4(0.0,0.0,0.0,1.0);
111 }
112 #endif
113 </script>
114 <script id="fshaderWithFragDepth" type="text/something-not-javascript">
115 precision mediump float;
116 void main()
117 {
118 gl_FragColor = vec4(0.0,0.0,0.0,1.0);
119 gl_FragDepth = 1.0;
120 }
121 </script>
122 <script id="vshaderWithClipVertex" type="text/something-not-javascript">
123 attribute vec4 vPosition;
124 void main()
125 {
126 gl_Position = vPosition;
127 gl_ClipVertex = vPosition;
128 }
129 </script>
130 <script id="fshaderWith__Define" type="text/something-not-javascript">
131 #define __foo 1
132 precision mediump float;
133 void main()
134 {
135 gl_FragColor = vec4(0.0,0.0,0.0,1.0);
136 }
137 </script>
138 <script id="fshaderWithGL_Define" type="text/something-not-javascript">
139 #define GL_FOO 1
140 precision mediump float;
141 void main()
142 {
143 gl_FragColor = vec4(0.0,0.0,0.0,1.0);
144 }
145 </script>
146 <script id="fshaderWithDefineLineContinuation" type="text/something-not-javascri pt">
147 #define foo this \
148 is a test
149 precision mediump float;
150 void main()
151 {
152 gl_FragColor = vec4(0.0,0.0,0.0,1.0);
153 }
154 </script>
155 <script id="vshaderWithgl_Color" type="text/something-not-javascript">
156 attribute vec4 vPosition;
157 void main()
158 {
159 gl_Position = gl_Color;
160 }
161 </script>
162 <script id="vshaderWithgl_ProjectionMatrix" type="text/something-not-javascript" >
163 attribute vec4 vPosition;
164 void main()
165 {
166 gl_Position = vPosition * gl_ProjectionMatrix;
167 }
168 </script>
169 <script id="vshaderWithAttributeArray" type="text/something-not-javascript">
170 attribute vec4 vPosition[2];
171 void main()
172 {
173 gl_Position = vPosition[0] + vPosition[1];
174 }
175 </script>
176 <script id="vshaderWithwebgl_" type="text/something-not-javascript">
177 attribute vec4 webgl_vPosition;
178 void main()
179 {
180 gl_Position = webgl_vPosition;
181 }
182 </script>
183 <script id="vshaderWith_webgl_" type="text/something-not-javascript">
184 attribute vec4 _webgl_vPosition;
185 void main()
186 {
187 gl_Position = _webgl_vPosition;
188 }
189 </script>
190 <script id="vshaderWithImplicitVec3Cast" type="text/something-not-javascript">
191 attribute vec4 vPosition;
192 void main()
193 {
194 highp vec3 k = vec3(1, 2, 3);
195 gl_Position = k;
196 }
197 </script>
198 <script id="vshaderWithExplicitIntCast" type="text/something-not-javascript">
199 attribute vec4 vPosition;
200 void main()
201 {
202 int k = 123;
203 gl_Position = vec4(vPosition.x, vPosition.y, vPosition.z, float(k));
204 }
205 </script>
206 <script id="vshaderWithVersion130" type="text/something-not-javascript">
207 #version 130
208 attribute vec4 vPosition;
209 void main()
210 {
211 gl_Position = vPosition;
212 }
213 </script>
214 <script id="vshaderWithVersion120" type="text/something-not-javascript">
215 #version 120
216 attribute vec4 vPosition;
217 void main()
218 {
219 gl_Position = vPosition;
220 }
221 </script>
222 <script id="vshaderWithVersion100" type="text/something-not-javascript">
223 #version 100
224 attribute vec4 vPosition;
225 void main()
226 {
227 gl_Position = vPosition;
228 }
229 </script>
230 <script id="vshaderWithLineDirective" type="text/something-not-javascript">
231 #line 123
232 foo
233 </script>
234 <script id="vshaderWith__FILE__" type="text/something-not-javascript">
235 __FILE__
236 </script>
237 <script id="vshaderWithIncludeDirective" type="text/something-not-javascript">
238 // Sadly I can not force the current path so this could fail beacuse include.vs
239 // does not exist, not because #include is disallowed.
240 #include "include.vs"
241 attribute vec4 vPosition;
242 void main()
243 {
244 gl_Position = vPosition;
245 }
246 </script>
247 <script id="fshaderWithdFdx" type="text/something-not-javascript">
248 #extension GL_OES_standard_derivatives:enable
249 precision mediump float;
250 void main()
251 {
252 gl_FragColor = vec4(dFdx(0.5),0.0,0.0,1.0);
253 }
254 </script>
255 <script id="fshaderWithdFdxNoExt" type="text/something-not-javascript">
256 precision mediump float;
257 void main()
258 {
259 gl_FragColor = vec4(dFdx(0.5),0.0,0.0,1.0);
260 }
261 </script>
262 <script id="fshaderWith256CharacterIdentifier" type="text/something-not-javascri pt">
263 precision mediump float;
264 uniform float a12345678901234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 678901234567890123456789012345;
265 void main()
266 {
267 gl_FragColor = vec4(a123456789012345678901234567890123456789012345678901234567 89012345678901234567890123456789012345678901234567890123456789012345678901234567 89012345678901234567890123456789012345678901234567890123456789012345678901234567 89012345678901234567890123456789012345,0.0,0.0,1.0);
268 }
269 </script>
270 <script id="fshaderWith257CharacterIdentifier" type="text/something-not-javascri pt">
271 precision mediump float;
272 uniform float a12345678901234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 6789012345678901234567890123456;
273 void main()
274 {
275 gl_FragColor = vec4(a123456789012345678901234567890123456789012345678901234567 89012345678901234567890123456789012345678901234567890123456789012345678901234567 89012345678901234567890123456789012345678901234567890123456789012345678901234567 890123456789012345678901234567890123456,0.0,0.0,1.0);
276 }
277 </script>
278 <script id="fshaderWithLongLine" type="text/something-not-javascript">
279 precision mediump float;
280 uniform float fooo;
281 #if defined(someSymbolNotDefined)
282 #error long
283 #endif
284 void main()
285 {
286 gl_FragColor = vec4(fooo+fooo+fooo+fooo, fooo+fooo+fooo+fooo, fooo+fooo+fooo +fooo, 1.0);
287 }
288 </script>
289 <script id="fshaderWithErrorDirective" type="text/something-not-javascript">
290 #error testing123 testing123
291 void main()
292 {
293 gl_FragColor = vec4(0,0,0,0);
294 }
295 </script>
296 <script id="fshaderWithQuotedErrorDirective" type="text/something-not-javascript ">
297 #error "testing123 testing123" // will return INVALID_VALUE. See WebGL 6.18
298 void main()
299 {
300 gl_FragColor = vec4(0,0,0,0);
301 }
302 </script>
303 <script id="fshaderWithNonASCIIErrorDirective" type="text/something-not-javascri pt">
304 #error ‚±‚ê‚Í‚`‚r‚b‚h‚h‚ł͂Ȃ¢ // will return INVALID_VALUE. See WebGL 6.18
305 void main()
306 {
307 gl_FragColor = vec4(0,0,0,0);
308 }
309 </script>
310 <canvas id="canvas" width="2" height="2"> </canvas>
311 <script>
312 description("This test ensures WebGL implementations allow proper GLES2 shaders compile and improper ones fail.");
313
314 debug("");
315 debug("Canvas.getContext");
316
317 var wtu = WebGLTestUtils;
318 var gl = wtu.create3DContext(document.getElementById("canvas"));
319 if (!gl) {
320 testFailed("context does not exist");
321 } else {
322 testPassed("context exists");
323
324 debug("");
325 debug("Checking various GLSL programs.");
326
327 function log(msg) {
328 if (window.console && window.console.log) {
329 window.console.log(msg);
330 }
331 }
332
333 var shaderInfo = [
334 { vShaderId: 'vshader',
335 vShaderSuccess: true,
336 fShaderId: 'fshaderWithPrecision',
337 fShaderSuccess: true,
338 linkSuccess: true,
339 passMsg: 'frament shader with precision compiled and linked'
340 },
341 { vShaderId: 'vshader',
342 vShaderSuccess: true,
343 fShaderId: 'fshaderWithDefaultPrecision',
344 fShaderSuccess: true,
345 linkSuccess: true,
346 passMsg: 'fragment shader with default precision compiled and linked'
347 },
348 { vShaderId: 'vshaderWithDefaultPrecision',
349 vShaderSuccess: true,
350 fShaderId: 'fshader',
351 fShaderSuccess: true,
352 linkSuccess: true,
353 passMsg: 'vertex shader with default precision compiled and linked'
354 },
355 { vShaderId: 'vshader',
356 vShaderSuccess: true,
357 fShaderId: 'fshaderWithOutPrecision',
358 fShaderSuccess: false,
359 linkSuccess: false,
360 passMsg: 'fragment shader without precision should fail',
361 },
362 { vShaderId: 'vshader',
363 vShaderSuccess: true,
364 fShaderId: 'fshaderWithInvalidIdentifier',
365 fShaderSuccess: false,
366 linkSuccess: false,
367 passMsg: 'fragment shader with gl_ identifier should fail',
368 },
369 { vShaderId: 'vshader',
370 vShaderSuccess: true,
371 fShaderId: 'fshaderWithGL_ESeq1',
372 fShaderSuccess: true,
373 linkSuccess: true,
374 passMsg: 'fragment shader that expects GL_ES == 1 should succeed',
375 },
376 { vShaderId: 'vshader',
377 vShaderSuccess: true,
378 fShaderId: 'fshaderWithGLSLPreprocessorSymbol',
379 fShaderSuccess: true,
380 linkSuccess: true,
381 passMsg: 'fragment shader that uses GL_ES preprocessor symbol should succe ed',
382 },
383 { vShaderId: 'vshader',
384 vShaderSuccess: true,
385 fShaderId: 'fshaderWithVERSION100PreprocessorSymbol',
386 fShaderSuccess: true,
387 linkSuccess: true,
388 passMsg: 'fragment shader that uses __VERSION__==100 should succeed',
389 },
390 { vShaderId: 'vshader',
391 vShaderSuccess: true,
392 fShaderId: 'fshaderWithUndefinedPreprocessorSymbol',
393 fShaderSuccess: false,
394 linkSuccess: false,
395 passMsg: 'fragment shader undefined preprocessor symbol should fail (3.4)' ,
396 },
397 { vShaderId: 'vshader',
398 vShaderSuccess: true,
399 fShaderId: 'fshaderWithFragDepth',
400 fShaderSuccess: false,
401 linkSuccess: false,
402 passMsg: 'fragment shader that uses gl_FragDepth should fail',
403 },
404 { vShaderId: 'vshader',
405 vShaderSuccess: true,
406 fShaderId: 'fshaderWithdFdx',
407 fShaderSuccess: false,
408 linkSuccess: false,
409 passMsg: 'fragment shader that uses dFdx should fail',
410 },
411 { vShaderId: 'vshader',
412 vShaderSuccess: true,
413 fShaderId: 'fshaderWithdFdxNoExt',
414 fShaderSuccess: false,
415 linkSuccess: false,
416 passMsg: 'fragment shader that uses dFdx without #extension should fail',
417 },
418 { vShaderId: 'vshaderWithClipVertex',
419 vShaderSuccess: false,
420 fShaderId: 'fshader',
421 fShaderSuccess: true,
422 linkSuccess: false,
423 passMsg: 'vertex shader that uses gl_ClipVertex should fail',
424 },
425 //{ vShaderId: 'vshader',
426 // vShaderSuccess: true,
427 // fShaderId: 'fshaderWith__Define',
428 // fShaderSuccess: false,
429 // linkSuccess: false,
430 // passMsg: 'fragment shader that uses __ define should fail',
431 //},
432 //{ vShaderId: 'vshader',
433 // vShaderSuccess: true,
434 // fShaderId: 'fshaderWithGL_Define',
435 // fShaderSuccess: false,
436 // linkSuccess: false,
437 // passMsg: 'fragment shader that uses GL_ define should fail',
438 //},
439 { vShaderId: 'vshader',
440 vShaderSuccess: true,
441 fShaderId: 'fshaderWithDefineLineContinuation',
442 fShaderSuccess: false,
443 linkSuccess: false,
444 passMsg: 'fragment shader that uses has line continuation macro should fai l',
445 },
446 { vShaderId: 'vshaderWithgl_Color',
447 vShaderSuccess: false,
448 fShaderId: 'fshader',
449 fShaderSuccess: true,
450 linkSuccess: false,
451 passMsg: 'vertex shader that uses gl_Color should fail',
452 },
453 { vShaderId: 'vshaderWithgl_ProjectionMatrix',
454 vShaderSuccess: false,
455 fShaderId: 'fshader',
456 fShaderSuccess: true,
457 linkSuccess: false,
458 passMsg: 'vertex shader that uses gl_ProjectionMatrix should fail',
459 },
460 { vShaderId: 'vshaderWithAttributeArray',
461 vShaderSuccess: false,
462 fShaderId: 'fshader',
463 fShaderSuccess: true,
464 linkSuccess: false,
465 passMsg: 'vertex shader that uses attribute array should fail as per GLSL page 110, appendix A, section 5',
466 },
467 { vShaderId: 'vshaderWithwebgl_',
468 vShaderSuccess: false,
469 fShaderId: 'fshader',
470 fShaderSuccess: true,
471 linkSuccess: false,
472 passMsg: 'vertex shader that uses _webgl identifier should fail',
473 },
474 { vShaderId: 'vshaderWith_webgl_',
475 vShaderSuccess: false,
476 fShaderId: 'fshader',
477 fShaderSuccess: true,
478 linkSuccess: false,
479 passMsg: 'vertex shader that uses _webgl_ identifier should fail',
480 },
481 { vShaderId: 'vshaderWithExplicitIntCast',
482 vShaderSuccess: true,
483 fShaderId: 'fshader',
484 fShaderSuccess: true,
485 linkSuccess: true,
486 passMsg: 'vertex shader that explicit int to float cast should succeed',
487 },
488 { vShaderId: 'vshaderWithImplicitVec3Cast',
489 vShaderSuccess: false,
490 fShaderId: 'fshader',
491 fShaderSuccess: true,
492 linkSuccess: false,
493 passMsg: 'vertex shader that implicit vec3 to vec4 cast should fail',
494 },
495 { vShaderId: 'vshaderWithVersion130',
496 vShaderSuccess: false,
497 fShaderId: 'fshader',
498 fShaderSuccess: true,
499 linkSuccess: false,
500 passMsg: 'vertex shader uses the #version not 100 directive should fail',
501 },
502 { vShaderId: 'vshaderWithVersion120',
503 vShaderSuccess: false,
504 fShaderId: 'fshader',
505 fShaderSuccess: true,
506 linkSuccess: false,
507 passMsg: 'vertex shader uses the #version not 100 directive should fail',
508 },
509 { vShaderId: 'vshaderWithVersion100',
510 vShaderSuccess: true,
511 fShaderId: 'fshader',
512 fShaderSuccess: true,
513 linkSuccess: true,
514 passMsg: 'vertex shader uses the #version 100 directive should succeed',
515 },
516 { vShaderId: 'vshaderWithLineDirective',
517 vShaderSuccess: false,
518 vShaderTest: (function() { return wtu.getLastError().indexOf("124") >= 0; }),
519 fShaderId: 'fshader',
520 fShaderSuccess: true,
521 linkSuccess: false,
522 passMsg: 'vertex shader uses #line directive should report correct line',
523 },
524 { vShaderId: 'vshaderWithIncludeDirective',
525 vShaderSuccess: false,
526 fShaderId: 'fshader',
527 fShaderSuccess: true,
528 linkSuccess: false,
529 passMsg: 'vertex shader uses #include should fail',
530 },
531 //{ vShaderId: 'vshader',
532 // vShaderSuccess: true,
533 // fShaderId: 'fshaderWith257CharacterIdentifier',
534 // fShaderSuccess: false,
535 // linkSuccess: false,
536 // passMsg: 'shader that uses 257 character identifier should fail',
537 //},
538 { vShaderId: 'vshader',
539 vShaderSuccess: true,
540 fShaderId: 'fshaderWith256CharacterIdentifier',
541 fShaderSuccess: true,
542 linkSuccess: true,
543 passMsg: 'shader that uses 256 character identifier should succeed',
544 },
545 { vShaderId: 'vshader',
546 vShaderSuccess: true,
547 fShaderId: 'fshaderWithLongLine',
548 fShaderSuccess: true,
549 fShaderPrep: function(str) {
550 function expand(str, re, replacement, count) {
551 for (var ii = 0; ii < count; ++ii) {
552 str = str.replace(re, replacement);
553 }
554 return str;
555 }
556 str = expand(str, new RegExp(" ", 'g'), " ", 12);
557 str = expand(str, new RegExp("0", 'g'), "00", 8);
558 str = expand(str, new RegExp("fooo", 'g'), "fooofooo", 6);
559 str = expand(str, new RegExp("long", 'g'), "longlong", 6);
560 //debug("len:" + str.length);
561 //debug(str);
562 return str;
563 },
564 linkSuccess: true,
565 passMsg: 'shader that uses long lines should succeed',
566 },
567 { vShaderId: 'vshader',
568 vShaderSuccess: true,
569 fShaderId: 'fshaderWithErrorDirective',
570 fShaderSuccess: false,
571 fShaderTest: (function() {
572 return wtu.getLastError().indexOf("testing123 testing123") >= 0; }),
573 linkSuccess: false,
574 passMsg: "error directive returns error user's error message",
575 },
576 { vShaderId: 'vshader',
577 vShaderSuccess: true,
578 fShaderId: 'fshaderWithQuotedErrorDirective',
579 fShaderSuccess: false,
580 linkSuccess: false,
581 passMsg: "error directive using quotes fails",
582 },
583 { vShaderId: 'vshader',
584 vShaderSuccess: true,
585 fShaderId: 'fshaderWithNonASCIIErrorDirective',
586 fShaderSuccess: false,
587 linkSuccess: false,
588 passMsg: "error directive using characters outside of allowed set fails",
589 }
590 ];
591
592 // Read in all the shader source.
593 for (var ii = 0; ii < shaderInfo.length; ++ii) {
594 var si = shaderInfo[ii];
595 si.vShaderSource = document.getElementById(si.vShaderId).text;
596 si.fShaderSource = document.getElementById(si.fShaderId).text;
597 }
598
599 // Add more tests from external file
600 var simpleVertShader = document.getElementById('vshader').text;
601 var simpleFragShader = document.getElementById('fshader').text;
602
603 function addExternalShaders(filename, passMsg) {
604 var files = wtu.readFileList(filename);
605 for (var ii = 0; ii < files.length; ++ii) {
606 var file = files[ii];
607 var shaderSource = wtu.readFile(file);
608 var firstLine = shaderSource.split("\n")[0];
609 var success = undefined;
610 if (wtu.endsWith(firstLine, " fail") ||
611 wtu.endsWith(firstLine, " fail.")) {
612 success = false;
613 } else if (wtu.endsWith(firstLine, " succeed") ||
614 wtu.endsWith(firstLine, " succeed.")) {
615 success = true;
616 }
617 if (success === undefined) {
618 testFailed("bad first line in " + file);
619 continue;
620 }
621 if (!wtu.startsWith(firstLine, "// ")) {
622 testFailed("bad first line in " + file);
623 continue;
624 }
625 var passMsg = firstLine.substr(3);
626 if (wtu.endsWith(file, ".vert")) {
627 shaderInfo.push({
628 vShaderId: file,
629 vShaderSource: shaderSource,
630 vShaderSuccess: success,
631 fShaderId: 'fshader',
632 fShaderSource: simpleFragShader,
633 fShaderSuccess: true,
634 linkSuccess: success,
635 passMsg: passMsg,
636 });
637 } else if (wtu.endsWith(file, ".frag")) {
638 shaderInfo.push({
639 vShaderId: 'vshader',
640 vShaderSource: simpleVertShader,
641 vShaderSuccess: true,
642 fShaderId: file,
643 fShaderSource: shaderSource,
644 fShaderSuccess: success,
645 linkSuccess: success,
646 passMsg: passMsg,
647 });
648 }
649 }
650 }
651
652 addExternalShaders('shaders/00_shaders.txt');
653
654 for (var ii = 0; ii < shaderInfo.length; ++ii) {
655 var info = shaderInfo[ii];
656 var passMsg = '[' + info.vShaderId + '/' + info.fShaderId + ']: ' +
657 info.passMsg
658 log(passMsg);
659 //debug(info.fShaderId);
660 var vSource = info.vShaderPrep ? info.vShaderPrep(info.vShaderSource) :
661 info.vShaderSource;
662 var vShader = wtu.loadShader(gl, vSource, gl.VERTEX_SHADER);
663 if (info.vShaderTest) {
664 if (!info.vShaderTest(vShader)) {
665 testFailed(passMsg);
666 continue;
667 }
668 }
669 if ((vShader != null) != info.vShaderSuccess) {
670 testFailed(passMsg);
671 continue;
672 }
673 var fSource = info.fShaderPrep ? info.fShaderPrep(info.fShaderSource) :
674 info.fShaderSource;
675 var fShader = wtu.loadShader(gl, fSource, gl.FRAGMENT_SHADER);
676 if (info.fShaderTest) {
677 if (!info.fShaderTest(fShader)) {
678 testFailed(passMsg);
679 continue;
680 }
681 }
682 //debug(fShader == null ? "fail" : "succeed");
683 if ((fShader != null) != info.fShaderSuccess) {
684 testFailed(passMsg);
685 continue;
686 }
687
688 if (vShader && fShader) {
689 var program = gl.createProgram();
690 gl.attachShader(program, vShader);
691 gl.attachShader(program, fShader);
692 gl.linkProgram(program);
693 var linked = (gl.getProgramParameter(program, gl.LINK_STATUS) != 0);
694 if (!linked) {
695 var error = gl.getProgramInfoLog(program);
696 log("*** Error linking program '"+program+"':"+error);
697 }
698 if (linked != info.linkSuccess) {
699 testFailed(passMsg);
700 continue;
701 }
702 } else {
703 if (info.linkSuccess) {
704 testFailed(passMsg);
705 continue;
706 }
707 }
708 testPassed(passMsg);
709 }
710 }
711
712 debug("");
713 successfullyParsed = true;
714
715 </script>
716 <script src="../resources/js-test-post.js"></script>
717
718 <script>
719 </script>
720
721 </body>
722 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698