tor-browser

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

test_draw_fakevert_large_offset.html (1670B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset=utf-8>
      5 <script src='/tests/SimpleTest/SimpleTest.js'></script>
      6 </head>
      7 <body>
      8 <pre id=e_out></pre>
      9 <script>
     10 ok = window.ok || function(e, s) {
     11  e_out.textContent += `\n${!e ? 'FAIL' : 'pass'}: ${s}`;
     12 };
     13 
     14 // -
     15 
     16 // Bug 1778144
     17 const canvas = document.createElement("canvas")
     18 const gl = canvas.getContext("webgl")
     19 program = gl.createProgram()
     20 vertex = gl.createShader(gl.VERTEX_SHADER)
     21 gl.shaderSource(vertex, `\
     22  precision highp float;
     23  attribute vec4 a_vec4;
     24  uniform bool u_bool;
     25  uniform bvec2 u_bvec2;
     26  uniform bvec3 u_bvec3;
     27  uniform bvec4 u_bvec4;
     28  varying vec2 v_vec2;
     29  void main() {
     30    gl_Position.x += float(a_vec4.x);
     31    if (u_bool || u_bvec2.x || u_bvec3.x || u_bvec4.x) {
     32    }
     33  }
     34 `)
     35 gl.compileShader(vertex)
     36 gl.attachShader(program, vertex)
     37 fragment = gl.createShader(gl.FRAGMENT_SHADER)
     38 gl.shaderSource(fragment, `\
     39  precision highp float;
     40  varying vec2 v_vec2;
     41  uniform sampler2D u_sampler2d;
     42  void main() {
     43    gl_FragColor = texture2D(u_sampler2d, v_vec2);
     44  }
     45 `)
     46 gl.compileShader(fragment)
     47 gl.attachShader(program, fragment)
     48 gl.linkProgram(program)
     49 gl.useProgram(program)
     50 const begin = performance.now();
     51 gl.drawArrays(gl.POINTS, 1659036386, 1)
     52 
     53 let err = gl.getError();
     54 ok(err == gl.OUT_OF_MEMORY || !err, `err: ${err}`);
     55 
     56 const elapsed_ms = performance.now() - begin;
     57 ok(elapsed_ms < 1000, `elapsed_ms:${elapsed_ms} < 1000`);
     58 
     59 // -
     60 
     61 // Let's be kind and kill this now-gpu-memory-heavy context.
     62 gl.getExtension('WEBGL_lose_context').loseContext();
     63 err = gl.getError();
     64 ok(err == gl.CONTEXT_LOST_WEBGL, `err:${err} == gl.CONTEXT_LOST_WEBGL`);
     65 
     66 // -
     67 
     68 ok(true, 'done');
     69 </script>
     70 </body>
     71 </html>