tor-browser

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

tex-3d-mipmap-levels-intel-bug.html (2773B)


      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>WebGL2 3D texture mipmap level conformance test.</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 <canvas id="example" width="2" height="2" style="width: 2px; height: 2px;"></canvas>
     18 <div id="description"></div>
     19 <div id="console"></div>
     20 <script id="vshader_texsize" type="x-shader/x-vertex">#version 300 es
     21 in vec4 vPosition;
     22 void main()
     23 {
     24    gl_Position = vPosition;
     25 }
     26 </script>
     27 
     28 <script id="fshader_texsize_3d" type="x-shader/x-fragment">#version 300 es
     29 precision mediump float;
     30 uniform highp sampler3D tex;
     31 uniform int lod;
     32 uniform ivec3 texSize;
     33 out vec4 fragColor;
     34 void main()
     35 {
     36    fragColor = (textureSize(tex, lod) == texSize ? vec4(255, 0, 0, 255) : vec4(0, 0, 0, 255));
     37 }
     38 </script>
     39 
     40 
     41 <script>
     42 "use strict";
     43 description(document.title);
     44 var wtu = WebGLTestUtils;
     45 var gl = wtu.create3DContext("example", undefined, 2);
     46 
     47 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
     48 
     49 // This test fails on Intel Mesa, see crbug.com/666384.
     50 (function() {
     51  debug("");
     52  debug("Test textureSize should work correctly with non-zero base level for texStorage3D");
     53  var program = wtu.setupProgram(
     54      gl, ['vshader_texsize', 'fshader_texsize_3d'], ['vPosition'], [0]);
     55  wtu.setupUnitQuad(gl, 0, 1);
     56 
     57  gl.uniform1i(gl.getUniformLocation(program, "tex"), 0);
     58  gl.uniform1i(gl.getUniformLocation(program, "lod"), 1);
     59  gl.uniform3i(gl.getUniformLocation(program, "texSize"), 8, 4, 2);
     60  var tex3d = gl.createTexture();
     61  gl.bindTexture(gl.TEXTURE_3D, tex3d);
     62  gl.texParameteri(gl.TEXTURE_3D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
     63  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texParameter(TEXTURE_MAG_FILTER) should succeed");
     64  gl.texParameteri(gl.TEXTURE_3D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
     65  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texParameter(TEXTURE_MIN_FILTER) should succeed");
     66  gl.texParameteri(gl.TEXTURE_3D, gl.TEXTURE_BASE_LEVEL, 1);
     67  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texParameter(TEXTURE_BASE_LEVEL) should succeed");
     68  gl.texStorage3D(gl.TEXTURE_3D, 4, gl.RGBA8, 32, 16, 8);
     69  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texStorage3D should succeed");
     70  wtu.clearAndDrawUnitQuad(gl);
     71  wtu.glErrorShouldBe(gl, gl.NO_ERROR, "clearAndDrawQuad should succeed");
     72  wtu.checkCanvas(gl, [255, 0, 0, 255], "should draw with [255, 0, 0, 255]");
     73  gl.deleteTexture(tex3d);
     74 })();
     75 
     76 var successfullyParsed = true;
     77 
     78 </script>
     79 <script src="../../../js/js-test-post.js"></script>
     80 
     81 </body>
     82 </html>