Index: third_party/webgl/sdk/tests/conformance/glsl/misc/attrib-location-length-limits.html |
=================================================================== |
--- third_party/webgl/sdk/tests/conformance/glsl/misc/attrib-location-length-limits.html (revision 0) |
+++ third_party/webgl/sdk/tests/conformance/glsl/misc/attrib-location-length-limits.html (revision 0) |
@@ -0,0 +1,108 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<meta charset="utf-8"> |
+<!-- |
+ |
+/* |
+** 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. |
+*/ |
+ |
+--> |
+<title>WebGL attrib location length tests</title> |
+<link rel="stylesheet" href="../../../resources/js-test-style.css"/> |
+<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/> |
+<script src="../../../resources/js-test-pre.js"></script> |
+<script src="../../resources/webgl-test.js"> </script> |
+<script src="../../resources/webgl-test-utils.js"> </script> |
+</head> |
+<body> |
+<canvas id="example" width="50" height="50"> |
+There is supposed to be an example drawing here, but it's not important. |
+</canvas> |
+<div id="description">Verify limits on the lengths of attribute locations per WebGL spec, "Maximum Uniform and Attribute Location Lengths".</div> |
+<div id="console"></div> |
+<script id="goodVertexShader" type="x-shader/x-vertex"> |
+// A vertex shader where the needed attrib location is exactly 256 characters. |
+attribute vec4 vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456; |
+ |
+void main() |
+{ |
+ gl_Position = vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456; |
+} |
+</script> |
+<script id="badVertexShader" type="x-shader/x-vertex"> |
+// A vertex shader where the needed attrib location is 257 characters. |
+attribute vec4 vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567; |
+ |
+void main() |
+{ |
+ gl_Position = vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567; |
+} |
+</script> |
+<script id="fragmentShader" type="x-shader/x-fragment"> |
+precision mediump float; |
+ |
+void main() { |
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); |
+} |
+</script> |
+<script> |
+if (window.initNonKhronosFramework) { |
+ window.initNonKhronosFramework(false); |
+} |
+description("test attrib location length limit"); |
+ |
+var wtu = WebGLTestUtils; |
+var gl = wtu.create3DContext("example"); |
+ |
+debug("Test attrib location underneath the length limit"); |
+var program = wtu.loadProgramFromScript(gl, "goodVertexShader", "fragmentShader"); |
+shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true'); |
+var attribLoc = gl.getAttribLocation(program, "vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456"); |
+if (attribLoc == -1) { |
+ testFailed("attrib location was -1, should not be"); |
+} else { |
+ testPassed("attrib location should not be -1"); |
+} |
+wtu.glErrorShouldBe(gl, gl.NONE); |
+ |
+debug("Test attrib location over the length limit"); |
+debug("Shader compilation or link should fail"); |
+shouldBe('wtu.loadProgramFromScriptExpectError(gl, "badVertexShader", "fragmentShader")', 'null'); |
+wtu.glErrorShouldBe(gl, gl.NONE); |
+ |
+debug("Attempt to bind too-long attrib location should produce error"); |
+program = gl.createProgram(); |
+gl.bindAttribLocation(program, 0, "vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567"); |
+wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); |
+ |
+debug("Attempt to fetch too-long attrib location should produce error"); |
+program = wtu.loadStandardProgram(gl); |
+shouldBe('gl.getAttribLocation(program, "vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567")', '-1'); |
+wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); |
+ |
+successfullyParsed = true; |
+</script> |
+<script src="../../../resources/js-test-post.js"></script> |
+</body> |
+</html> |
Property changes on: third_party/webgl/sdk/tests/conformance/glsl/misc/attrib-location-length-limits.html |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |