tor-browser

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

draw-with-integer-texture-base-level.html (2012B)


      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 Draw With Integer Texture Base Level 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 <script src="../../js/tests/tex-image-and-sub-image-utils.js"></script>
     16 </head>
     17 <body>
     18 <canvas id="example" width="24" height="24"></canvas>
     19 <div id="description"></div>
     20 <div id="console"></div>
     21 <script>
     22 "use strict";
     23 
     24 var canvas;
     25 var wtu = WebGLTestUtils;
     26 canvas = document.getElementById("example");
     27 var gl = wtu.create3DContext(canvas, undefined, 2);
     28 var tiu = TexImageUtils;
     29 
     30 // Both Chrome and Firefox fail on this test on NVIDIA Windows, see crbug.com/679639.
     31 function testDrawIntegerTextureBaseLevel()
     32 {
     33    description("This test verifies the functionality of rendering with integer texture non-zero base level.");
     34 
     35    var green = [0, 255, 0, 255];
     36 
     37    var width = 16;
     38    var height = 16;
     39    canvas.width = width;
     40    canvas.height = height;
     41    gl.viewport(0, 0, width, height);
     42 
     43    var texture = gl.createTexture();
     44    var level = 1;
     45    gl.bindTexture(gl.TEXTURE_2D, texture);
     46    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
     47    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
     48    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_BASE_LEVEL, level);
     49    wtu.fillTexture(gl, texture, width, height, green, level, gl.RGBA_INTEGER, gl.UNSIGNED_BYTE, gl.RGBA8UI);
     50    wtu.glErrorShouldBe(gl, gl.NO_ERROR);
     51 
     52    var program = tiu.setupTexturedQuad(gl, "RGBA8UI");
     53    gl.drawArrays(gl.TRIANGLES, 0, 6);
     54    wtu.glErrorShouldBe(gl, gl.NO_ERROR);
     55    wtu.checkCanvas(gl, green);
     56 }
     57 
     58 testDrawIntegerTextureBaseLevel();
     59 var successfullyParsed = true;
     60 </script>
     61 <script src="../../js/js-test-post.js"></script>
     62 
     63 </body>
     64 </html>