tor-browser

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

loop-if-loop-gradient.html (2069B)


      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>Gradient loop in if in loop 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='vshader' type='x-shader/x-vertex'>
     16 precision highp float;
     17 void main() {
     18 gl_Position = vec4( 1.0, 1.0, 1.0, 1.0 );
     19 }
     20 </script>
     21 <script id='fshader' type='x-shader/x-fragment'>
     22 precision mediump float;
     23 uniform lowp sampler2D iChannel0;
     24 
     25 void main(){
     26    highp float c;
     27    for (mediump float i = 0.0; i <= 1.0; i++) {
     28        if (gl_FragCoord.x < 0.0) {
     29            for (mediump float l = 0.0; l < 2.0; l++) { // with 1 as a bound it works
     30                c = texture2D(iChannel0, vec2(l), 0.0).x;
     31            }
     32        }
     33    }
     34    gl_FragColor = vec4(c, vec3(1.0));
     35 }
     36 </script>
     37 </head>
     38 <body>
     39 <div id="description"></div>
     40 <div id="console"></div>
     41 <script>
     42 "use strict";
     43 description("This test checks an ANGLE regression that was caused by a complex ShaderToy shader. <a href='https://code.google.com/p/chromium/issues/detail?id=524297'>crbug.com/524297</a>");
     44 
     45 debug("");
     46 
     47 var wtu = WebGLTestUtils;
     48 var gl = wtu.create3DContext();
     49 
     50 gl.canvas.addEventListener("webglcontextlost", function(e) {
     51   testFailed("WebGL context lost");
     52 });
     53 
     54 if (!gl) {
     55    testFailed("WebGL context does not exist");
     56 } else {
     57    testPassed("WebGL context exists");
     58    debug("");
     59 
     60    var program = wtu.setupProgram(gl, ['vshader', 'fshader']);
     61    if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
     62        testFailed("Program failed to link");
     63    }
     64    wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
     65 }
     66 
     67 // Cycle through a rAF once to give any webglcontextlost events a chance to propagate
     68 window.requestAnimationFrame(function() { finishTest(); });
     69 
     70 debug("");
     71 var successfullyParsed = true;
     72 </script>
     73 
     74 </body>
     75 </html>