2 Copyright (c) 2022 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>WebGL2 draw functions have expected behavior with invalid vertex attribs
</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>
14 <script src=
"../../js/tests/invalid-vertex-attrib-test.js"></script>
22 <!-- Important to put the canvas at the top so that it's always visible even in the test suite runner.
23 Otherwise it just doesn't get composited in Firefox. -->
24 <div id=
"description"></div>
25 <canvas id=
"canvas" width=
"16" height=
"16"> </canvas>
26 <div id=
"console"></div>
31 This test ensures WebGL implementations correctly generate INVALID_OPERATION
32 when an attribute is enabled but no buffer is bound`);
35 const wtu
= WebGLTestUtils
;
36 const gl
= wtu
.create3DContext('canvas', undefined, 2);
38 async
function runInvalidAttribTests() {
39 const invalidAttribTestFn
= createInvalidAttribTestFn(gl
);
41 function drawArrays(gl
) {
42 gl
.drawArrays(gl
.TRIANGLES
, 0, 6);
45 function drawElements(gl
) {
46 gl
.drawElements(gl
.TRIANGLES
, 6, gl
.UNSIGNED_BYTE
, 0);
49 function drawArraysInstanced(gl
) {
50 gl
.drawArraysInstanced(gl
.TRIANGLES
, 0, 6, 1);
53 function drawElementsInstanced(gl
) {
54 gl
.drawElementsInstanced(gl
.TRIANGLES
, 6, gl
.UNSIGNED_BYTE
, 0, 1);
57 function drawRangeElements(gl
) {
58 gl
.drawRangeElements(gl
.TRIANGLES
, 0, 5, 6, gl
.UNSIGNED_BYTE
, 0);
61 await
invalidAttribTestFn(drawArrays
);
62 await
invalidAttribTestFn(drawElements
);
63 await
invalidAttribTestFn(drawArraysInstanced
);
64 await
invalidAttribTestFn(drawElementsInstanced
);
65 await
invalidAttribTestFn(drawRangeElements
);
68 runInvalidAttribTests();
70 var successfullyParsed
= true;