Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / textures / misc / generate-mipmap-with-large-base-level.html
blob010cc0f913dc5d8b33de27bcb78cd5152da67d82
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 if GenerateMipmap on immutable texture with large BASE_LEVEL triggers a crash</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="24" height="24"></canvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script>
21 "use strict";
22 description("This is a regression test for crbug.com/913301");
23 debug("");
25 var wtu = WebGLTestUtils;
26 var gl = wtu.create3DContext("example", null, 2);
27 gl.clearColor(0, 1, 0, 1);
29 var targets = [gl.TEXTURE_2D, gl.TEXTURE_3D];
30 for (var ii = 0; ii < targets.length; ++ii) {
31 gl.clear(gl.COLOR_BUFFER_BIT);
32 var target = targets[ii];
33 var tex = gl.createTexture();
34 gl.bindTexture(target, tex);
35 gl.texParameteri(target, gl.TEXTURE_BASE_LEVEL, 1416354905);
36 gl.texParameteri(target, gl.TEXTURE_MAX_LEVEL, 5);
37 gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
38 gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
39 if (target == gl.TEXTURE_2D)
40 gl.texStorage2D(target, 5, gl.R8, 32, 32);
41 else
42 gl.texStorage3D(target, 5, gl.R8, 32, 32, 32);
43 // Should not crash calling generateMipmap.
44 gl.generateMipmap(target);
45 gl.deleteTexture(tex);
46 // If crashed, readPixels() won't be able to work correctly.
47 wtu.checkCanvas(gl, [0, 255, 0, 255], "should be green", 5);
48 wtu.glErrorShouldBe(gl, gl.NO_ERROR);
51 var successfullyParsed = true;
52 </script>
53 <script src="../../../js/js-test-post.js"></script>
54 </body>
55 </html>