tor-browser

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

fb-attach-implicit-target-assignment.html (2852B)


      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>WebGL gl calls Conformance Tests</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 </head>
     16 <body>
     17 <div id='description'></div>
     18 <div id='console'></div>
     19 <canvas id='canvas' width='2' height='2'> </canvas>
     20 <script>
     21 'use strict';
     22 description('Test implicit target assignment during FB attachment');
     23 
     24 const wtu = WebGLTestUtils;
     25 const gl = wtu.create3DContext('canvas');
     26 let fb, rb, tex;
     27 
     28 (() => {
     29    if (!gl) {
     30        testFailed('context does not exist');
     31        return;
     32    }
     33 
     34    fb = gl.createFramebuffer();
     35    gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
     36 
     37    wtu.glErrorShouldBe(gl, 0, 'No errors');
     38 
     39    // -
     40 
     41    debug('');
     42    debug('framebufferRenderbuffer');
     43 
     44    rb = gl.createRenderbuffer();
     45    shouldBe('gl.isRenderbuffer(rb)', 'false');
     46    gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
     47    shouldBe('gl.isRenderbuffer(rb)', 'true');
     48 
     49    rb = gl.createRenderbuffer();
     50    shouldBe('gl.isRenderbuffer(rb)', 'false');
     51    gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rb);
     52    wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, 'framebufferRenderbuffer must be preceeded by some bindRenderbuffer');
     53    shouldBe('gl.isRenderbuffer(rb)', 'false');
     54 
     55    wtu.glErrorShouldBe(gl, 0, 'No errors');
     56 
     57    // -
     58 
     59    debug('');
     60    debug('framebufferTexture2D');
     61 
     62    tex = gl.createTexture();
     63    shouldBe('gl.isTexture(tex)', 'false');
     64    gl.bindTexture(gl.TEXTURE_2D, tex);
     65    shouldBe('gl.isTexture(tex)', 'true');
     66 
     67    tex = gl.createTexture();
     68    shouldBe('gl.isTexture(tex)', 'false');
     69    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);
     70    // https://bugzilla.mozilla.org/show_bug.cgi?id=1636524 :
     71    wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, 'framebufferTexture2D must be preceeded by some bindTexture');
     72    shouldBe('gl.isTexture(tex)', 'false');
     73 
     74    gl.bindTexture(gl.TEXTURE_CUBE_MAP, tex);
     75    wtu.glErrorShouldBe(gl, 0, 'No errors after bindTexture');
     76 
     77    tex = gl.createTexture();
     78    shouldBe('gl.isTexture(tex)', 'false');
     79    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X, tex, 0);
     80    wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, 'framebufferTexture2D must be preceeded by some bindTexture');
     81    shouldBe('gl.isTexture(tex)', 'false');
     82 
     83    gl.bindTexture(gl.TEXTURE_2D, tex);
     84    wtu.glErrorShouldBe(gl, 0, 'No errors after bindTexture');
     85 })();
     86 
     87 debug('');
     88 var successfullyParsed = true;
     89 
     90 </script>
     91 <script src='../../js/js-test-post.js'></script>
     92 
     93 </body>
     94 </html>