| <!DOCTYPE html> |
| <html> |
| <body> |
| <p>PASS if no crash.</p> |
| <canvas id="canvas" width="1" height="1"></canvas> |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| const canvas = document.getElementById('canvas'); |
| const gl = canvas.getContext('webgl2'); |
| |
| const vs = gl.createShader(gl.VERTEX_SHADER); |
| gl.shaderSource(vs, `#version 300 es\nvoid main() {}`); |
| gl.compileShader(vs); |
| |
| const fs = gl.createShader(gl.FRAGMENT_SHADER); |
| gl.shaderSource(fs, `#version 300 es\nprecision mediump float;\nout vec4 c;\nvoid main() { c = vec4(0); }`); |
| gl.compileShader(fs); |
| |
| const program = gl.createProgram(); |
| gl.attachShader(program, vs); |
| gl.attachShader(program, fs); |
| gl.linkProgram(program); |
| gl.useProgram(program); |
| |
| // 53 bytes is intentionally not a multiple of 4 (sizeof UNSIGNED_INT). |
| // drawElements with UNSIGNED_INT must not crash when processing the buffer |
| // for primitive restart index ranges. |
| const ibo = gl.createBuffer(); |
| gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ibo); |
| gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, 53, gl.STATIC_DRAW); |
| gl.drawElements(gl.POINTS, 3, gl.UNSIGNED_INT, 4); |
| gl.finish(); |
| |
| setTimeout(() => { |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| }, 300); |
| </script> |
| </body> |
| </html> |