Source code
Revision control
Copy as Markdown
Other Tools
<!--
Copyright (c) 2019 The Khronos Group Inc.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE.txt file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL2 Context Resize Bug Test</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<canvas id="test"></canvas>
<script>
"use strict";
description("This test verifies canvas resize does not affect PIXEL_UNPACK_BUFFER binding.");
var wtu = WebGLTestUtils;
var canvas = document.getElementById("test");
var gl = wtu.create3DContext(canvas, null, 2);
if (!gl) {
testFailed("context does not exist");
} else {
testPassed("context exists");
var texture1= gl.createTexture();
gl.bindTexture(gl.TEXTURE_3D, texture1);
var buffer0= gl.createBuffer();
gl.bindBuffer(gl.PIXEL_UNPACK_BUFFER, buffer0);
canvas.width = 682;
// Resizing canvas incorrectly cleared the PIXEL_UNPACK_BUFFER binding to 0
// and caused a crash from the following line in Chrome. crbug.com/673929.
gl.texImage3D(gl.TEXTURE_3D, 1, gl.R8, 225,664 , 143, 0,
gl.LUMINANCE_ALPHA, gl.UNSIGNED_SHORT_4_4_4_4, 0x41414141);
testPassed("no crash from texImage3D");
}
debug("");
var successfullyParsed = true;
</script>
<script src="../../js/js-test-post.js"></script>
</body>
</html>