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

Side by Side Diff: conformance/more/functions/uniformMatrix.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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html><head>
3 <meta charset="utf-8">
4 <link rel="stylesheet" type="text/css" href="../unit.css" />
5 <script type="application/x-javascript" src="../unit.js"></script>
6 <script type="application/x-javascript" src="../util.js"></script>
7 <script type="application/x-javascript">
8
9 Tests.startUnit = function () {
10 var canvas = document.getElementById('gl');
11 var gl = wrapGLContext(canvas.getContext(GL_CONTEXT_ID));
12 return [gl];
13 }
14
15 Tests.testUniformf = function(gl) {
16 var sh = new Filter(gl, 'foobar-vert', 'foobar-frag');
17 sh.apply(function(f){
18 var foo = f.uniform('foo');
19 var bar = f.uniform('bar');
20 var bar3 = f.uniform('bar3');
21 gl.uniformMatrix4fv(foo, false, [1,0,0,0, 0,2,0,0, 0,0,3,0, 0,0,0,4]);
22 gl.uniformMatrix2fv(bar, false, [2,1, 2,2]);
23 gl.uniformMatrix3fv(bar3, false, [2,2,2, 2,2,2, 2,1,2]);
24 });
25 var d = new Uint8Array(4);
26 gl.readPixels(0,0,1,1,gl.RGBA, gl.UNSIGNED_BYTE, d);
27 assertEquals([1,2,3,8], [d[0], d[1], d[2], d[3]]);
28 sh.destroy();
29 }
30
31 Tests.endUnit = function(gl) {
32 }
33
34 </script>
35 <script id="foobar-vert" type="x-shader/x-vertex">
36 attribute vec3 Vertex;
37 attribute vec2 Tex;
38
39 uniform mat2 bar;
40 uniform mat3 bar3;
41
42 varying vec4 texCoord0;
43 void main()
44 {
45 texCoord0 = vec4(Tex.s, 1.0-Tex.t, bar[0][1]+bar3[2][1], 0.0);
46 gl_Position = vec4(Vertex, 1.0);
47 }
48 </script>
49 <script id="foobar-frag" type="x-shader/x-fragment">
50 precision mediump float;
51
52 uniform mat4 foo;
53
54 varying vec4 texCoord0;
55 void main()
56 {
57 gl_FragColor = vec4(foo[0][0]/256.0, foo[1][1]/256.0, foo[2][2]/256.0, foo[3 ][3]*texCoord0.z/256.0);
58 }
59 </script>
60 <style>canvas{ position:absolute; }</style>
61 </head><body>
62 <canvas id="gl" width="16" height="16"></canvas>
63 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/functions/texSubImage2DHTMLBadArgs.html ('k') | conformance/more/functions/uniformMatrixBadArgs.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698