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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/webgl-conformance/conformance/textures/compressed-tex-image.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +<!--
     1.5 +Copyright (c) 2012 The Chromium Authors. All rights reserved.
     1.6 +Use of this source code is governed by a BSD-style license that can be
     1.7 +found in the LICENSE file.
     1.8 + -->
     1.9 +<!DOCTYPE html>
    1.10 +<html>
    1.11 +<head>
    1.12 +<meta charset="utf-8">
    1.13 +<title>WebGL CompressedTexImage and CompressedTexSubImage Tests</title>
    1.14 +<LINK rel="stylesheet" href="../../resources/js-test-style.css"/>
    1.15 +<script src="../../resources/js-test-pre.js"></script>
    1.16 +<script src="../resources/webgl-test.js"></script>
    1.17 +<script src="../resources/webgl-test-utils.js"></script>
    1.18 +</head>
    1.19 +<body>
    1.20 +<div id="description"></div>
    1.21 +<div id="console"></div>
    1.22 +<script>
    1.23 +description("This test ensures WebGL implementations correctly implement compressedTexImage2D and compressedTexSubImage2D.");
    1.24 +
    1.25 +debug("");
    1.26 +
    1.27 +var wtu = WebGLTestUtils;
    1.28 +var gl = wtu.create3DContext();
    1.29 +
    1.30 +const  COMPRESSED_RGB_S3TC_DXT1_EXT        = 0x83F0;
    1.31 +const  COMPRESSED_RGBA_S3TC_DXT1_EXT       = 0x83F1;
    1.32 +const  COMPRESSED_RGBA_S3TC_DXT5_EXT       = 0x83F3;
    1.33 +const  ETC1_RGB8_OES                       = 0x8D64;
    1.34 +const  COMPRESSED_RGB_PVRTC_4BPPV1_IMG     = 0x8C00;
    1.35 +const  COMPRESSED_RGBA_PVRTC_4BPPV1_IMG    = 0x8C02;
    1.36 +
    1.37 +var formats = null;
    1.38 +
    1.39 +if (!gl) {
    1.40 +  testFailed("context does not exist");
    1.41 +} else {
    1.42 +  testPassed("context exists");
    1.43 +
    1.44 +  var tex = gl.createTexture();
    1.45 +  gl.bindTexture(gl.TEXTURE_2D, tex);
    1.46 +
    1.47 +  shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))");
    1.48 +  shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))");
    1.49 +  shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 4, 0, new Uint8Array(16))");
    1.50 +  shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ETC1_RGB8_OES, 4, 4, 0, new Uint8Array(8))");
    1.51 +  shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))");
    1.52 +  shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))");
    1.53 +
    1.54 +  shouldGenerateGLError(gl, gl.NO_ERROR, "formats = gl.getParameter(gl.COMPRESSED_TEXTURE_FORMATS)");
    1.55 +  shouldBeNonNull("formats");
    1.56 +  shouldBe("formats.length", "0");
    1.57 +}
    1.58 +
    1.59 +successfullyParsed = true;
    1.60 +</script>
    1.61 +<script>finishTest();</script>
    1.62 +</body>
    1.63 +</html>

mercurial