Backed out changeset 8fc3326bce7f (bug 1943032) for causing failures at browser_tab_g...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / extra / texture-allocation-stress-test.html
blobe27628b6216ffbdd89cb9e2c7f33ad1215d64e69
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 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>Tests that resources allocated by a WebGL context are freed in a reasonable timeframe.</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="32" height="32">
20 </canvas>
21 <script>
22 "use strict";
23 description();
25 debug("Creates a WebGL context and textures consuming ~80 MB of video memory, then reloads the page and does it over again.")
26 debug("GPU memory usage should be capped. It should not grow unboundedly.")
28 var wtu = WebGLTestUtils;
30 var gl = wtu.create3DContext(document.getElementById("canvas"));
31 var textures = [];
33 for (var ii = 0; ii < 20; ++ii) {
34 var tex = gl.createTexture();
35 gl.bindTexture(gl.TEXTURE_2D, tex);
36 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1024, 1024, 0, gl.RGBA, gl.UNSIGNED_BYTE,
37 null);
38 textures.push(tex);
41 setTimeout(function() { debug("Reloading..."); window.location.reload(); }, 500);
43 var successfullyParsed = true;
44 </script>
46 </body>
47 </html>