Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / manual / canvas-no-clear-on-unsuccessful-draw.html
blobba104d077463e41668e63912995eb7cc526f63ee
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 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>Check that the canvas is NOT recomposited after unsucessful draw call</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 <style>
16 canvas {
17 border: 1px solid black;
19 .correct {
20 border: 1px solid black;
21 background-color: #00ff00;
23 </style>
24 </head>
25 <body>
26 <pre>
27 This test must be run manually.
29 This test tests that a canvas is NOT cleared
30 when a draw call fails.
32 You should see two <span class="correct">green rectangles</span>
33 with black outlines on success.
34 </pre>
35 <canvas id='c1'></canvas>
36 <canvas id='c2'></canvas>
37 <div id="console"></div>
38 <script>
39 "use strict";
40 var wtu = WebGLTestUtils;
41 var c1 = document.getElementById("c1");
42 var c2 = document.getElementById("c2");
43 var gl1 = wtu.create3DContext(c1);
44 var gl2 = wtu.create3DContext(c2);
45 gl1.clearColor(0,1,0,1);
46 gl1.clear(gl1.COLOR_BUFFER_BIT);
47 gl2.clearColor(0,1,0,1);
48 gl2.clear(gl2.COLOR_BUFFER_BIT);
49 wtu.waitForComposite(function() {
50 gl1.drawArrays(gl1.BLEND, 0, 0);
51 wtu.glErrorShouldBe(gl1, gl1.INVALID_ENUM, "no errors");
52 });
54 wtu.waitForComposite(function() {
55 var buf = gl2.createBuffer();
56 gl2.bindBuffer(gl2.ELEMENT_ARRAY_BUFFER, buf);
57 gl2.bufferData(gl2.ELEMENT_ARRAY_BUFFER, new Uint8Array(1), gl2.STATIC_DRAW);
58 gl2.drawElements(gl2.BLEND, 0, gl2.UNSIGNED_SHORT, 0);
59 wtu.glErrorShouldBe(gl2, gl2.INVALID_ENUM, "no errors");
60 });
61 </script>
62 </body>
63 </html>