Backed out changeset 8fc3326bce7f (bug 1943032) for causing failures at browser_tab_g...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / attribs / invalid-vertex-attribs.html
blob8f9f975001df487ec1ec8e7ef248e9e26503bf8c
1 <!--
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.
5 -->
6 <!DOCTYPE html>
7 <html>
8 <head>
9 <meta charset="utf-8">
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>
15 <style>
16 body {
17 height: 3000px;
19 </style>
20 </head>
21 <body>
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>
27 <script>
28 "use strict";
30 description(`\
31 This test ensures WebGL implementations correctly generate INVALID_OPERATION
32 when an attribute is enabled but no buffer is bound`);
33 debug("");
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);
66 finishTest();
68 runInvalidAttribTests();
70 var successfullyParsed = true;
71 </script>
72 </body>
73 </html>