tor-browser

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

invalid-vertex-attribs.html (2100B)


      1 <!--
      2 Copyright (c) 2022 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 <!DOCTYPE html>
      7 <html>
      8 <head>
      9 <meta charset="utf-8">
     10 <title>WebGL2 draw functions have expected behavior with invalid vertex attribs</title>
     11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
     12 <script src="../../js/js-test-pre.js"></script>
     13 <script src="../../js/webgl-test-utils.js"> </script>
     14 <script src="../../js/tests/invalid-vertex-attrib-test.js"></script>
     15 <style>
     16 body {
     17    height: 3000px;
     18 }
     19 </style>
     20 </head>
     21 <body>
     22 <!-- Important to put the canvas at the top so that it's always visible even in the test suite runner.
     23     Otherwise it just doesn't get composited in Firefox. -->
     24 <div id="description"></div>
     25 <canvas id="canvas" width="16" height="16"> </canvas>
     26 <div id="console"></div>
     27 <script>
     28 "use strict";
     29 
     30 description(`\
     31 This test ensures WebGL implementations correctly generate INVALID_OPERATION
     32 when an attribute is enabled but no buffer is bound`);
     33 debug("");
     34 
     35 const wtu = WebGLTestUtils;
     36 const gl = wtu.create3DContext('canvas', undefined, 2);
     37 
     38 async function runInvalidAttribTests() {
     39    const invalidAttribTestFn = createInvalidAttribTestFn(gl);
     40 
     41    function drawArrays(gl) {
     42      gl.drawArrays(gl.TRIANGLES, 0, 6);
     43    }
     44 
     45    function drawElements(gl) {
     46      gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_BYTE, 0);
     47    }
     48 
     49    function drawArraysInstanced(gl) {
     50      gl.drawArraysInstanced(gl.TRIANGLES, 0, 6, 1);
     51    }
     52 
     53    function drawElementsInstanced(gl) {
     54      gl.drawElementsInstanced(gl.TRIANGLES, 6, gl.UNSIGNED_BYTE, 0, 1);
     55    }
     56 
     57    function drawRangeElements(gl) {
     58      gl.drawRangeElements(gl.TRIANGLES, 0, 5, 6, gl.UNSIGNED_BYTE, 0);
     59    }
     60 
     61    await invalidAttribTestFn(drawArrays);
     62    await invalidAttribTestFn(drawElements);
     63    await invalidAttribTestFn(drawArraysInstanced);
     64    await invalidAttribTestFn(drawElementsInstanced);
     65    await invalidAttribTestFn(drawRangeElements);
     66    finishTest();
     67 }
     68 runInvalidAttribTests();
     69 
     70 var successfullyParsed = true;
     71 </script>
     72 </body>
     73 </html>