Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / textures / misc / mipmap-fbo.html
blobcd48bb77c5c968526c5d980a346ec8059c1175c5
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 mipmap incomplete textures can be used as FBO attachments</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";
23 var wtu = WebGLTestUtils;
24 description();
26 var gl = wtu.create3DContext("example", undefined, 2);
28 var testIncompleteMipmapInFBO = function () {
29 // Create a texture that's not mipmap complete.
30 var texture = gl.createTexture();
31 gl.bindTexture(gl.TEXTURE_2D, texture);
32 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
33 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
34 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
36 // Framebuffer should be incomplete for incomplete texture.
37 var fbo = gl.createFramebuffer();
38 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
39 gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 1);
40 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
43 testIncompleteMipmapInFBO();
45 var successfullyParsed = true;
46 </script>
47 <script src="../../../js/js-test-post.js"></script>
49 </body>
50 </html>