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 <title>Check that ANGLE_instanced_arrays state does not leak to browser
</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>
17 border:
1px solid black;
20 border:
1px solid black;
21 background-color: #
00ff00;
27 This test must be run manually.
29 This test tests that leaving state for ANGLE_instanced_arrays with non-default values at the
30 end of rendering does not interfere with proper compositing of results.
31 Failures seen on Linux and Mac with Chrome
32.
32 See http://crbug.com/
304927 for more info.
34 You should see a
<span class=
"correct">green rectangle
</span>
35 with black a outline on success. Briefly flashing red is normal.
37 <canvas id='c'
></canvas>
38 <div id=
"console"></div>
41 var wtu
= WebGLTestUtils
;
42 var c
= document
.getElementById("c");
43 // The bug has only been seen with preserveDrawingBuffer=true.
44 var gl
= wtu
.create3DContext(c
, { preserveDrawingBuffer
: true });
45 var ext
= wtu
.getExtensionWithKnownPrefixes(gl
, "ANGLE_instanced_arrays");
49 if (frame
< RED_FRAMES
) {
50 // Draw N frames red, leaving the vertex divisor to 0 after each call.
51 gl
.clearColor(1,0,0,1);
52 gl
.clear(gl
.COLOR_BUFFER_BIT
);
53 wtu
.requestAnimFrame(render
);
55 // Draw 2 more times in green, setting the divisor to 1 afterward.
56 gl
.clearColor(0,1,0,1);
57 gl
.clear(gl
.COLOR_BUFFER_BIT
);
58 if (frame
- RED_FRAMES
< 2) {
59 wtu
.requestAnimFrame(render
);
63 // Leave attrib 0 set with a divisor of 1 before returning to browser.
65 ext
.vertexAttribDivisorANGLE(0, 1);
72 testPassed("No ANGLE_instanced_arrays support -- this is legal");
74 wtu
.requestAnimFrame(render
);
75 var successfullyParsed
= true;