tor-browser

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

undefined-index-should-not-crash.html (1690B)


      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>Bug - indexing with 'int()' should not crash</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 <script src="../../../js/glsl-conformance-test.js"></script>
     16 </head>
     17 <body>
     18 <canvas id="example" width="40" height="40"> </canvas>
     19 <div id="description"></div>
     20 <div id="console"></div>
     21 <script id="vshader" type="x-shader/x-vertex">
     22 void main(){
     23  gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
     24 }
     25 </script>
     26 <script id="fshaderTest" type="x-shader/x-fragment">
     27 precision mediump float;
     28 uniform vec4 uniformVec;
     29 uniform mat4 uniformMat;
     30 uniform float uniformArray[4];
     31 void main()
     32 {
     33  vec4 tempVec = vec4(0.0);
     34  mat4 tempMat = mat4(0.0);
     35  float tempArray[4];
     36  gl_FragColor = vec4($(indexed)[int()]);
     37 }
     38 </script>
     39 <script>
     40 "use strict";
     41 var wtu = WebGLTestUtils;
     42 
     43 var fTestSource = wtu.getScript("fshaderTest");
     44 
     45 var tests = [];
     46 
     47 var indexedValues = ['tempVec', 'tempMat[0]', 'tempArray', 'uniformVec', 'uniformMat[0]', 'uniformArray'];
     48 
     49 for (var i = 0; i < indexedValues.length; ++i) {
     50  var subs = {indexed: indexedValues[i]};
     51  tests.push({
     52    vShaderId: "vshader",
     53    vShaderSuccess: true,
     54    fShaderSource: wtu.replaceParams(fTestSource, subs),
     55    fShaderSuccess: false,
     56    linkSuccess: false,
     57    passMsg: "shader with invalid index expression int() should not compile",
     58  });
     59 }
     60 GLSLConformanceTester.runTests(tests);
     61 </script>
     62 </body>
     63 </html>