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

Side by Side Diff: conformance/more/functions/uniformf.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 gl.uniform4fv(foo, [1,2,3,4]);
21 gl.uniform1fv(bar, [2]);
22 });
23 var d = new Uint8Array(4);
24 gl.readPixels(0,0,1,1,gl.RGBA, gl.UNSIGNED_BYTE, d);
25 assertEquals([1,2,3,8], [d[0], d[1], d[2], d[3]]);
26 sh.apply(function(f){
27 var foo = f.uniform('foo');
28 var bar = f.uniform('bar');
29 gl.uniform4f(foo, 2,2,3,4);
30 gl.uniform1f(bar, 3);
31 });
32 gl.readPixels(0,0,1,1,gl.RGBA, gl.UNSIGNED_BYTE, d);
33 assertEquals([2,2,3,12], [d[0], d[1], d[2], d[3]]);
34 sh.destroy();
35 }
36
37 Tests.endUnit = function(gl) {
38 }
39
40 </script>
41 <script id="foobar-vert" type="x-shader/x-vertex">
42 attribute vec3 Vertex;
43 attribute vec2 Tex;
44
45 uniform float bar;
46
47 varying vec4 texCoord0;
48 void main()
49 {
50 texCoord0 = vec4(Tex.s, 1.0-Tex.t, bar, 0.0);
51 gl_Position = vec4(Vertex, 1.0);
52 }
53 </script>
54 <script id="foobar-frag" type="x-shader/x-fragment">
55 precision mediump float;
56
57 uniform vec4 foo;
58
59 varying vec4 texCoord0;
60 void main()
61 {
62 gl_FragColor = vec4(foo.r/256.0, foo.g/256.0, foo.b/256.0, foo.a*texCoord0.z /256.0);
63 }
64 </script>
65 <style>canvas{ position:absolute; }</style>
66 </head><body>
67 <canvas id="gl" width="16" height="16"></canvas>
68 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/functions/uniformMatrixBadArgs.html ('k') | conformance/more/functions/uniformfArrayLen1.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698