Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / uniform-location-length-limits.html
blob9854b3e1cf310d4fdfb428ae2853e55e29020462
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>WebGL uniform 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 uniform locations.</div>
15 <div id="console"></div>
16 <script id="goodVertexShader1" type="x-shader/x-vertex">
17 // A vertex shader where the uniform name is long, but well below the limit.
18 struct Nesting2 {
19 vec4 identifier62CharactersLong_01234567890123456789012345678901234;
22 struct Nesting1 {
23 Nesting2 identifier64CharactersLong_0123456789012345678901234567890123456;
26 uniform Nesting1 identifier70CharactersLong_01234567890123456789012345678901234567890;
28 void main() {
29 gl_Position = identifier70CharactersLong_01234567890123456789012345678901234567890.identifier64CharactersLong_0123456789012345678901234567890123456.identifier62CharactersLong_01234567890123456789012345678901234;
31 </script>
32 <script id="goodVertexShader2" type="x-shader/x-vertex">
33 // A vertex shader where the needed uniform location is exactly 256 characters.
34 struct Nesting2 {
35 vec4 identifier62CharactersLong_01234567890123456789012345678901234;
38 struct Nesting1 {
39 Nesting2 identifier64CharactersLong_0123456789012345678901234567890123456;
42 uniform Nesting1 identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789;
44 void main() {
45 gl_Position = identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.identifier64CharactersLong_0123456789012345678901234567890123456.identifier62CharactersLong_01234567890123456789012345678901234;
47 </script>
48 <script id="badVertexShader" type="x-shader/x-vertex">
49 // A vertex shader where the needed uniform location is 257 characters.
50 struct Nesting2 {
51 vec4 identifier63CharactersLong_012345678901234567890123456789012345;
54 struct Nesting1 {
55 Nesting2 identifier64CharactersLong_0123456789012345678901234567890123456;
58 uniform Nesting1 identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789;
60 void main() {
61 Nesting2 temp = identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.identifier64CharactersLong_0123456789012345678901234567890123456;
62 gl_Position = temp.identifier63CharactersLong_012345678901234567890123456789012345;
64 </script>
65 <script id="fragmentShader" type="x-shader/x-fragment">
66 precision mediump float;
68 void main() {
69 gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
71 </script>
72 <script>
73 if (window.initNonKhronosFramework) {
74 window.initNonKhronosFramework(false);
77 if (window.internals)
78 window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
80 var wtu = WebGLTestUtils;
81 var gl = wtu.create3DContext(document.getElementById("example"));
83 debug("Test uniform location underneath the length limit");
84 var program = wtu.loadProgramFromScript(gl, "goodVertexShader1", "fragmentShader");
85 shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
86 var uniformLoc = gl.getUniformLocation(program, "identifier70CharactersLong_01234567890123456789012345678901234567890.identifier64CharactersLong_0123456789012345678901234567890123456.identifier62CharactersLong_01234567890123456789012345678901234");
87 shouldBeNonNull('uniformLoc');
88 wtu.glErrorShouldBe(gl, gl.NONE);
90 debug("Test uniform location exactly at the length limit");
91 var program = wtu.loadProgramFromScript(gl, "goodVertexShader2", "fragmentShader");
92 shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
93 var uniformLoc = gl.getUniformLocation(program, "identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.identifier64CharactersLong_0123456789012345678901234567890123456.identifier62CharactersLong_01234567890123456789012345678901234");
94 shouldBeNonNull('uniformLoc');
95 wtu.glErrorShouldBe(gl, gl.NONE);
97 debug("Test uniform location over the length limit");
98 program = wtu.loadProgramFromScript(gl, "badVertexShader", "fragmentShader");
99 wtu.glErrorShouldBe(gl, gl.NONE);
100 shouldBe('gl.getProgramParameter(program, gl.LINK_STATUS)', 'true');
101 var uniformLoc = gl.getUniformLocation(program, "identifier128CharactersLong_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.identifier64CharactersLong_0123456789012345678901234567890123456.identifier63CharactersLong_012345678901234567890123456789012345");
102 wtu.glErrorShouldBe(gl, gl.INVALID_VALUE);
103 shouldBeNull('uniformLoc');
105 </script>
106 </body>
107 </html>