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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/uniforms/uniform-location.html

Issue 10399113: Roll webgl conformance tests to r17874: part 2, adding r17874 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 7 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 /*
3 ** Copyright (c) 2012 The Khronos Group Inc.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a
6 ** copy of this software and/or associated documentation files (the
7 ** "Materials"), to deal in the Materials without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Materials, and to
10 ** permit persons to whom the Materials are furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be included
14 ** in all copies or substantial portions of the Materials.
15 **
16 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
23 */
24 -->
25 <!DOCTYPE html>
26 <html>
27 <head>
28 <meta charset="utf-8">
29 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
30 <script src="../../resources/js-test-pre.js"></script>
31 <script src="../resources/webgl-test.js"></script>
32 </head>
33 <body>
34 <div id="description"></div>
35 <div id="console"></div>
36
37 <script>
38 description("Tests the WebGLUniformLocation API");
39
40 var contextA = create3DContext();
41 var contextB = create3DContext();
42 var programA1 = loadStandardProgram(contextA);
43 var programA2 = loadStandardProgram(contextA);
44 var programB = loadStandardProgram(contextB);
45 var programS = loadProgram(contextA, "../resources/structUniformShader.vert", ". ./resources/fragmentShader.frag");
46 var programV = loadProgram(contextA, "../resources/floatUniformShader.vert", ".. /resources/noopUniformShader.frag");
47 var locationA = contextA.getUniformLocation(programA1, 'u_modelViewProjMatrix');
48 var locationB = contextB.getUniformLocation(programB, 'u_modelViewProjMatrix');
49 var locationSx = contextA.getUniformLocation(programS, "u_struct.x");
50 var locationArray0 = contextA.getUniformLocation(programS, "u_array[0]");
51 var locationArray1 = contextA.getUniformLocation(programS, "u_array[1]");
52 var locationVec4 = contextA.getUniformLocation(programV, "fval4");
53
54 var vec = [1, 2, 3, 4];
55 var mat = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
56
57 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programA 2)");
58 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.uniformMat rix4fv(locationA, false, mat)");
59 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programA 1)");
60 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniformMatrix4fv(lo cationA, false, mat)");
61 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniformMatrix4fv(nu ll, false, mat)");
62
63 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programS )");
64 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1i(locationS x, 3)");
65 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1f(locationA rray0, 4.0)");
66 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1f(locationA rray1, 5.0)");
67
68 shouldBe("contextA.getUniform(programS, locationSx)", "3");
69 shouldBe("contextA.getUniform(programS, locationArray0)", "4.0");
70 shouldBe("contextA.getUniform(programS, locationArray1)", "5.0");
71
72 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programV )");
73 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform4fv(location Vec4, vec)");
74 shouldBe("contextA.getUniform(programV, locationVec4)", "vec");
75
76 shouldBeNull("contextA.getUniformLocation(programV, \"IDontExist\")");
77 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.linkProgram(program A1)");
78 // After linking all boxes are bad.
79 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.uniformMat rix4fv(locationA, false, mat)");
80
81 // after re-linking the same program, all uniform locations become invalid.
82 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programS )");
83 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.linkProgram(program S)");
84 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.uniform1i( locationSx, 3)");
85 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getUniform (programS, locationSx)");
86
87 // Retrieve the locations again, and they should be good.
88 locationSx = contextA.getUniformLocation(programS, "u_struct.x");
89 locationArray0 = contextA.getUniformLocation(programS, "u_array[0]");
90 shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1i(locationS x, 3)");
91 shouldBe("contextA.getUniform(programS, locationSx)", "3");
92
93 // getUniformLocation should return a different object everytime, should not cac he and return the same object
94 debug("Testing that getUniformLocation returns a different object everytime");
95 locationSx = contextA.getUniformLocation(programS, "u_struct.x");
96 locationSx2 = contextA.getUniformLocation(programS, "u_struct.x");
97 shouldBeFalse("locationSx === locationSx2");
98 locationSx.foo = {};
99 locationSx2.foo = {};
100 shouldBeFalse("locationSx.foo === locationSx2.foo");
101
102 successfullyParsed = true;
103 </script>
104
105 <script src="../../resources/js-test-post.js"></script>
106 </body>
107 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698