Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / buffers / index-validation-verifies-too-many-indices.html
blob8ebbf4f32d55d3f664dd904ab2ce010dde18b2d2
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 does not examine too many indices');
23 var wtu = WebGLTestUtils;
24 var context = wtu.create3DContext();
25 var program = wtu.loadStandardProgram(context);
27 context.useProgram(program);
28 var vertexObject = context.createBuffer();
29 context.enableVertexAttribArray(0);
30 context.bindBuffer(context.ARRAY_BUFFER, vertexObject);
31 // 4 vertices -> 2 triangles
32 context.bufferData(context.ARRAY_BUFFER, new Float32Array([ 0,0,0, 0,1,0, 1,0,0, 1,1,0 ]), context.STATIC_DRAW);
33 context.vertexAttribPointer(0, 3, context.FLOAT, false, 0, 0);
35 var indexObject = context.createBuffer();
37 debug("Test out of range indices")
38 context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, indexObject);
39 context.bufferData(context.ELEMENT_ARRAY_BUFFER, new Uint16Array([ 10000, 0, 1, 2, 3, 10000 ]), context.STATIC_DRAW);
40 var indexValidationError = wtu.shouldGenerateGLError(context, [context.INVALID_OPERATION, context.NO_ERROR], "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)");
41 wtu.shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 2)");
42 wtu.shouldGenerateGLError(context, indexValidationError, "context.drawElements(context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)");
44 debug("")
45 var successfullyParsed = true;
46 </script>
48 <script src="../../js/js-test-post.js"></script>
49 </body>
50 </html>