tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

angle-instanced-arrays-state-leakage.html (2208B)


      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>Check that ANGLE_instanced_arrays state does not leak to browser</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 <style>
     16 canvas {
     17    border: 1px solid black;
     18 }
     19 .correct {
     20    border: 1px solid black;
     21    background-color: #00ff00;
     22 }
     23 </style>
     24 </head>
     25 <body>
     26 <pre>
     27 This test must be run manually.
     28 
     29 This test tests that leaving state for ANGLE_instanced_arrays with non-default values at the
     30 end of rendering does not interfere with proper compositing of results.
     31 Failures seen on Linux and Mac with Chrome 32.
     32 See http://crbug.com/304927 for more info.
     33 
     34 You should see a <span class="correct">green rectangle</span>
     35 with black a outline on success.  Briefly flashing red is normal.
     36 </pre>
     37 <canvas id='c'></canvas>
     38 <div id="console"></div>
     39 <script>
     40 "use strict";
     41 var wtu = WebGLTestUtils;
     42 var c = document.getElementById("c");
     43 // The bug has only been seen with preserveDrawingBuffer=true.
     44 var gl = wtu.create3DContext(c, { preserveDrawingBuffer: true });
     45 var ext = wtu.getExtensionWithKnownPrefixes(gl, "ANGLE_instanced_arrays");
     46 var frame = 0;
     47 function render() {
     48  var RED_FRAMES = 3;
     49  if (frame < RED_FRAMES) {
     50    // Draw N frames red, leaving the vertex divisor to 0 after each call.
     51    gl.clearColor(1,0,0,1);
     52    gl.clear(gl.COLOR_BUFFER_BIT);
     53    wtu.requestAnimFrame(render);
     54  } else {
     55    // Draw 2 more times in green, setting the divisor to 1 afterward.
     56    gl.clearColor(0,1,0,1);
     57    gl.clear(gl.COLOR_BUFFER_BIT);
     58    if (frame - RED_FRAMES < 2) {
     59      wtu.requestAnimFrame(render);
     60    } else {
     61      finishTest();
     62    }
     63    // Leave attrib 0 set with a divisor of 1 before returning to browser.
     64    if (ext) {
     65       ext.vertexAttribDivisorANGLE(0, 1);
     66    }
     67  }
     68  frame++;
     69 }
     70 
     71 if (!ext) {
     72  testPassed("No ANGLE_instanced_arrays support -- this is legal");
     73 }
     74 wtu.requestAnimFrame(render);
     75 var successfullyParsed = true;
     76 </script>
     77 </body>
     78 </html>