| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 <!DOCTYPE HTML> | 
|  | 2 <html> | 
|  | 3 <head> | 
|  | 4 <meta charset="utf-8"> | 
|  | 5 <title>WebGL required buffer clear behaviour test</title> | 
|  | 6 <link rel="stylesheet" href="../../resources/js-test-style.css"/> | 
|  | 7 <script src="../../resources/js-test-pre.js"></script> | 
|  | 8 <script src="../resources/webgl-test.js"> </script> | 
|  | 9 <script src="../resources/webgl-test-utils.js"> </script> | 
|  | 10 <style type="text/css"> | 
|  | 11 body { | 
|  | 12     height: 3000px; | 
|  | 13 } | 
|  | 14 </style> | 
|  | 15 <script type="text/javascript"> | 
|  | 16 | 
|  | 17 var iter = 0; | 
|  | 18 var gl1; | 
|  | 19 | 
|  | 20 var wtu = WebGLTestUtils; | 
|  | 21 | 
|  | 22 function timer() { | 
|  | 23     if (iter == 0) { | 
|  | 24       function init(gl) { | 
|  | 25           gl.clearColor(1, 0, 0, 1); | 
|  | 26           gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER
    _BIT); | 
|  | 27 | 
|  | 28           // enable scissor here, before compositing, to make sure it's correctl
    y | 
|  | 29           // ignored and restored | 
|  | 30           gl.scissor(0, 10, 10, 10); | 
|  | 31           gl.enable(gl.SCISSOR_TEST); | 
|  | 32       } | 
|  | 33       init(gl1); | 
|  | 34     } else if (iter == 1) { | 
|  | 35         // some random hacky stuff to make sure that we get a compositing step | 
|  | 36         window.scrollBy(0, 10); | 
|  | 37         window.scrollBy(0, -10); | 
|  | 38     } else if (iter == 2) { | 
|  | 39         function clear(gl) { | 
|  | 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 co
    rner should be blue, stencil should be preserved"); | 
|  | 45             wtu.checkCanvasRect(gl, 0, 0, 10, 10, [0, 0, 0, 0], "remainder of bu
    ffer should be cleared"); | 
|  | 46         } | 
|  | 47         clear(gl1); | 
|  | 48 | 
|  | 49         finishTest(); | 
|  | 50         return; | 
|  | 51     } | 
|  | 52 | 
|  | 53     iter++; | 
|  | 54     setTimeout(timer, 500); | 
|  | 55 } | 
|  | 56 | 
|  | 57 function go() { | 
|  | 58     description("This test ensures WebGL implementations correctly clear the dra
    wing buffer on composite if preserveDrawingBuffer is false."); | 
|  | 59 | 
|  | 60     debug(""); | 
|  | 61 | 
|  | 62     gl1 = create3DContext(document.getElementById("c")); | 
|  | 63     if (!gl1) { | 
|  | 64         finishTest(); | 
|  | 65         return; | 
|  | 66     } | 
|  | 67 | 
|  | 68     shouldBeTrue("gl1 != null"); | 
|  | 69     shouldBeTrue('gl1.getContextAttributes().preserveDrawingBuffer == false'); | 
|  | 70 | 
|  | 71     setTimeout(timer, 500); | 
|  | 72 } | 
|  | 73 | 
|  | 74 window.addEventListener("load", go, false); | 
|  | 75 | 
|  | 76 successfullyParsed = true; | 
|  | 77 </script> | 
|  | 78 </head> | 
|  | 79 <body> | 
|  | 80 <!-- Important to put the canvas at the top so that it's always visible even in 
    the test suite runner. | 
|  | 81      Otherwise it just doesn't get composited in Firefox. --> | 
|  | 82 <canvas width="20" height="20" style="border: 1px solid blue;" id="c"></canvas> | 
|  | 83 <div id="description"></div> | 
|  | 84 <div id="console"></div> | 
|  | 85 </body> | 
|  | 86 </html> | 
| OLD | NEW | 
|---|