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

Side by Side Diff: third_party/webgl/conformance-suites/1.0.0/conformance/buffer-preserve-test.html

Issue 9360034: Remove everthing except conformance tests in the deps/third_party/webgl (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
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>WebGL required buffer clear behaviour test</title>
5 <link rel="stylesheet" href="../resources/js-test-style.css"/>
6 <script src="../resources/js-test-pre.js"></script>
7 <script src="resources/webgl-test.js"> </script>
8 <script src="resources/webgl-test-utils.js"> </script>
9 <style type="text/css">
10 body {
11 height: 3000px;
12 }
13 </style>
14 <script type="text/javascript">
15
16 var iter = 0;
17 var gl;
18
19 var wtu = WebGLTestUtils;
20
21 function checkPixel(gl, x, y, c) {
22 var buf = new Uint8Array(4);
23 gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf);
24
25 return buf[0] == c[0] &&
26 buf[1] == c[1] &&
27 buf[2] == c[2] &&
28 buf[3] == c[3];
29 }
30
31 function timer() {
32 if (iter == 0) {
33 // some random hacky stuff to make sure that we get a compositing step
34 window.scrollBy(0, 10);
35 window.scrollBy(0, -10);
36 iter++;
37
38 setTimeout(timer, 500);
39 } else if (iter == 1) {
40 // scissor was set earlier
41 gl.clearColor(0, 0, 1, 1);
42 gl.clear(gl.COLOR_BUFFER_BIT);
43
44 wtu.checkCanvasRect(gl, 0, 10, 10, 10, [0, 0, 255, 255], "cleared corner should be blue, stencil should be preserved");
45 wtu.checkCanvasRect(gl, 0, 0, 10, 10, [0, 0, 0, 0], "remainder of buffer should be cleared");
46
47 finishTest();
48 }
49 }
50
51 function go() {
52 description("This test ensures WebGL implementations correctly clear the dra wing buffer on composite if preserveDrawingBuffer is false.");
53
54 debug("");
55
56 gl = create3DContext(document.getElementById("c"));
57 if (!gl) {
58 finishTest();
59 return;
60 }
61
62 shouldBeTrue('gl.getContextAttributes().preserveDrawingBuffer == false');
63
64 gl.clearColor(1, 0, 0, 1);
65 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
66
67 // enable scissor here, before compositing, to make sure it's correctly
68 // ignored and restored
69 gl.scissor(0, 10, 10, 10);
70 gl.enable(gl.SCISSOR_TEST);
71
72 setTimeout(timer, 500);
73 }
74
75 window.addEventListener("load", go, false);
76
77 successfullyParsed = true;
78 </script>
79 </head>
80 <body>
81 <div id="description"></div>
82 <canvas width="20" height="20" style="border: 1px solid blue;" id="c"></canvas>
83 <div id="console"></div>
84 </body>
85 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698