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 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>
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 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.
35 <canvas id='c1'
></canvas>
36 <canvas id='c2'
></canvas>
37 <div id=
"console"></div>
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");
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");