Backed out changeset 8fc3326bce7f (bug 1943032) for causing failures at browser_tab_g...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / buffers / index-validation-large-buffer.html
bloba0427039a0c2ce2c47f7153edaa1a85eaf763067
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 <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 </head>
15 <body>
16 <div id="description"></div>
17 <div id="console"></div>
19 <script>
20 "use strict";
21 description('Tests that index validation for drawElements works with large attribute buffers');
23 var wtu = WebGLTestUtils;
24 var context = wtu.create3DContext();
25 var program = wtu.loadStandardProgram(context);
27 context.useProgram(program);
29 // Create a small index buffer.
30 var indexObject = context.createBuffer();
31 context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, indexObject);
32 var indexArray = new Uint16Array([0, 1, 2]);
33 context.bufferData(context.ELEMENT_ARRAY_BUFFER, indexArray, context.STATIC_DRAW);
35 // Create a large attribute buffer.
36 var vertexObject = context.createBuffer();
37 context.enableVertexAttribArray(0);
38 context.bindBuffer(context.ARRAY_BUFFER, vertexObject);
39 context.bufferData(context.ARRAY_BUFFER, new Float32Array(3 * 65536), context.STATIC_DRAW);
40 context.vertexAttribPointer(0, 3, context.FLOAT, false, 0, 0);
42 debug("Test large attribute buffer")
43 wtu.shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLES, 3, context.UNSIGNED_SHORT, 0)");
45 // Enlarge the attribute buffer slightly.
46 debug("Test even larger attribute buffer")
47 context.bufferData(context.ARRAY_BUFFER, new Float32Array(3 * 65536 + 3), context.STATIC_DRAW);
48 wtu.shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLES, 3, context.UNSIGNED_SHORT, 0)");
50 debug("")
51 var successfullyParsed = true;
52 </script>
54 <script src="../../js/js-test-post.js"></script>
55 </body>
56 </html>