tor-browser

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

tex-image-with-different-data-source.html (2062B)


      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 <!DOCTYPE html>
      7 <html>
      8 <head>
      9 <meta charset="utf-8">
     10 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
     11 <script src="../../../js/js-test-pre.js"></script>
     12 <script src="../../../js/webgl-test-utils.js"></script>
     13 </head>
     14 <body>
     15 <canvas id="canvas1" width="16" height="16"></canvas>
     16 <canvas id="canvas2" width="16" height="16"></canvas>
     17 <canvas id="c" width="16" height="16"></canvas>
     18 <div id="description"></div>
     19 <div id="console"></div>
     20 <script>
     21 "use strict";
     22 description('Tests texImage2D with different data source');
     23 
     24 var wtu = WebGLTestUtils;
     25 var c = document.getElementById("c");
     26 var gl = wtu.create3DContext("canvas1", undefined, 2);
     27 var tex = gl.createTexture();
     28 
     29 // Do TexImage2D taking a canvas source first.
     30 gl.bindTexture(gl.TEXTURE_2D, tex);
     31 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, gl.RGBA, gl.UNSIGNED_BYTE, c);
     32 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "TexImage2D taking a canvas source should succeed");
     33 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB10_A2UI, 16, 16, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT_2_10_10_10_REV, null);
     34 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Teximage2D taking a null array buffer should succeed");
     35 gl.deleteTexture(tex);
     36 
     37 // Do TexImage2D taking an array buffer first.
     38 gl = wtu.create3DContext("canvas2", undefined, 2);
     39 tex = gl.createTexture();
     40 gl.bindTexture(gl.TEXTURE_2D, tex);
     41 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB10_A2UI, 16, 16, 0, gl.RGBA_INTEGER, gl.UNSIGNED_INT_2_10_10_10_REV, null);
     42 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Teximage2D taking a null array buffer should succeed");
     43 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB10_A2UI, gl.RGBA_INTEGER, gl.UNSIGNED_INT_2_10_10_10_REV, c);
     44 wtu.glErrorShouldBe(gl, [gl.INVALID_VALUE, gl.INVALID_ENUM], "TexImage2D taking RGB10_A2UI internalformat and a canvas source should fail");
     45 gl.deleteTexture(tex);
     46 
     47 var successfullyParsed = true;
     48 </script>
     49 <script src="../../../js/js-test-post.js"></script>
     50 </body>
     51 </html>