OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 Copyright (c) 2009 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | 6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
7 "http://www.w3.org/TR/html4/loose.dtd"> | 7 "http://www.w3.org/TR/html4/loose.dtd"> |
8 <html> | 8 <html> |
9 <head> | 9 <head> |
10 <meta charset="utf-8"> | 10 <meta charset="utf-8"> |
(...skipping 14 matching lines...) Expand all Loading... |
25 void main() { | 25 void main() { |
26 gl_FragColor = texture2D(tex, texture2D(tex, texture2D(tex, texCoord).xy).xy); | 26 gl_FragColor = texture2D(tex, texture2D(tex, texture2D(tex, texCoord).xy).xy); |
27 } | 27 } |
28 </script> | 28 </script> |
29 <script> | 29 <script> |
30 window.onload = main; | 30 window.onload = main; |
31 | 31 |
32 debug("Tests drawing a very slow shader."); | 32 debug("Tests drawing a very slow shader."); |
33 var wtu = WebGLTestUtils; | 33 var wtu = WebGLTestUtils; |
34 var canvas = document.getElementById("example"); | 34 var canvas = document.getElementById("example"); |
| 35 canvas.addEventListener("webglcontextlost", function(e) { e.preventDefault(); },
false); |
| 36 canvas.addEventListener("webglcontextrestored", function(e) { }, false); |
35 var gl = wtu.create3DContext(canvas); | 37 var gl = wtu.create3DContext(canvas); |
36 var texSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); | 38 var maxTexSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); |
37 debug("Max Texture size: " + texSize); | 39 var texSize = Math.min(maxTexSize, 1024); |
| 40 debug("Max Texture size: " + maxTexSize); |
| 41 debug("Texture size: " + texSize); |
38 var shaderSource = | 42 var shaderSource = |
39 document.getElementById("slow").text.replace(/\$size/g, texSize + ".0"); | 43 document.getElementById("slow").text.replace(/\$size/g, texSize + ".0"); |
40 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after getting a context"); | 44 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after getting a context"); |
41 var vs = wtu.setupSimpleTextureVertexShader(gl); | 45 var vs = wtu.setupSimpleTextureVertexShader(gl); |
42 var fs = wtu.loadShader( | 46 var fs = wtu.loadShader( |
43 gl, | 47 gl, |
44 shaderSource, | 48 shaderSource, |
45 gl.FRAGMENT_SHADER) | 49 gl.FRAGMENT_SHADER) |
46 var program = wtu.setupProgram( | 50 var program = wtu.setupProgram( |
47 gl, | 51 gl, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after drawing"); | 107 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after drawing"); |
104 } else { | 108 } else { |
105 debug("cancelled"); | 109 debug("cancelled"); |
106 } | 110 } |
107 } | 111 } |
108 | 112 |
109 successfullyParsed = true; | 113 successfullyParsed = true; |
110 </script> | 114 </script> |
111 </body> | 115 </body> |
112 </html> | 116 </html> |
113 | |
114 | |
OLD | NEW |