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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/glsl/misc/attrib-location-length-limits.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 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <!--
6
7 /*
8 ** Copyright (c) 2012 The Khronos Group Inc.
9 **
10 ** Permission is hereby granted, free of charge, to any person obtaining a
11 ** copy of this software and/or associated documentation files (the
12 ** "Materials"), to deal in the Materials without restriction, including
13 ** without limitation the rights to use, copy, modify, merge, publish,
14 ** distribute, sublicense, and/or sell copies of the Materials, and to
15 ** permit persons to whom the Materials are furnished to do so, subject to
16 ** the following conditions:
17 **
18 ** The above copyright notice and this permission notice shall be included
19 ** in all copies or substantial portions of the Materials.
20 **
21 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
28 */
29
30 -->
31 <title>WebGL attrib location length tests</title>
32 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
33 <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
34 <script src="../../../resources/js-test-pre.js"></script>
35 <script src="../../resources/webgl-test.js"> </script>
36 <script src="../../resources/webgl-test-utils.js"> </script>
37 </head>
38 <body>
39 <canvas id="example" width="50" height="50">
40 There is supposed to be an example drawing here, but it's not important.
41 </canvas>
42 <div id="description">Verify limits on the lengths of attribute locations per We bGL spec, "Maximum Uniform and Attribute Location Lengths".</div>
43 <div id="console"></div>
44 <script id="goodVertexShader" type="x-shader/x-vertex">
45 // A vertex shader where the needed attrib location is exactly 256 characters.
46 attribute vec4 vPosition01234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 6789012345678901234567890123456;
47
48 void main()
49 {
50 gl_Position = vPosition01234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 3456789012345678901234567890123456;
51 }
52 </script>
53 <script id="badVertexShader" type="x-shader/x-vertex">
54 // A vertex shader where the needed attrib location is 257 characters.
55 attribute vec4 vPosition01234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567;
56
57 void main()
58 {
59 gl_Position = vPosition01234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567;
60 }
61 </script>
62 <script id="fragmentShader" type="x-shader/x-fragment">
63 precision mediump float;
64
65 void main() {
66 gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
67 }
68 </script>
69 <script>
70 if (window.initNonKhronosFramework) {
71 window.initNonKhronosFramework(false);
72 }
73 description("test attrib location length limit");
74
75 var wtu = WebGLTestUtils;
76 var gl = wtu.create3DContext("example");
77
78 debug("Test attrib location underneath the length limit");
79 var program = wtu.loadProgramFromScript(gl, "goodVertexShader", "fragmentShader" );
80 shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
81 var attribLoc = gl.getAttribLocation(program, "vPosition012345678901234567890123 45678901234567890123456789012345678901234567890123456789012345678901234567890123 45678901234567890123456789012345678901234567890123456789012345678901234567890123 456789012345678901234567890123456789012345678901234567890123456");
82 if (attribLoc == -1) {
83 testFailed("attrib location was -1, should not be");
84 } else {
85 testPassed("attrib location should not be -1");
86 }
87 wtu.glErrorShouldBe(gl, gl.NONE);
88
89 debug("Test attrib location over the length limit");
90 debug("Shader compilation or link should fail");
91 shouldBe('wtu.loadProgramFromScriptExpectError(gl, "badVertexShader", "fragmentS hader")', 'null');
92 wtu.glErrorShouldBe(gl, gl.NONE);
93
94 debug("Attempt to bind too-long attrib location should produce error");
95 program = gl.createProgram();
96 gl.bindAttribLocation(program, 0, "vPosition012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 67890123456789012345678901234567890123456789012345678901234567890123456789012345 6789012345678901234567890123456789012345678901234567");
97 wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
98
99 debug("Attempt to fetch too-long attrib location should produce error");
100 program = wtu.loadStandardProgram(gl);
101 shouldBe('gl.getAttribLocation(program, "vPosition012345678901234567890123456789 01234567890123456789012345678901234567890123456789012345678901234567890123456789 01234567890123456789012345678901234567890123456789012345678901234567890123456789 0123456789012345678901234567890123456789012345678901234567")', '-1');
102 wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
103
104 successfullyParsed = true;
105 </script>
106 <script src="../../../resources/js-test-post.js"></script>
107 </body>
108 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698