OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. |
| 5 --> |
| 6 <!DOCTYPE html> |
| 7 <html> |
| 8 <head> |
| 9 <meta charset="utf-8"> |
| 10 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
| 11 <script src="../../resources/js-test-pre.js"></script> |
| 12 <script src="../resources/webgl-test.js"></script> |
| 13 </head> |
| 14 <body> |
| 15 <div id="description"></div> |
| 16 <div id="console"></div> |
| 17 |
| 18 <script> |
| 19 description('Tests that index validation for drawElements does not examine too m
any indices'); |
| 20 |
| 21 var context = create3DContext(); |
| 22 var program = loadStandardProgram(context); |
| 23 |
| 24 context.useProgram(program); |
| 25 var vertexObject = context.createBuffer(); |
| 26 context.enableVertexAttribArray(0); |
| 27 context.bindBuffer(context.ARRAY_BUFFER, vertexObject); |
| 28 // 4 vertices -> 2 triangles |
| 29 context.bufferData(context.ARRAY_BUFFER, new Float32Array([ 0,0,0, 0,1,0, 1,0,0,
1,1,0 ]), context.STATIC_DRAW); |
| 30 context.vertexAttribPointer(0, 3, context.FLOAT, false, 0, 0); |
| 31 |
| 32 var indexObject = context.createBuffer(); |
| 33 |
| 34 debug("Test out of range indices") |
| 35 context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, indexObject); |
| 36 context.bufferData(context.ELEMENT_ARRAY_BUFFER, new Uint16Array([ 10000, 0, 1,
2, 3, 10000 ]), context.STATIC_DRAW); |
| 37 shouldGenerateGLError(context, context.NO_ERROR, "context.drawElements(context.T
RIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 2)"); |
| 38 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(
context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 0)"); |
| 39 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(
context.TRIANGLE_STRIP, 4, context.UNSIGNED_SHORT, 4)"); |
| 40 |
| 41 debug("") |
| 42 successfullyParsed = true; |
| 43 </script> |
| 44 |
| 45 <script src="../../resources/js-test-post.js"></script> |
| 46 </body> |
| 47 </html> |
OLD | NEW |