context-resize-changes-buffer-binding-bug.html (1476B)
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>WebGL2 Context Resize Bug 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="test"></canvas> 20 <script> 21 "use strict"; 22 description("This test verifies canvas resize does not affect PIXEL_UNPACK_BUFFER binding."); 23 24 var wtu = WebGLTestUtils; 25 var canvas = document.getElementById("test"); 26 var gl = wtu.create3DContext(canvas, null, 2); 27 if (!gl) { 28 testFailed("context does not exist"); 29 } else { 30 testPassed("context exists"); 31 var texture1= gl.createTexture(); 32 gl.bindTexture(gl.TEXTURE_3D, texture1); 33 var buffer0= gl.createBuffer(); 34 gl.bindBuffer(gl.PIXEL_UNPACK_BUFFER, buffer0); 35 36 canvas.width = 682; 37 // Resizing canvas incorrectly cleared the PIXEL_UNPACK_BUFFER binding to 0 38 // and caused a crash from the following line in Chrome. crbug.com/673929. 39 gl.texImage3D(gl.TEXTURE_3D, 1, gl.R8, 225,664 , 143, 0, 40 gl.LUMINANCE_ALPHA, gl.UNSIGNED_SHORT_4_4_4_4, 0x41414141); 41 testPassed("no crash from texImage3D"); 42 } 43 debug(""); 44 var successfullyParsed = true; 45 </script> 46 <script src="../../js/js-test-post.js"></script> 47 48 </body> 49 </html>