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 <title>WebGL Default Texture Draw Bug Conformance Tests
</title>
11 <link rel=
"stylesheet" href=
"../../resources/js-test-style.css"/>
12 <script src=
"../../js/js-test-pre.js"></script>
13 <script src=
"../../js/webgl-test-utils.js"></script>
17 <canvas id=
"c"></canvas>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
22 description("This test attempts to provoke a Chrome bug that occured when drawing with textures when one was never bound. <a href='http://crbug.com/524144'>crbug.com/524144</a>");
26 var wtu
= WebGLTestUtils
;
27 var gl
= wtu
.create3DContext("c");
28 var canvas
= gl
.canvas
;
31 testFailed("WebGL context does not exist");
33 testPassed("WebGL context exists");
37 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
, "there should be no errors");
40 function runDrawTests(drawType
) {
41 debug("Test that drawing with a texture when no textures have been bound gives the expected black output");
42 canvas
.width
= 50; canvas
.height
= 50;
43 gl
.viewport(0, 0, canvas
.width
, canvas
.height
);
45 // Set up a program that will draw with a texture
46 var program
= wtu
.setupNoTexCoordTextureProgram(gl
);
48 wtu
.setupIndexedQuad(gl
);
49 for (var i
= 0 ; i
< 100 && _bufferedConsoleLogs
!= null; ++i
) {
51 gl
.clearColor(1.0, 1.0, 1.0, 1.0);
52 gl
.clear(gl
.COLOR_BUFFER_BIT
| gl
.DEPTH_BUFFER_BIT
);
54 // Draw without binding any textures.
55 gl
.drawElements(gl
.TRIANGLES
, 6, gl
.UNSIGNED_SHORT
, 0);
57 // Check to ensure the entire canvas is black.
58 wtu
.checkCanvasRect(gl
, 0.0, 0.0, canvas
.width
, canvas
.height
,
59 [0.0, 0.0, 0.0], "Draw should pass", 2);
64 var successfullyParsed
= true;
66 <script src=
"../../js/js-test-post.js"></script>