tor-browser

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

sketchfab-lighting-shader-crash.html (2391B)


      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>Sketchfab Lighting Shader 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 id='vshader1' type='x-shader/x-vertex'>
     16 attribute float testValue;          // Can be uniform as well.
     17 varying mediump float FragVarying;  // Necessary to reproduce.
     18 
     19 void main() {
     20  // Crashes with mat4 as well. Does not crash with vectors.
     21  mat2 projectionMatrix = mat2(0.0, 0.0, 0.0, 0.0);
     22  if (testValue == 1.0)
     23  {
     24    // Using the matrix variable appears necessary.
     25    projectionMatrix[0][0] = 1.0;
     26  }
     27 
     28  FragVarying = 0.0;
     29  // Referencing the matrix is necessary though clearly the compiler
     30  // doesn't realize the assignment is useless.
     31  gl_Position = vec4(projectionMatrix[1][0], 0.0, 0.0, 1.0);
     32 }
     33 </script>
     34 <script id='fshader1' type='x-shader/x-fragment'>
     35 precision mediump float;
     36 varying float FragVarying;
     37 
     38 void main() {
     39  gl_FragColor = vec4(FragVarying, 0.0, 0.0, 1.0);
     40 }
     41 </script>
     42 </head>
     43 <body>
     44 <div id="description"></div>
     45 <div id="console"></div>
     46 <script>
     47 "use strict";
     48 description("This test demonstrates a crash on the Nexus 5 (Adreno 330) when compiling Sketchfab's lighting shader. <a href='https://code.google.com/p/chromium/issues/detail?id=551937'>crbug.com/551937</a>");
     49 
     50 debug("");
     51 
     52 var wtu = WebGLTestUtils;
     53 var gl = wtu.create3DContext();
     54 
     55 gl.canvas.addEventListener("webglcontextlost", function(e) {
     56   testFailed("WebGL context lost");
     57 });
     58 
     59 if (!gl) {
     60    testFailed("WebGL context does not exist");
     61 } else {
     62    testPassed("WebGL context exists");
     63    debug("");
     64 
     65    var program1 = wtu.setupProgram(gl, ['vshader1', 'fshader1']);
     66    if (!gl.getProgramParameter(program1, gl.LINK_STATUS)) {
     67        testFailed("Program failed to link");
     68    } else {
     69        testPassed("Program linked successfully");
     70    }
     71    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
     72 
     73    debug("");
     74 }
     75 
     76 // Cycle through rAF a few times to give any webglcontextlost events a chance to propagate.
     77 wtu.waitForComposite(function() { finishTest(); });
     78 
     79 debug("");
     80 var successfullyParsed = true;
     81 </script>
     82 
     83 </body>
     84 </html>