scissor-rect-repeated-rendering.html (1655B)
1 <!-- 2 Copyright (c) 2019 The Khronos Group Inc. 3 Use of this source code is governed by an MIT-style license that can be 4 found in the LICENSE.txt file. 5 --> 6 7 <!DOCTYPE html> 8 <html> 9 <head> 10 <meta charset="utf-8"> 11 <title>Scissor Rectangle Repeated Rendering Test</title> 12 <link rel="stylesheet" href="../../resources/js-test-style.css"/> 13 <script src="../../js/js-test-pre.js"></script> 14 <script src="../../js/webgl-test-utils.js"> </script> 15 </head> 16 <body> 17 <canvas id="example" width="128" height="128"></canvas> 18 <div id="description"></div> 19 <div id="console"></div> 20 <script> 21 "use strict"; 22 23 description(); 24 debug('Regression test for <a href="https://code.google.com/p/chromium/issues/detail?id=778770">Chromium bug 778770</a>'); 25 26 var wtu = WebGLTestUtils; 27 28 // These context creation attributes are significant to reproduce the bug. 29 var gl = wtu.create3DContext("example", {alpha: false, antialias: false}); 30 31 // Draw into the upper right quadrant. 32 var x = 64; 33 var y = 64; 34 var width = 64; 35 var height = 64; 36 37 var numRenders = 10; 38 39 function render() { 40 gl.viewport(x, y, width, height); 41 gl.scissor(x, y, width, height); 42 gl.enable(gl.SCISSOR_TEST); 43 gl.clearColor(0.0, 1.0, 0.0, 1.0); 44 gl.clear(gl.COLOR_BUFFER_BIT); 45 46 // If anything but black is ever seen in the un-drawn region of 47 // the canvas, the test fails. 48 var black = [0, 0, 0, 255]; 49 wtu.checkCanvasRect(gl, 10, 10, 10, 10, black, "should be black", 1); 50 51 if (--numRenders > 0) { 52 window.requestAnimationFrame(render); 53 } else { 54 finishTest(); 55 } 56 } 57 58 window.requestAnimationFrame(render); 59 60 var successfullyParsed = true; 61 </script> 62 </body> 63 </html>