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

Side by Side Diff: conformance/uniforms/null-uniform-location.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 <!--
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 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
11 <script src="../../resources/js-test-pre.js"></script>
12 <script src="../resources/webgl-test.js"></script>
13 </head>
14 <body>
15 <div id="description"></div>
16 <div id="console"></div>
17
18 <script>
19 description("Tests calling the various uniform[Matrix]* APIs with a null uniform location");
20
21 var gl = create3DContext();
22 var program = loadStandardProgram(gl);
23
24 glErrorShouldBe(gl, gl.NO_ERROR);
25 shouldBeUndefined("gl.useProgram(program)");
26 var floatArray = new Float32Array([1, 2, 3, 4]);
27 var intArray = new Int32Array([1, 2, 3, 4]);
28
29 function callUniformFunction(name) {
30 var isArrayVariant = (name.charAt(name.length - 1) == 'v');
31 var isMatrix = (name.indexOf("Matrix") != -1);
32 var isFloat =
33 (name.charAt(name.length - 1) == 'f' ||
34 name.charAt(name.length - 2) == 'f');
35 var sizeIndex = (isArrayVariant ? name.length - 3 : name.length - 2);
36 var size = parseInt(name.substring(sizeIndex, sizeIndex + 1));
37 // Initialize argument list with null uniform location
38 var args = [ null ];
39 if (isArrayVariant) {
40 // Call variant which takes values as array
41 if (isMatrix) {
42 size = size * size;
43 args.push(false);
44 }
45 var array = (isFloat ? new Float32Array(size) : new Int32Array(size));
46 for (var i = 0; i < size; i++) {
47 array[i] = i;
48 }
49 args.push(array);
50 } else {
51 // Call variant which takes values as parameters
52 for (var i = 0; i < size; i++) {
53 args.push(i);
54 }
55 }
56 var func = gl[name];
57 return func.apply(gl, args);
58 }
59
60 var funcs = [ "uniform1f", "uniform1fv", "uniform1i", "uniform1iv",
61 "uniform2f", "uniform2fv", "uniform2i", "uniform2iv",
62 "uniform3f", "uniform3fv", "uniform3i", "uniform3iv",
63 "uniform4f", "uniform4fv", "uniform4i", "uniform4iv",
64 "uniformMatrix2fv", "uniformMatrix3fv", "uniformMatrix4fv" ];
65 for (var i = 0; i < funcs.length; i++) {
66 callString = "callUniformFunction('" + funcs[i] + "')";
67 shouldBeUndefined(callString);
68 glErrorShouldBe(gl, gl.NO_ERROR);
69 }
70
71 successfullyParsed = true;
72 </script>
73
74 <script src="../../resources/js-test-post.js"></script>
75 </body>
76 </html>
OLDNEW
« no previous file with comments | « conformance/uniforms/gl-unknown-uniform.html ('k') | conformance/uniforms/uniform-location.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698