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.
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>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
22 description("This test verifies the functionality of the WEBGL_compressed_texture_etc1 extension, if it is available.");
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
;
48 testFailed("context does not exist");
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
);
70 var successfullyParsed
= true;
72 <script src=
"../../js/js-test-post.js"></script>