mipmap-fbo.html (1620B)
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 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"; 22 23 var wtu = WebGLTestUtils; 24 description(); 25 26 var gl = wtu.create3DContext("example", undefined, 2); 27 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); 35 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"); 41 } 42 43 testIncompleteMipmapInFBO(); 44 45 var successfullyParsed = true; 46 </script> 47 <script src="../../../js/js-test-post.js"></script> 48 49 </body> 50 </html>