Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / attrib-location-length-limits.html
blob7c7cc94faf61a9b1f99e3b5c4e56d35ecb25cb46
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>WebGL attrib location length tests</title>
6 <script src="../../../resources/js-test.js"></script>
7 <script src="resources/webgl-test.js"> </script>
8 <script src="resources/webgl-test-utils.js"> </script>
9 </head>
10 <body>
11 <canvas id="example" width="50" height="50">
12 There is supposed to be an example drawing here, but it's not important.
13 </canvas>
14 <div id="description">Verify limits on the lengths of attrib locations.</div>
15 <div id="console"></div>
16 <script id="goodVertexShader1" type="x-shader/x-vertex">
17 // A vertex shader where the needed attrib location is long, but not over the limit.
18 attribute vec4 vPosition01234567890123456789012345678901234567890123456789012345678901234567890;
20 void main()
22 gl_Position = vPosition01234567890123456789012345678901234567890123456789012345678901234567890;
24 </script>
25 <script id="goodVertexShader2" type="x-shader/x-vertex">
26 // A vertex shader where the needed attrib location is exactly 256 characters.
27 attribute vec4 vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456;
29 void main()
31 gl_Position = vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456;
33 </script>
34 <script id="badVertexShader" type="x-shader/x-vertex">
35 // A vertex shader where the needed attrib location is 257 characters.
36 attribute vec4 vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567;
38 void main()
40 gl_Position = vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567;
42 </script>
43 <script id="fragmentShader" type="x-shader/x-fragment">
44 precision mediump float;
46 void main() {
47 gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
49 </script>
50 <script>
51 if (window.initNonKhronosFramework) {
52 window.initNonKhronosFramework(false);
54 if (window.internals)
55 window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
57 var wtu = WebGLTestUtils;
58 var gl = wtu.create3DContext(document.getElementById("example"));
60 debug("Test attrib location underneath the length limit");
61 var program = wtu.loadProgramFromScript(gl, "goodVertexShader1", "fragmentShader");
62 shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
63 var attribLoc = gl.getAttribLocation(program, "vPosition01234567890123456789012345678901234567890123456789012345678901234567890");
64 if (attribLoc == -1) {
65 testFailed("attrib location was -1, should not be");
66 } else {
67 testPassed("attrib location should not be -1");
69 wtu.glErrorShouldBe(gl, gl.NONE);
71 debug("Test attrib location exactly at the length limit");
72 var program = wtu.loadProgramFromScript(gl, "goodVertexShader2", "fragmentShader");
73 shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
74 var attribLoc = gl.getAttribLocation(program, "vPosition0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456");
75 if (attribLoc == -1) {
76 testFailed("attrib location was -1, should not be");
77 } else {
78 testPassed("attrib location should not be -1");
80 wtu.glErrorShouldBe(gl, gl.NONE);
82 debug("Test attrib location over the length limit");
83 debug("Shader compilation should fail");
84 shouldBe('wtu.loadShaderFromScript(gl, "badVertexShader", gl.VERTEX_SHADER, function (err) {})', 'null');
85 wtu.glErrorShouldBe(gl, gl.NONE);
87 debug("Attempt to bind too-long attrib location should produce error");
88 var program = gl.createProgram();
89 gl.bindAttribLocation(program, 0, "vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567");
90 wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
92 debug("Attempt to fetch too-long attrib location should produce error");
93 shouldBe('gl.getAttribLocation(program, "vPosition01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567")', '-1');
94 wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
96 </script>
97 </body>
98 </html>