Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / extensions / webgl-compressed-texture-etc1.html
blob09a6ed06423905e40376aa160fcd97dfa93e2336
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 -->
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.");
24 debug("");
26 var validFormats = {
27 COMPRESSED_RGB_ETC1_WEBGL: 0x8D64,
30 function expectedByteLength(width, height, format) {
31 return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8;
34 function getBlockDimensions(format) {
35 return {width: 4, height: 4};
38 var wtu = WebGLTestUtils;
39 var ctu = CompressedTextureUtils;
40 var contextVersion = wtu.getDefault3DContextVersion();
41 var gl = wtu.create3DContext();
42 var WEBGL_compressed_texture_etc1;
44 var formats = null;
46 function runTest() {
47 if (!gl) {
48 testFailed("context does not exist");
49 } else {
50 testPassed("context exists");
52 ctu.testCompressedFormatsUnavailableWhenExtensionDisabled(gl, validFormats, expectedByteLength, 4);
54 WEBGL_compressed_texture_etc1 = gl.getExtension("WEBGL_compressed_texture_etc1");
56 wtu.runExtensionSupportedTest(gl, "WEBGL_compressed_texture_etc1", WEBGL_compressed_texture_etc1 !== null);
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);
68 runTest();
70 var successfullyParsed = true;
71 </script>
72 <script src="../../js/js-test-post.js"></script>
73 </body>
74 </html>