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.
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>
17 <canvas id=
"example" width=
"24" height=
"24"></canvas>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
23 var wtu
= WebGLTestUtils
;
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;
47 <script src=
"../../../js/js-test-post.js"></script>