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.
10 <meta charset=
"utf-8">
11 <link rel=
"stylesheet" href=
"../../resources/js-test-style.css"/>
12 <script src=
"../../js/js-test-pre.js"></script>
13 <script src=
"../../js/webgl-test-utils.js"></script>
16 <div id=
"description"></div>
17 <div id=
"console"></div>
21 description("Test ARRAY_BUFFER deletion when a vertex attrib array with location != 0 is pointing to it and preserveDrawingBuffer is true.");
23 var canvas
= document
.createElement('canvas');
24 document
.body
.appendChild(canvas
);
26 canvas
.addEventListener(
29 testFailed("Context lost");
30 event
.preventDefault();
34 var wtu
= WebGLTestUtils
;
35 var gl
= wtu
.create3DContext(canvas
, {preserveDrawingBuffer
: true});
38 testFailed("context does not exist");
41 var array
= new Float32Array([0]);
42 var buf
= gl
.createBuffer();
43 gl
.bindBuffer(gl
.ARRAY_BUFFER
, buf
);
44 gl
.bufferData(gl
.ARRAY_BUFFER
, array
, gl
.STATIC_DRAW
);
45 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
);
47 var attribLocation
= 1;
48 gl
.enableVertexAttribArray(attribLocation
);
49 gl
.vertexAttribPointer(attribLocation
, 1, gl
.FLOAT
, false, 0, 0);
53 setTimeout(function() {
54 // Wait for possible context loss
59 var successfullyParsed
= true;