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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/null-uniform-location.html

Issue 1601093008: Remove duplicated WebGL layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 <script src="resources/webgl-test.js"></script>
5 </head>
6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
9
10 <script>
11 description("Tests calling the various uniform[Matrix]* APIs with a null uniform location");
12
13 var gl = create3DContext();
14 var program = loadStandardProgram(gl);
15
16 shouldBe("gl.getError()", "gl.NO_ERROR");
17 shouldBeUndefined("gl.useProgram(program)");
18 var floatArray = new Float32Array([1, 2, 3, 4]);
19 var intArray = new Int32Array([1, 2, 3, 4]);
20
21 function callUniformFunction(name) {
22 var isArrayVariant = (name.charAt(name.length - 1) == 'v');
23 var isMatrix = (name.indexOf("Matrix") != -1);
24 var isFloat =
25 (name.charAt(name.length - 1) == 'f' ||
26 name.charAt(name.length - 2) == 'f');
27 var sizeIndex = (isArrayVariant ? name.length - 3 : name.length - 2);
28 var size = parseInt(name.substring(sizeIndex, sizeIndex + 1));
29 // Initialize argument list with null uniform location
30 var args = [ null ];
31 if (isArrayVariant) {
32 // Call variant which takes values as array
33 if (isMatrix) {
34 size = size * size;
35 args.push(false);
36 }
37 var array = (isFloat ? new Float32Array(size) : new Int32Array(size));
38 for (var i = 0; i < size; i++) {
39 array[i] = i;
40 }
41 args.push(array);
42 } else {
43 // Call variant which takes values as parameters
44 for (var i = 0; i < size; i++) {
45 args.push(i);
46 }
47 }
48 var func = gl[name];
49 return func.apply(gl, args);
50 }
51
52 var funcs = [ "uniform1f", "uniform1fv", "uniform1i", "uniform1iv",
53 "uniform2f", "uniform2fv", "uniform2i", "uniform2iv",
54 "uniform3f", "uniform3fv", "uniform3i", "uniform3iv",
55 "uniform4f", "uniform4fv", "uniform4i", "uniform4iv",
56 "uniformMatrix2fv", "uniformMatrix3fv", "uniformMatrix4fv" ];
57 for (var i = 0; i < funcs.length; i++) {
58 callString = "callUniformFunction('" + funcs[i] + "')";
59 shouldBeUndefined(callString);
60 shouldBe("gl.getError()", "gl.NO_ERROR");
61 }
62 </script>
63
64 </body>
65 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698