4 ** Copyright (c) 2013 The Khronos Group Inc.
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
31 <meta charset="utf-8">
32 <title>Check that ANGLE_instanced_arrays state does not leak to browser</title>
33 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
34 <script src="../../resources/js-test-pre.js"></script>
35 <script src="../resources/webgl-test-utils.js"></script>
38 border: 1px solid black;
41 border: 1px solid black;
42 background-color: #00ff00;
48 This test must be run manually.
50 This test tests that leaving state for ANGLE_instanced_arrays with non-default values at the
51 end of rendering does not interfere with proper compositing of results.
52 Failures seen on Linux and Mac with Chrome 32.
53 See http://crbug.com/304927 for more info.
55 You should see a <span class="correct">green rectangle</span>
56 with black a outline on success. Briefly flashing red is normal.
58 <canvas id='c'></canvas>
59 <div id="console"></div>
62 var wtu = WebGLTestUtils;
63 var c = document.getElementById("c");
64 // The bug has only been seen with preserveDrawingBuffer=true.
65 var gl = wtu.create3DContext(c, { preserveDrawingBuffer: true });
66 var ext = wtu.getExtensionWithKnownPrefixes(gl, "ANGLE_instanced_arrays");
70 if (frame < RED_FRAMES) {
71 // Draw N frames red, leaving the vertex divisor to 0 after each call.
72 gl.clearColor(1,0,0,1);
73 gl.clear(gl.COLOR_BUFFER_BIT);
74 wtu.requestAnimFrame(render);
76 // Draw 2 more times in green, setting the divisor to 1 afterward.
77 gl.clearColor(0,1,0,1);
78 gl.clear(gl.COLOR_BUFFER_BIT);
79 if (frame - RED_FRAMES < 2) {
80 wtu.requestAnimFrame(render);
84 // Leave attrib 0 set with a divisor of 1 before returning to browser.
86 ext.vertexAttribDivisorANGLE(0, 1);
93 testPassed("No ANGLE_instanced_arrays support -- this is legal");
95 wtu.requestAnimFrame(render);
96 var successfullyParsed = true;