Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / textures / misc / tex-subimage3d-canvas-bug.html
blob2c2d021d5a11044ea028c0a931c16e2c963b3e51
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 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>Test bug of TexSubImage3D with canvas</title>
12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
13 <script src="../../../js/js-test-pre.js"></script>
14 <script src="../../../js/webgl-test-utils.js"></script>
15 </head>
16 <body>
17 <canvas id="example" width="2" height="2" style="width: 2px; height: 2px;"></canvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script>
21 "use strict";
22 description(document.title);
23 debug("This is a regression test for <a href='https://bugs.chromium.org/p/chromium/issues/detail?id=859400'>Chromium Issue 859400</a>");
24 debug("");
26 var wtu = WebGLTestUtils;
27 var gl = wtu.create3DContext("example", undefined, 2);
29 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
31 function runTest() {
32 var ctx = document.createElement('canvas').getContext("2d");
33 var maxTexSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
34 var width = Math.ceil(Math.sqrt(maxTexSize));
35 var height = width;
36 var depth = width + 1;
37 ctx.canvas.width = width;
38 // Set canvas height to a value larger than MAX_TEXTURE_SIZE.
39 // This triggers a validation bug in Chrome.
40 ctx.canvas.height = height * depth;
42 var tex = gl.createTexture();
43 gl.bindTexture(gl.TEXTURE_2D_ARRAY, tex);
44 gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 1, gl.RGBA8, width, height, depth);
45 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from TexStorage3D.");
46 gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, width, height, depth,
47 gl.RGBA, gl.UNSIGNED_BYTE, ctx.canvas);
48 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from TexSubImage3D.");
51 runTest();
52 var successfullyParsed = true;
53 </script>
54 <script src="../../../js/js-test-post.js"></script>
55 </body>
56 </html>