context-eviction-with-garbage-collection.html (1643B)
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 that context eviction and garbage collection do not interfere with each other</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 <script> 20 "use strict"; 21 // See http://crbug.com/374086 for original failing case. 22 description("Test that context eviction and garbage collection do not interfere with each other."); 23 var wtu = WebGLTestUtils; 24 25 var total_iteration = 50; 26 var array_count = 10; 27 28 var bank = []; 29 for (var i = 0; i < array_count; i++) 30 bank[i] = []; 31 32 for (var iter = 0; iter < total_iteration; ++iter) { 33 for (var i = 0; i < array_count; i++) 34 bank[i][iter * i] = iter; 35 36 var canvas = document.createElement('canvas'); 37 var gl = wtu.create3DContext(canvas); 38 canvas.width = 50; 39 canvas.height = 50; 40 var program = wtu.setupTexturedQuad(gl); 41 shouldBeTrue("program != null"); 42 var tex = gl.createTexture(); 43 gl.bindTexture(gl.TEXTURE_2D, tex); 44 var pixel = new Uint8Array([0, 255, 0, 255]); 45 gl.texImage2D( 46 gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixel); 47 wtu.clearAndDrawUnitQuad(gl); 48 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from iteration " + iter); 49 } 50 51 var successfullyParsed = true; 52 </script> 53 <script src="../../js/js-test-post.js"></script> 54 55 </body> 56 </html>