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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/limits/gl-max-texture-dimensions.html

Issue 9373009: Check in webgl conformance tests r16844 from khronos. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 10 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
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 description(document.title);
42 var wtu = WebGLTestUtils;
43 var canvas = document.getElementById("example");
44 var gl = wtu.create3DContext(canvas);
45 var program = wtu.setupTexturedQuad(gl);
46
47 // Note: It seems like a reasonable assuption that a 1xN texture size should
48 // work. Even 1 by 128k is only 512k
49 var maxSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
50 debug("advertised max size: " + maxSize);
51 var testSize = Math.min(maxSize, 128 * 1024);
52 var pixels = new Uint8Array(testSize * 4);
53 for (var ii = 0; ii < testSize; ++ii) {
54 var off = ii * 4;
55 pixels[off + 0] = 0;
56 pixels[off + 1] = 255;
57 pixels[off + 2] = 128;
58 pixels[off + 3] = 255;
59 }
60 var tex = gl.createTexture();
61 gl.bindTexture(gl.TEXTURE_2D, tex);
62
63 debug("test " + testSize + "x1");
64 gl.texImage2D(
65 gl.TEXTURE_2D, 0, gl.RGBA, testSize, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE,
66 pixels);
67 gl.generateMipmap(gl.TEXTURE_2D);
68
69 wtu.drawQuad(gl);
70 wtu.checkCanvas(gl, [0, 255, 128, 255],
71 "Should be 0, 255, 128, 255");
72 debug("test 1x" + testSize);
73 gl.texImage2D(
74 gl.TEXTURE_2D, 0, gl.RGBA, 1, testSize, 0, gl.RGBA, gl.UNSIGNED_BYTE,
75 pixels);
76 gl.generateMipmap(gl.TEXTURE_2D);
77
78 wtu.drawQuad(gl);
79 wtu.checkCanvas(gl, [0, 255, 128, 255],
80 "Should be 0, 255, 128, 255");
81
82 var program = wtu.setupProgram(
83 gl,
84 [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
85 wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
86 ['vPosition', 'texCoord0'], [0, 1]);
87
88 glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors.");
89
90 // NOTE: We can't easily test cube maps because they require width == height
91 // and we might not have enough memory for maxSize by maxSize texture.
92
93 successfullyParsed = true;
94
95 </script>
96 <script src="../../resources/js-test-post.js"></script>
97
98 </body>
99 </html>
100
101
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698