Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / textures / misc / tex-image-with-bad-args.html
blob514e5eebc135e31303baa2129601eeb607179079
1 <!--
2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
5 -->
6 <!DOCTYPE html>
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
11 <script src="../../../js/js-test-pre.js"></script>
12 <script src="../../../js/webgl-test-utils.js"></script>
13 </head>
14 <body>
15 <canvas id="c" width="16" height="16"></canvas>
16 <div id="description"></div>
17 <div id="console"></div>
18 <script>
19 "use strict";
20 description('Tests texImage2D with invalid internalformat/format/type combinations');
21 debug("This includes a regression test for <a href='https://bugs.chromium.org/p/chromium/issues/detail?id=656889'>Chromium Issue 656889</a>");
23 var wtu = WebGLTestUtils;
24 var gl = wtu.create3DContext("c", null, 2);
25 var ext = null;
26 if (!gl) {
27 testFailed("WebGL context does not exist");
28 } else {
29 testPassed("WebGL context exists");
32 var doTexImage = function(test) {
33 var tex = gl.createTexture();
34 gl.bindTexture(gl.TEXTURE_2D, tex);
35 gl.texImage2D(gl.TEXTURE_2D, 0, test.internalformat, 64, 64, 0, test.format, test.type, null);
36 wtu.glErrorShouldBe(gl, test.errors, "TexImage2D taking " + wtu.glEnumToString(gl, test.internalformat) + "/" +
37 wtu.glEnumToString(gl, test.format) + "/" + wtu.glEnumToString(gl, test.type));
38 gl.deleteTexture(tex);
41 var tests = [
42 { internalformat: gl.RGBA, format: gl.RGBA, type: gl.UNSIGNED_BYTE, errors: [gl.NO_ERROR] },
43 { internalformat: gl.RGBA, format: gl.RGBA, type: gl.FLOAT, errors: [gl.INVALID_OPERATION] },
44 { internalformat: gl.RGBA, format: gl.RGBA, type: gl.HALF_FLOAT, errors: [gl.INVALID_OPERATION] },
45 { internalformat: gl.LUMINANCE, format: gl.LUMINANCE, type: gl.FLOAT, errors: [gl.INVALID_OPERATION] },
46 { internalformat: gl.LUMINANCE_ALPHA, format: gl.LUMINANCE_ALPHA, type: gl.HALF_FLOAT, errors: [gl.INVALID_OPERATION] },
47 { internalformat: 0x822A /*GL_R16_EXT*/ , format: gl.RED, type: gl.UNSIGNED_SHORT, errors: [gl.INVALID_VALUE, gl.INVALID_OPERATION] },
48 { internalformat: gl.RED, format: gl.RED, type: gl.UNSIGNED_SHORT, errors: [gl.INVALID_VALUE, gl.INVALID_OPERATION] },
51 tests.forEach(doTexImage);
53 var successfullyParsed = true;
54 </script>
55 <script src="../../../js/js-test-post.js"></script>
56 </body>
57 </html>