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

Side by Side Diff: conformance/renderbuffer-initialization.html

Issue 8344024: Remove older revision of webgl conformance tests. (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/read-pixels-test.html ('k') | conformance/resource-sharing-test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <link rel="stylesheet" href="../resources/js-test-style.css"/>
11 <script src="../resources/js-test-pre.js"></script>
12 <script src="resources/webgl-test.js"></script>
13 <script>
14 function runTest(gl, width, height)
15 {
16
17 debug('Test whether the WebGL internal buffers have been initialized to 0.') ;
18 var totalBytes = width * height * 4;
19 var buf = new Uint8Array(totalBytes);
20 gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
21 if (gl.getError() != gl.NO_ERROR) {
22 testFailed('GL error detected after readPixels().');
23 return false;
24 }
25 for (var i = 0; i < totalBytes; ++i) {
26 if (buf[i] != 0) {
27 testFailed('WebGL internal buffers are dirty.');
28 return false;
29 }
30 }
31 testPassed('Buffers have been initialized to 0.');
32
33 debug('Test whether user created buffers have been initialized to 0.');
34 var fbo = gl.createFramebuffer();
35 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
36 var colorbuffer = gl.createRenderbuffer();
37 gl.bindRenderbuffer(gl.RENDERBUFFER, colorbuffer);
38 gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, width, height);
39 if (gl.getError() != gl.NO_ERROR) {
40 testFailed('GL error detected after renderbufferStorage(internalformat = RGBA4).');
41 return false;
42 }
43 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBU FFER, colorbuffer);
44 if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE) {
45 testFailed('Framebuffer incomplete.');
46 return false;
47 }
48 gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
49 if (gl.getError() != gl.NO_ERROR) {
50 testFailed('GL error detected after readPixels().');
51 return false;
52 }
53 for (var i = 0; i < totalBytes; ++i) {
54 if (buf[i] != 0) {
55 testFailed('User created buffers are dirty.');
56 return false;
57 }
58 }
59
60 testPassed('Buffers have been initialized to 0.');
61 return true;
62 }
63 </script>
64 </head>
65 <body>
66 <canvas id="testbed" width="400px" height="400px"></canvas>
67 <div id="description"></div>
68 <div id="console"></div>
69 <script>
70 var successfullyParsed = false;
71
72 description('Verify renderbuffers are initialized to 0 before being read in WebG L');
73
74 var canvas = document.getElementById("testbed");
75 var gl = canvas.getContext("experimental-webgl");
76 if (!gl) {
77 testFailed('canvas.getContext() failed');
78 } else {
79 runTest(gl, canvas.width, canvas.height);
80
81 // Testing that canvas resizing will clear the buffers with 0 instead of the current clear values.
82 gl.clearColor(1, 0, 0, 1);
83 canvas.width += 1;
84 canvas.height += 1;
85 runTest(gl, canvas.width, canvas.height);
86
87 // Testing buffer clearing won't change the clear values.
88 var clearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE);
89 shouldBe("clearColor", "[1, 0, 0, 1]");
90
91 successfullyParsed = true;
92 }
93 </script>
94 <script src="../resources/js-test-post.js"></script>
95 </body>
96 </html>
OLDNEW
« no previous file with comments | « conformance/read-pixels-test.html ('k') | conformance/resource-sharing-test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698