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

Side by Side Diff: conformance/limits/gl-max-texture-dimensions.html

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « conformance/limits/00_test_list.txt ('k') | conformance/limits/gl-min-attribs.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6 <!DOCTYPE html>
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <title>WebGL the max advertized texture size is supported.</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../resources/js-test-pre.js"></script>
13 <script src="../resources/webgl-test.js"> </script>
14 <script src="../resources/webgl-test-utils.js"> </script>
15 </head>
16 <body>
17 <canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></c anvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="vshader" type="x-shader/x-vertex">
21 attribute vec4 vPosition;
22 attribute vec2 texCoord0;
23 varying vec2 texCoord;
24 void main()
25 {
26 gl_Position = vPosition;
27 texCoord = texCoord0;
28 }
29 </script>
30
31 <script id="fshader" type="x-shader/x-fragment">
32 precision mediump float;
33 uniform samplerCube tex;
34 varying vec2 texCoord;
35 void main()
36 {
37 gl_FragColor = textureCube(tex, normalize(vec3(texCoord, 1)));
38 }
39 </script>
40 <script>
41 var wtu = WebGLTestUtils;
42 var canvas = document.getElementById("example");
43 var gl = wtu.create3DContext(canvas);
44 var program = wtu.setupTexturedQuad(gl);
45
46 // Note: It seems like a reasonable assuption that a 1xN texture size should
47 // work. Even 1 by 128k is only 512k
48 var maxSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
49 debug("advertised max size: " + maxSize);
50 var testSize = Math.min(maxSize, 128 * 1024);
51 var pixels = new Uint8Array(testSize * 4);
52 for (var ii = 0; ii < testSize; ++ii) {
53 var off = ii * 4;
54 pixels[off + 0] = 0;
55 pixels[off + 1] = 255;
56 pixels[off + 2] = 128;
57 pixels[off + 3] = 255;
58 }
59 var tex = gl.createTexture();
60 gl.bindTexture(gl.TEXTURE_2D, tex);
61
62 debug("test " + testSize + "x1");
63 gl.texImage2D(
64 gl.TEXTURE_2D, 0, gl.RGBA, testSize, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE,
65 pixels);
66 gl.generateMipmap(gl.TEXTURE_2D);
67
68 wtu.drawQuad(gl);
69 wtu.checkCanvas(gl, [0, 255, 128, 255],
70 "Should be 0, 255, 128, 255");
71 debug("test 1x" + testSize);
72 gl.texImage2D(
73 gl.TEXTURE_2D, 0, gl.RGBA, 1, testSize, 0, gl.RGBA, gl.UNSIGNED_BYTE,
74 pixels);
75 gl.generateMipmap(gl.TEXTURE_2D);
76
77 wtu.drawQuad(gl);
78 wtu.checkCanvas(gl, [0, 255, 128, 255],
79 "Should be 0, 255, 128, 255");
80
81 var program = wtu.setupProgram(
82 gl,
83 [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
84 wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
85 ['vPosition', 'texCoord0'], [0, 1]);
86
87 glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors.");
88
89 // NOTE: We can't easily test cube maps because they require width == height
90 // and we might not have enough memory for maxSize by maxSize texture.
91
92 successfullyParsed = true;
93
94 </script>
95 <script src="../../resources/js-test-post.js"></script>
96
97 </body>
98 </html>
99
100
OLDNEW
« no previous file with comments | « conformance/limits/00_test_list.txt ('k') | conformance/limits/gl-min-attribs.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698