| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| <script src="resources/webgl-test.js"></script> |
| </head> |
| <body> |
| <div id="description"></div> |
| <div id="console"></div> |
| |
| <script> |
| description("Test of drawElements with out-of-bounds parameters using OES_element_index_uint"); |
| |
| if (window.internals) |
| window.internals.settings.setWebGLErrorsToConsoleEnabled(false); |
| |
| var context = create3DContext(); |
| var program = loadStandardProgram(context); |
| |
| context.useProgram(program); |
| context.getExtension("OES_element_index_uint"); |
| |
| var buffer = context.createBuffer(); |
| context.bindBuffer(context.ARRAY_BUFFER, buffer); |
| |
| var data = new Uint8Array(0x100); |
| context.bufferData(context.ARRAY_BUFFER, data, context.STATIC_DRAW); |
| |
| buffer = context.createBuffer(); |
| context.bindBuffer(context.ELEMENT_ARRAY_BUFFER, buffer); |
| |
| data = new Uint32Array(new ArrayBuffer(0x10)); |
| data[0] = 0xffffffff; |
| for (let i = 1; i < data.length; i++){ |
| data[i] = 1; |
| } |
| context.bufferData(context.ELEMENT_ARRAY_BUFFER, data, context.STATIC_DRAW); |
| |
| context.enableVertexAttribArray(0); |
| context.enableVertexAttribArray(1); |
| context.vertexAttribPointer(0, 1, context.UNSIGNED_BYTE, false, 0, 0); |
| context.vertexAttribPointer(1, 1, context.UNSIGNED_BYTE, false, 0, 0); |
| |
| shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.LINES, 1, context.UNSIGNED_INT, 0)"); |
| |
| data[0] = 0xfffffffd; |
| context.bufferData(context.ELEMENT_ARRAY_BUFFER, data, context.STATIC_DRAW); |
| |
| shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawElements(context.LINES, 1, context.UNSIGNED_INT, 0)"); |
| </script> |
| </body> |
| </html> |