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

Side by Side Diff: conformance/rendering/more-than-65536-indices.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/rendering/gl-scissor-test.html ('k') | conformance/rendering/point-size.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 More than 65536 indices.</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="40" height="40" style="width: 40px; height: 40px;">< /canvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="vs" type="text/something-not-javascript">
21 attribute vec4 vPosition;
22 attribute vec4 vColor;
23 varying vec4 color;
24 void main() {
25 gl_Position = vPosition;
26 color = vColor;
27 }
28 </script>
29 <script id="fs" type="text/something-not-javascript">
30 precision mediump float;
31 varying vec4 color;
32 void main() {
33 gl_FragColor = color;
34 }
35 </script>
36 <script>
37 description("checks that rendering with more than 65536 indices works.");
38 var wtu = WebGLTestUtils;
39 // The antialias:false context creation attribute is a concession to some older and buggier drivers.
40 var gl = initWebGL("example", "vs", "fs", ["vPosition", "vColor"], [0, 0, 0, 1], 1, { antialias: false });
41 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after initWebGL");
42 var bufferObjects = wtu.setupUnitQuad(gl, 0, 1);
43 gl.bindBuffer(gl.ARRAY_BUFFER, bufferObjects[0]);
44 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
45 -1,1,0, 1,1,0, -1,-1,0, 1,-1,0,
46 -1,1,0, 1,1,0, -1,-1,0, 1,-1,0]), gl.STATIC_DRAW);
47 gl.bindBuffer(gl.ARRAY_BUFFER, bufferObjects[1]);
48 gl.bufferData(gl.ARRAY_BUFFER, new Uint8Array([
49 255, 0, 0, 255,
50 255, 0, 0, 255,
51 255, 0, 0, 255,
52 255, 0, 0, 255,
53 0, 255, 0, 255,
54 0, 255, 0, 255,
55 0, 255, 0, 255,
56 0, 255, 0, 255]), gl.STATIC_DRAW);
57 gl.vertexAttribPointer(1, 4, gl.UNSIGNED_BYTE, false, 0, 0);
58 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after program setup");
59 gl.enable(gl.BLEND);
60 gl.disable(gl.DEPTH_TEST);
61
62 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after creating texture");
63 var numQuads = Math.floor(65536 / 6) + 2;
64 debug("numQuads: " + numQuads);
65 debug("numPoints: " + numQuads * 6);
66 var indexBuf = new ArrayBuffer(numQuads * 6);
67 var indices = new Uint8Array(indexBuf);
68 for (var ii = 0; ii < numQuads; ++ii) {
69 var offset = ii * 6;
70 var quad = (ii == (numQuads - 1)) ? 4 : 0;
71 indices[offset + 0] = quad + 0;
72 indices[offset + 1] = quad + 1;
73 indices[offset + 2] = quad + 2;
74 indices[offset + 3] = quad + 2;
75 indices[offset + 4] = quad + 1;
76 indices[offset + 5] = quad + 3;
77 }
78 var indexBuffer = gl.createBuffer();
79 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
80 gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
81 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after setting up indices");
82 gl.drawElements(gl.TRIANGLES, numQuads * 6, gl.UNSIGNED_BYTE, 0);
83 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "after drawing");
84 wtu.checkCanvas(gl, [0, 255, 0, 255], "Should be green.");
85
86 successfullyParsed = true;
87 </script>
88
89 <script src="../../resources/js-test-post.js"></script>
90
91 </body>
92 </html>
93
94
OLDNEW
« no previous file with comments | « conformance/rendering/gl-scissor-test.html ('k') | conformance/rendering/point-size.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698