tor-browser

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

buffer-bind-test.html (2040B)


      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>WebGL BindBuffer conformance 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="40" height="40" style="width: 40px; height: 40px;"></canvas>
     18 <div id="description"></div>
     19 <div id="console"></div>
     20 <script>
     21 "use strict";
     22 description("Checks a buffer can only be bound to 1 target.");
     23 
     24 debug("");
     25 debug("Canvas.getContext");
     26 
     27 var wtu = WebGLTestUtils;
     28 var gl = wtu.create3DContext("example");
     29 if (!gl) {
     30  testFailed("context does not exist");
     31 } else {
     32  testPassed("context exists");
     33 
     34  debug("");
     35 
     36  var buf = gl.createBuffer();
     37  gl.bindBuffer(gl.ARRAY_BUFFER, buf);
     38  wtu.glErrorShouldBe(gl, gl.NO_ERROR,
     39            "should be able to bind array buffer.");
     40  gl.bindBuffer(gl.ARRAY_BUFFER, null);
     41  wtu.glErrorShouldBe(gl, gl.NO_ERROR,
     42            "should be able to unbind array buffer.");
     43  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf);
     44  wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION,
     45            "should get INVALID_OPERATION if attempting to bind array buffer to different target");
     46 
     47  var buf = gl.createBuffer();
     48  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf);
     49  wtu.glErrorShouldBe(gl, gl.NO_ERROR,
     50            "should be able to bind element array buffer.");
     51  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
     52  wtu.glErrorShouldBe(gl, gl.NO_ERROR,
     53            "should be able to unbind element array buffer.");
     54  gl.bindBuffer(gl.ARRAY_BUFFER, buf);
     55  wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION,
     56            "should get INVALID_OPERATION if attempting to bind element array buffer to different target");
     57 }
     58 
     59 debug("");
     60 var successfullyParsed = true;
     61 </script>
     62 <script src="../../js/js-test-post.js"></script>
     63 
     64 </body>
     65 </html>