required-extensions.html (1542B)
1 <!-- 2 Copyright (c) 2021 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 <link rel="stylesheet" href="../../resources/js-test-style.css"/> 12 <script src="../../js/js-test-pre.js"></script> 13 <script src="../../js/webgl-test-utils.js"></script> 14 </head> 15 <body> 16 <div id="description"></div> 17 <div id="console"></div> 18 19 <script> 20 "use strict"; 21 const wtu = WebGLTestUtils; 22 let gl; 23 24 description("Ensure that required extensions are supported"); 25 26 shouldBeNonNull("gl = wtu.create3DContext(undefined, undefined, 2)"); 27 28 const supportedExts = gl.getSupportedExtensions(); 29 30 function hasExt(name) { 31 return supportedExts.indexOf(name) >= 0; 32 } 33 34 const has_s3tc = hasExt('WEBGL_compressed_texture_s3tc'); 35 const has_s3tc_srgb = hasExt('WEBGL_compressed_texture_s3tc_srgb'); 36 const has_rgtc = hasExt('EXT_texture_compression_rgtc'); 37 const has_etc = hasExt('WEBGL_compressed_texture_etc'); 38 39 debug(`has_s3tc: ${has_s3tc}`); 40 debug(`has_s3tc_srgb: ${has_s3tc_srgb}`); 41 debug(`has_rgtc: ${has_rgtc}`); 42 debug(`has_etc: ${has_etc}`); 43 44 shouldBeTrue("((has_s3tc && has_s3tc_srgb && has_rgtc) || has_etc)"); 45 46 // ETC1 extension must not be exposed on WebGL 2.0 contexts without ETC2. 47 debug(""); 48 const has_etc1 = hasExt('WEBGL_compressed_texture_etc1'); 49 debug(`has_etc1: ${has_etc1}`); 50 shouldBeTrue("has_etc1 == has_etc"); 51 52 debug(""); 53 var successfullyParsed = true; 54 </script> 55 56 <script src="../../js/js-test-post.js"></script> 57 </body> 58 </html>