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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial