tor-browser

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

index-validation-verifies-too-many-indices.html (1879B)


      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 <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 </head>
     15 <body>
     16 <div id="description"></div>
     17 <div id="console"></div>
     18 
     19 <script>
     20 "use strict";
     21 description('Tests that index validation for drawElements does not examine too many indices');
     22 
     23 var wtu = WebGLTestUtils;
     24 var context = wtu.create3DContext();
     25 var program = wtu.loadStandardProgram(context);
     26 
     27 context.useProgram(program);
     28 var vertexObject = context.createBuffer();
     29 context.enableVertexAttribArray(0);
     30 context.bindBuffer(context.ARRAY_BUFFER, vertexObject);
     31 // 4 vertices -> 2 triangles
     32 context.bufferData(context.ARRAY_BUFFER, new Float32Array([ 0,0,0, 0,1,0, 1,0,0, 1,1,0 ]), context.STATIC_DRAW);
     33 context.vertexAttribPointer(0, 3, context.FLOAT, false, 0, 0);
     34 
     35 var indexObject = context.createBuffer();
     36 
     37 debug("Test out of range indices")
     38 context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, indexObject);
     39 context.bufferData(context.ELEMENT_ARRAY_BUFFER, new Uint16Array([ 10000, 0, 1, 2, 3, 10000 ]), context.STATIC_DRAW);
     40 var indexValidationError = wtu.shouldGenerateGLError(context, [context.INVALID_OPERATION, context.NO_ERROR], "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)");
     41 wtu.shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 2)");
     42 wtu.shouldGenerateGLError(context, indexValidationError, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)");
     43 
     44 debug("")
     45 var successfullyParsed = true;
     46 </script>
     47 
     48 <script src="../../js/js-test-post.js"></script>
     49 </body>
     50 </html>