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

Side by Side Diff: conformance/more/functions/uniformfBadArgs.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 uniV4 = f.uniform('uniV4');
19 var uniFloat = f.uniform('uniFloat');
20 assertThrowNoGLError(gl, "number for location",
21 function(){gl.uniform4fv(58882929, [1,2,3,4]);});
22 assertThrowNoGLError(gl, "negative number for location",
23 function(){gl.uniform4fv(-58882929, [1,2,3,4]);});
24 assertGLError(gl, gl.INVALID_OPERATION, "1fv on 4fv",
25 function(){gl.uniform1fv(uniV4, [1,2,3,4]);});
26 assertGLError(gl, gl.INVALID_OPERATION, "more than enough values 1fv",
27 function(){gl.uniform1fv(uniFloat, [2,3,4,5,6]);});
28 assertGLError(gl, gl.INVALID_OPERATION, "4fv on float",
29 function(){gl.uniform4fv(uniFloat, [2,3,4,5]);});
30 assertOk("4fv on 4fv",
31 function(){gl.uniform4fv(uniV4, [1, 2, 3, 4]);});
32 assertGLError(gl, gl.INVALID_VALUE, "5 values on 4fv",
33 function(){gl.uniform4fv(uniV4, [1, 2, 3, 4, 5]);});
34 assertGLError(gl, gl.INVALID_OPERATION, "8 values on 4fv",
35 function(){gl.uniform4fv(uniV4, [1, 2, 3, 4, 5, 6, 7, 8]);});
36 assertGLError(gl, gl.INVALID_OPERATION, "3fv on float",
37 function(){gl.uniform3fv(uniFloat, [2,3,4]);});
38 assertGLError(gl, gl.INVALID_OPERATION, "2fv on float",
39 function(){gl.uniform2fv(uniFloat, [2,3]);});
40 assertGLError(gl, gl.INVALID_OPERATION, "3fv on 4fv",
41 function(){gl.uniform3fv(uniV4, [4,5,6]);});
42 assertGLError(gl, gl.INVALID_OPERATION, "2fv on 4fv",
43 function(){gl.uniform2fv(uniV4, [5,6]);});
44 assertGLError(gl, gl.INVALID_OPERATION, "1fv on 4fv",
45 function(){gl.uniform1fv(uniV4, [6]);});
46 assertOk("1fv on 1fv",
47 function(){gl.uniform1fv(uniFloat, [2]);});
48 assertGLError(gl, gl.INVALID_VALUE, "not enough values on 1fv",
49 function(){gl.uniform1fv(uniFloat, []);});
50 assertGLError(gl, gl.INVALID_VALUE, "not enough values on 4fv",
51 function(){gl.uniform4fv(uniV4, [3,3,4]);});
52 assertGLError(gl, gl.INVALID_OPERATION, "4iv on 4fv",
53 function(){gl.uniform4iv(uniV4, [1, 2, 3, 4]);});
54 assertGLError(gl, gl.INVALID_OPERATION, "1iv on 1fv",
55 function(){gl.uniform1iv(uniFloat, [2]);});
56 });
57 var d = new Uint8Array(4);
58 gl.readPixels(0,0,1,1,gl.RGBA, gl.UNSIGNED_BYTE, d);
59 assertArrayEquals([1,2,3,8], d);
60 sh.destroy();
61 throwError(gl);
62 }
63
64 Tests.endUnit = function(gl) {
65 }
66
67 </script>
68 <script id="foobar-vert" type="x-shader/x-vertex">
69 attribute vec3 Vertex;
70 attribute vec2 Tex;
71
72 uniform float uniFloat;
73
74 varying vec4 texCoord0;
75 void main()
76 {
77 texCoord0 = vec4(Tex.s, 1.0-Tex.t, uniFloat, 0.0);
78 gl_Position = vec4(Vertex, 1.0);
79 }
80 </script>
81 <script id="foobar-frag" type="x-shader/x-fragment">
82 precision mediump float;
83
84 uniform vec4 uniV4;
85
86 varying vec4 texCoord0;
87 void main()
88 {
89 gl_FragColor = vec4(
90 uniV4.r/256.0,
91 uniV4.g/256.0,
92 uniV4.b/256.0,
93 uniV4.a*texCoord0.z/256.0);
94 }
95 </script>
96 <style>canvas{ position:absolute; }</style>
97 </head><body>
98 <canvas id="gl" width="16" height="16"></canvas>
99 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/functions/uniformfArrayLen1.html ('k') | conformance/more/functions/uniformi.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698