5 <title>WebGL CompressedTexImage and CompressedTexSubImage Tests
</title>
6 <script src=
"../../../resources/js-test.js"></script>
7 <script src=
"resources/webgl-test.js"></script>
8 <script src=
"resources/webgl-test-utils.js"></script>
11 <div id=
"description"></div>
12 <div id=
"console"></div>
14 description("This test ensures WebGL implementations correctly implement compressedTexImage2D and compressedTexSubImage2D.");
19 window
.internals
.settings
.setWebGLErrorsToConsoleEnabled(false);
21 var wtu
= WebGLTestUtils
;
22 var canvas
= document
.createElement("canvas");
23 var gl
= wtu
.create3DContext(canvas
);
25 const COMPRESSED_RGB_S3TC_DXT1_EXT
= 0x83F0;
26 const COMPRESSED_RGBA_S3TC_DXT1_EXT
= 0x83F1;
27 const COMPRESSED_RGBA_S3TC_DXT5_EXT
= 0x83F3;
28 const ETC1_RGB8_OES
= 0x8D64;
29 const COMPRESSED_RGB_PVRTC_4BPPV1_IMG
= 0x8C00;
30 const COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
= 0x8C02;
33 testFailed("context does not exist");
35 testPassed("context exists");
37 var tex
= gl
.createTexture();
38 gl
.bindTexture(gl
.TEXTURE_2D
, tex
);
40 shouldGenerateGLError(gl
, gl
.INVALID_ENUM
, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))");
41 shouldGenerateGLError(gl
, gl
.INVALID_ENUM
, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))");
42 shouldGenerateGLError(gl
, gl
.INVALID_ENUM
, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 4, 0, new Uint8Array(16))");
43 shouldGenerateGLError(gl
, gl
.INVALID_ENUM
, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ETC1_RGB8_OES, 4, 4, 0, new Uint8Array(8))");
44 shouldGenerateGLError(gl
, gl
.INVALID_ENUM
, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))");
45 shouldGenerateGLError(gl
, gl
.INVALID_ENUM
, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))");