Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / webgl / src / sdk / tests / conformance / manual / angle-instanced-arrays-state-leakage.html
1 <!--
2
3 /*
4 ** Copyright (c) 2013 The Khronos Group Inc.
5 **
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:
13 **
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
16 **
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.
24 */
25
26 -->
27
28 <!DOCTYPE html>
29 <html>
30 <head>
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>
36 <style>
37 canvas {
38     border: 1px solid black;
39 }
40 .correct {
41     border: 1px solid black;
42     background-color: #00ff00;
43 }
44 </style>
45 </head>
46 <body>
47 <pre>
48 This test must be run manually.
49
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.
54
55 You should see a <span class="correct">green rectangle</span>
56 with black a outline on success.  Briefly flashing red is normal.
57 </pre>
58 <canvas id='c'></canvas>
59 <div id="console"></div>
60 <script>
61 "use strict";
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");
67 var frame = 0;
68 function render() {
69   var RED_FRAMES = 3;
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);
75   } else {
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);
81     } else {
82       finishTest();
83     }
84     // Leave attrib 0 set with a divisor of 1 before returning to browser.
85     if (ext) {
86        ext.vertexAttribDivisorANGLE(0, 1);
87     }
88   }
89   frame++;
90 }
91
92 if (!ext) {
93   testPassed("No ANGLE_instanced_arrays support -- this is legal");
94 }
95 wtu.requestAnimFrame(render);
96 var successfullyParsed = true;
97 </script>
98 </body>
99 </html>