tor-browser

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

webgl-compressed-texture-etc1.html (2229B)


      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 WEBGL_compressed_texture_etc1 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 <script src="../../js/tests/compressed-texture-utils.js"></script>
     16 </head>
     17 <body>
     18 <div id="description"></div>
     19 <div id="console"></div>
     20 <script>
     21 "use strict";
     22 description("This test verifies the functionality of the WEBGL_compressed_texture_etc1 extension, if it is available.");
     23 
     24 debug("");
     25 
     26 var validFormats = {
     27  COMPRESSED_RGB_ETC1_WEBGL: 0x8D64,
     28 };
     29 
     30 function expectedByteLength(width, height, format) {
     31  return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8;
     32 }
     33 
     34 function getBlockDimensions(format) {
     35  return {width: 4, height: 4};
     36 }
     37 
     38 var wtu = WebGLTestUtils;
     39 var ctu = CompressedTextureUtils;
     40 var contextVersion = wtu.getDefault3DContextVersion();
     41 var gl = wtu.create3DContext();
     42 var WEBGL_compressed_texture_etc1;
     43 
     44 var formats = null;
     45 
     46 function runTest() {
     47  if (!gl) {
     48    testFailed("context does not exist");
     49  } else {
     50    testPassed("context exists");
     51 
     52    ctu.testCompressedFormatsUnavailableWhenExtensionDisabled(gl, validFormats, expectedByteLength, 4);
     53 
     54    WEBGL_compressed_texture_etc1 = gl.getExtension("WEBGL_compressed_texture_etc1");
     55 
     56    wtu.runExtensionSupportedTest(gl, "WEBGL_compressed_texture_etc1", WEBGL_compressed_texture_etc1 !== null);
     57 
     58    if (WEBGL_compressed_texture_etc1 !== null) {
     59      // Test that enum values are listed correctly in supported formats and in the extension object.
     60      ctu.testCompressedFormatsListed(gl, validFormats);
     61      ctu.testCorrectEnumValuesInExt(WEBGL_compressed_texture_etc1, validFormats);
     62      // Test that texture upload buffer size is validated correctly.
     63      ctu.testFormatRestrictionsOnBufferSize(gl, validFormats, expectedByteLength, getBlockDimensions);
     64    }
     65  }
     66 }
     67 
     68 runTest();
     69 
     70 var successfullyParsed = true;
     71 </script>
     72 <script src="../../js/js-test-post.js"></script>
     73 </body>
     74 </html>