copy-texture-cube-map-AMD-bug.html (3206B)
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>WebGL copy into cube map texture conformance test</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 <div id="description"></div> 18 <div id="console"></div> 19 <canvas id="canvas" width="2" height="2"> </canvas> 20 <script> 21 "use strict"; 22 var wtu = WebGLTestUtils; 23 var gl; 24 25 function runTest() { 26 var width = 16; 27 var height = 16; 28 var level = 0; 29 var cases = [ 30 { 31 internalformat: "RGBA8", 32 format: "RGBA", 33 type: "UNSIGNED_BYTE", 34 data: new Uint8Array(width * height * 4) 35 }, 36 { 37 internalformat: "RGBA8I", 38 format: "RGBA_INTEGER", 39 type: "BYTE", 40 data: new Int8Array(width * height * 4) 41 }, 42 { 43 internalformat: "RGBA8UI", 44 format: "RGBA_INTEGER", 45 type: "UNSIGNED_BYTE", 46 data: new Uint8Array(width * height * 4) 47 } 48 ]; 49 if (gl.getExtension("EXT_color_buffer_float")) { 50 cases.push({ 51 internalformat: "RGBA32F", 52 format: "RGBA", 53 type: "FLOAT", 54 data: new Float32Array(width * height * 4) 55 }); 56 } 57 cases.forEach(function(testcase) { 58 debug(""); 59 debug("Testing internalformat: " + testcase.internalformat); 60 61 var internalformat = gl[testcase.internalformat]; 62 var format = gl[testcase.format]; 63 var type = gl[testcase.type]; 64 var texture = gl.createTexture(); 65 gl.bindTexture(gl.TEXTURE_2D, texture); 66 var data = testcase.data; 67 gl.texImage2D(gl.TEXTURE_2D, level, internalformat, width, height, 0, format, type, data); 68 var fbo = gl.createFramebuffer(); 69 gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); 70 gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, level); 71 shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE"); 72 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Setup framebuffer with texture should succeed."); 73 74 var cubeTexture = gl.createTexture(); 75 gl.bindTexture(gl.TEXTURE_CUBE_MAP, cubeTexture); 76 77 for (var face = gl.TEXTURE_CUBE_MAP_POSITIVE_X; face < gl.TEXTURE_CUBE_MAP_POSITIVE_X + 6; face++) { 78 gl.copyTexImage2D(face, level, internalformat, 0, 0, width, height, 0); 79 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "CopyTexImage2D should succeed."); 80 gl.copyTexSubImage2D(face, level, 0, 0, 0, 0, width, height); 81 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "CopyTexSubImage2D should succeed."); 82 } 83 84 gl.deleteTexture(cubeTexture); 85 gl.deleteTexture(texture); 86 gl.deleteFramebuffer(fbo); 87 }); 88 } 89 90 description(); 91 debug("This is a regression test for <a href='https://bugs.chromium.org/p/chromium/issues/detail?id=712117'>Chromium Issue 712117</a>"); 92 93 var canvas = document.getElementById("canvas"); 94 shouldBeNonNull("gl = wtu.create3DContext(canvas, undefined, 2)"); 95 96 runTest(); 97 98 var successfullyParsed = true; 99 100 </script> 101 <script src="../../../js/js-test-post.js"></script> 102 103 </body> 104 </html>