OLD | NEW |
(Empty) | |
| 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 compres
sedTexImage2D and compressedTexSubImage2D."); |
| 21 |
| 22 debug(""); |
| 23 |
| 24 var wtu = WebGLTestUtils; |
| 25 var canvas = document.createElement("canvas"); |
| 26 var gl = wtu.create3DContext(canvas); |
| 27 |
| 28 const COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; |
| 29 const COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; |
| 30 const COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; |
| 31 const ETC1_RGB8_OES = 0x8D64; |
| 32 const COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00; |
| 33 const COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02; |
| 34 |
| 35 var formats = null; |
| 36 |
| 37 if (!gl) { |
| 38 testFailed("context does not exist"); |
| 39 } else { |
| 40 testPassed("context exists"); |
| 41 |
| 42 var tex = gl.createTexture(); |
| 43 gl.bindTexture(gl.TEXTURE_2D, tex); |
| 44 |
| 45 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE
_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))"); |
| 46 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE
_2D, 0, COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8))"); |
| 47 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE
_2D, 0, COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 4, 0, new Uint8Array(16))"); |
| 48 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE
_2D, 0, ETC1_RGB8_OES, 4, 4, 0, new Uint8Array(8))"); |
| 49 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE
_2D, 0, COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))"); |
| 50 shouldGenerateGLError(gl, gl.INVALID_ENUM, "gl.compressedTexImage2D(gl.TEXTURE
_2D, 0, COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 8, 8, 0, new Uint8Array(8))"); |
| 51 |
| 52 shouldGenerateGLError(gl, gl.NO_ERROR, "formats = gl.getParameter(gl.COMPRESSE
D_TEXTURE_FORMATS)"); |
| 53 shouldBeNonNull("formats"); |
| 54 shouldBe("formats.length", "0"); |
| 55 } |
| 56 |
| 57 successfullyParsed = true; |
| 58 </script> |
| 59 <script src="../../resources/js-test-post.js"></script> |
| 60 </body> |
| 61 </html> |
OLD | NEW |