Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (c) 2011 The Chromium Authors. All rights reserved. |
michael@0 | 3 | Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | found in the LICENSE file. |
michael@0 | 5 | --> |
michael@0 | 6 | <!DOCTYPE html> |
michael@0 | 7 | <html> |
michael@0 | 8 | <head> |
michael@0 | 9 | <meta charset="utf-8"> |
michael@0 | 10 | <title>WebGL the max advertized texture size is supported.</title> |
michael@0 | 11 | <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
michael@0 | 12 | <script src="../../resources/js-test-pre.js"></script> |
michael@0 | 13 | <script src="../resources/webgl-test.js"> </script> |
michael@0 | 14 | <script src="../resources/webgl-test-utils.js"> </script> |
michael@0 | 15 | </head> |
michael@0 | 16 | <body> |
michael@0 | 17 | <canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas> |
michael@0 | 18 | <div id="description"></div> |
michael@0 | 19 | <div id="console"></div> |
michael@0 | 20 | <script id="vshader" type="x-shader/x-vertex"> |
michael@0 | 21 | attribute vec4 vPosition; |
michael@0 | 22 | attribute vec2 texCoord0; |
michael@0 | 23 | varying vec2 texCoord; |
michael@0 | 24 | void main() |
michael@0 | 25 | { |
michael@0 | 26 | gl_Position = vPosition; |
michael@0 | 27 | texCoord = texCoord0; |
michael@0 | 28 | } |
michael@0 | 29 | </script> |
michael@0 | 30 | |
michael@0 | 31 | <script id="fshader" type="x-shader/x-fragment"> |
michael@0 | 32 | precision mediump float; |
michael@0 | 33 | uniform samplerCube tex; |
michael@0 | 34 | varying vec2 texCoord; |
michael@0 | 35 | void main() |
michael@0 | 36 | { |
michael@0 | 37 | gl_FragColor = textureCube(tex, normalize(vec3(texCoord, 1))); |
michael@0 | 38 | } |
michael@0 | 39 | </script> |
michael@0 | 40 | <script> |
michael@0 | 41 | description(document.title); |
michael@0 | 42 | var wtu = WebGLTestUtils; |
michael@0 | 43 | var gl = wtu.create3DContext("example"); |
michael@0 | 44 | var program = wtu.setupTexturedQuad(gl); |
michael@0 | 45 | |
michael@0 | 46 | // Note: It seems like a reasonable assuption that a 1xN texture size should |
michael@0 | 47 | // work. Even 1 by 128k is only 512k |
michael@0 | 48 | var maxSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); |
michael@0 | 49 | debug("advertised max size: " + maxSize); |
michael@0 | 50 | var testSize = Math.min(maxSize, 128 * 1024); |
michael@0 | 51 | var pixels = new Uint8Array(testSize * 4); |
michael@0 | 52 | for (var ii = 0; ii < testSize; ++ii) { |
michael@0 | 53 | var off = ii * 4; |
michael@0 | 54 | pixels[off + 0] = 0; |
michael@0 | 55 | pixels[off + 1] = 255; |
michael@0 | 56 | pixels[off + 2] = 128; |
michael@0 | 57 | pixels[off + 3] = 255; |
michael@0 | 58 | } |
michael@0 | 59 | var tex = gl.createTexture(); |
michael@0 | 60 | gl.bindTexture(gl.TEXTURE_2D, tex); |
michael@0 | 61 | |
michael@0 | 62 | debug("test " + testSize + "x1"); |
michael@0 | 63 | gl.texImage2D( |
michael@0 | 64 | gl.TEXTURE_2D, 0, gl.RGBA, testSize, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, |
michael@0 | 65 | pixels); |
michael@0 | 66 | gl.generateMipmap(gl.TEXTURE_2D); |
michael@0 | 67 | |
michael@0 | 68 | wtu.drawQuad(gl); |
michael@0 | 69 | wtu.checkCanvas(gl, [0, 255, 128, 255], |
michael@0 | 70 | "Should be 0, 255, 128, 255"); |
michael@0 | 71 | debug("test 1x" + testSize); |
michael@0 | 72 | gl.texImage2D( |
michael@0 | 73 | gl.TEXTURE_2D, 0, gl.RGBA, 1, testSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, |
michael@0 | 74 | pixels); |
michael@0 | 75 | gl.generateMipmap(gl.TEXTURE_2D); |
michael@0 | 76 | |
michael@0 | 77 | wtu.drawQuad(gl); |
michael@0 | 78 | wtu.checkCanvas(gl, [0, 255, 128, 255], |
michael@0 | 79 | "Should be 0, 255, 128, 255"); |
michael@0 | 80 | |
michael@0 | 81 | var program = wtu.setupProgram( |
michael@0 | 82 | gl, ['vshader', 'fshader'], ['vPosition', 'texCoord0'], [0, 1]); |
michael@0 | 83 | |
michael@0 | 84 | glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); |
michael@0 | 85 | |
michael@0 | 86 | // NOTE: We can't easily test cube maps because they require width == height |
michael@0 | 87 | // and we might not have enough memory for maxSize by maxSize texture. |
michael@0 | 88 | |
michael@0 | 89 | successfullyParsed = true; |
michael@0 | 90 | |
michael@0 | 91 | </script> |
michael@0 | 92 | <script>finishTest();</script> |
michael@0 | 93 | |
michael@0 | 94 | </body> |
michael@0 | 95 | </html> |
michael@0 | 96 | |
michael@0 | 97 |