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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/webgl/sdk/tests/conformance/uniforms/uniform-location.html
===================================================================
--- third_party/webgl/sdk/tests/conformance/uniforms/uniform-location.html (revision 0)
+++ third_party/webgl/sdk/tests/conformance/uniforms/uniform-location.html (revision 0)
@@ -0,0 +1,107 @@
+<!--
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+description("Tests the WebGLUniformLocation API");
+
+var contextA = create3DContext();
+var contextB = create3DContext();
+var programA1 = loadStandardProgram(contextA);
+var programA2 = loadStandardProgram(contextA);
+var programB = loadStandardProgram(contextB);
+var programS = loadProgram(contextA, "../resources/structUniformShader.vert", "../resources/fragmentShader.frag");
+var programV = loadProgram(contextA, "../resources/floatUniformShader.vert", "../resources/noopUniformShader.frag");
+var locationA = contextA.getUniformLocation(programA1, 'u_modelViewProjMatrix');
+var locationB = contextB.getUniformLocation(programB, 'u_modelViewProjMatrix');
+var locationSx = contextA.getUniformLocation(programS, "u_struct.x");
+var locationArray0 = contextA.getUniformLocation(programS, "u_array[0]");
+var locationArray1 = contextA.getUniformLocation(programS, "u_array[1]");
+var locationVec4 = contextA.getUniformLocation(programV, "fval4");
+
+var vec = [1, 2, 3, 4];
+var mat = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
+
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programA2)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.uniformMatrix4fv(locationA, false, mat)");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programA1)");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniformMatrix4fv(locationA, false, mat)");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniformMatrix4fv(null, false, mat)");
+
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programS)");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1i(locationSx, 3)");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1f(locationArray0, 4.0)");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1f(locationArray1, 5.0)");
+
+shouldBe("contextA.getUniform(programS, locationSx)", "3");
+shouldBe("contextA.getUniform(programS, locationArray0)", "4.0");
+shouldBe("contextA.getUniform(programS, locationArray1)", "5.0");
+
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programV)");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform4fv(locationVec4, vec)");
+shouldBe("contextA.getUniform(programV, locationVec4)", "vec");
+
+shouldBeNull("contextA.getUniformLocation(programV, \"IDontExist\")");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.linkProgram(programA1)");
+// After linking all boxes are bad.
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.uniformMatrix4fv(locationA, false, mat)");
+
+// after re-linking the same program, all uniform locations become invalid.
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.useProgram(programS)");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.linkProgram(programS)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.uniform1i(locationSx, 3)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getUniform(programS, locationSx)");
+
+// Retrieve the locations again, and they should be good.
+locationSx = contextA.getUniformLocation(programS, "u_struct.x");
+locationArray0 = contextA.getUniformLocation(programS, "u_array[0]");
+shouldGenerateGLError(contextA, contextA.NO_ERROR, "contextA.uniform1i(locationSx, 3)");
+shouldBe("contextA.getUniform(programS, locationSx)", "3");
+
+// getUniformLocation should return a different object everytime, should not cache and return the same object
+debug("Testing that getUniformLocation returns a different object everytime");
+locationSx = contextA.getUniformLocation(programS, "u_struct.x");
+locationSx2 = contextA.getUniformLocation(programS, "u_struct.x");
+shouldBeFalse("locationSx === locationSx2");
+locationSx.foo = {};
+locationSx2.foo = {};
+shouldBeFalse("locationSx.foo === locationSx2.foo");
+
+successfullyParsed = true;
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
Property changes on: third_party/webgl/sdk/tests/conformance/uniforms/uniform-location.html
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698