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

Side by Side Diff: conformance/uniforms/gl-uniformmatrix4fv.html

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « conformance/uniforms/gl-uniform-bool.html ('k') | conformance/uniforms/gl-unknown-uniform.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2 Copyright (c) 2011 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>
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <title>WebGL uniformMatrix Conformance Tests</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../resources/js-test-pre.js"></script>
13 <script src="../resources/webgl-test.js"></script>
14 </head>
15 <body>
16 <div id="description"></div>
17 <div id="console"></div>
18 <canvas id="example" width="2" height="2"> </canvas>
19
20 <script id="vshader" type="x-shader/x-vertex">
21 attribute vec4 vPosition;
22 uniform mat4 world4;
23 uniform mat3 world3;
24 uniform mat2 world2;
25 void main()
26 {
27 gl_Position = vec4(vPosition.xyz, world3[0].x + world2[0].x) * world4;
28 }
29 </script>
30
31 <script id="fshader" type="x-shader/x-fragment">
32 void main()
33 {
34 gl_FragColor = vec4(1.0,0.0,0.0,1.0);
35 }
36 </script>
37
38 <script>
39 description("This test ensures WebGL implementations handle uniformMatrix in a O penGL ES 2.0 spec compliant way");
40
41 debug("");
42 debug("Checking gl.uniformMatrix.");
43
44 gl = initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], 1);
45 for (var ii = 2; ii <= 4; ++ii) {
46 var loc = gl.getUniformLocation(gl.program, "world" + ii);
47 var matLess = [];
48 for (var jj = 0; jj < ii; ++jj) {
49 for (var ll = 0; ll < ii; ++ll) {
50 if (jj == ii - 1 && ll == ii - 1)
51 continue;
52 matLess[jj * ii + ll] = (jj == ll) ? 1 : 0;
53 }
54 }
55 var mat = matLess.concat([1]);
56 var matMore = mat.concat([1]);
57 name = "uniformMatrix" + ii + "fv";
58 gl[name](loc, false, matLess);
59 glErrorShouldBe(gl, gl.INVALID_VALUE, "should fail with insufficient array siz e for " + name);
60 gl[name](loc, false, mat);
61 glErrorShouldBe(gl, gl.NO_ERROR, "should succeed with correct array size for " + name);
62 gl[name](loc, false, matMore);
63 glErrorShouldBe(gl, gl.INVALID_VALUE, "should fail with more than 1 array size for " + name);
64
65 mat[ii * ii - 1] = 1;
66 gl[name](loc, false, mat);
67 glErrorShouldBe(gl, gl.NO_ERROR, "can call " + name + "with transpose = false" );
68 gl[name](loc, true, mat);
69 glErrorShouldBe(gl, gl.INVALID_VALUE, name + " should return INVALID_VALUE wit h transpose = true");
70 }
71
72 debug("");
73 successfullyParsed = true;
74
75 </script>
76 <script src="../../resources/js-test-post.js"></script>
77
78 </body>
79 </html>
OLDNEW
« no previous file with comments | « conformance/uniforms/gl-uniform-bool.html ('k') | conformance/uniforms/gl-unknown-uniform.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698