content/canvas/test/webgl-conformance/conformance/textures/compressed-tex-image.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 <!--
michael@0 2 Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 3 Use of this source code is governed by a BSD-style license that can be
michael@0 4 found in the LICENSE file.
michael@0 5 -->
michael@0 6 <!DOCTYPE html>
michael@0 7 <html>
michael@0 8 <head>
michael@0 9 <meta charset="utf-8">
michael@0 10 <title>WebGL CompressedTexImage and CompressedTexSubImage Tests</title>
michael@0 11 <LINK rel="stylesheet" href="../../resources/js-test-style.css"/>
michael@0 12 <script src="../../resources/js-test-pre.js"></script>
michael@0 13 <script src="../resources/webgl-test.js"></script>
michael@0 14 <script src="../resources/webgl-test-utils.js"></script>
michael@0 15 </head>
michael@0 16 <body>
michael@0 17 <div id="description"></div>
michael@0 18 <div id="console"></div>
michael@0 19 <script>
michael@0 20 description("This test ensures WebGL implementations correctly implement compressedTexImage2D and compressedTexSubImage2D.");
michael@0 21
michael@0 22 debug("");
michael@0 23
michael@0 24 var wtu = WebGLTestUtils;
michael@0 25 var gl = wtu.create3DContext();
michael@0 26
michael@0 27 const COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
michael@0 28 const COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
michael@0 29 const COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
michael@0 30 const ETC1_RGB8_OES = 0x8D64;
michael@0 31 const COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
michael@0 32 const COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
michael@0 33
michael@0 34 var formats = null;
michael@0 35
michael@0 36 if (!gl) {
michael@0 37 testFailed("context does not exist");
michael@0 38 } else {
michael@0 39 testPassed("context exists");
michael@0 40
michael@0 41 var tex = gl.createTexture();
michael@0 42 gl.bindTexture(gl.TEXTURE_2D, tex);
michael@0 43
michael@0 44 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))");
michael@0 45 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))");
michael@0 46 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 4, 0, new Uint8Array(16))");
michael@0 47 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ETC1_RGB8_OES, 4, 4, 0, new Uint8Array(8))");
michael@0 48 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))");
michael@0 49 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))");
michael@0 50
michael@0 51 shouldGenerateGLError(gl, gl.NO_ERROR, "formats = gl.getParameter(gl.COMPRESSED_TEXTURE_FORMATS)");
michael@0 52 shouldBeNonNull("formats");
michael@0 53 shouldBe("formats.length", "0");
michael@0 54 }
michael@0 55
michael@0 56 successfullyParsed = true;
michael@0 57 </script>
michael@0 58 <script>finishTest();</script>
michael@0 59 </body>
michael@0 60 </html>

mercurial