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: third_party/webgl/conformance-suites/1.0.0/conformance/null-uniform-location.html

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

Powered by Google App Engine
This is Rietveld 408576698