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("Test bufferData/bufferSubData with ArrayBuffer input"); |
| 20 |
| 21 debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=4188
4">https://bugs.webkit.org/show_bug.cgi?id=41884</a> : <code>Implement bufferDat
a and bufferSubData with ArrayBuffer as input</code>'); |
| 22 |
| 23 var gl = create3DContext(); |
| 24 shouldBeNonNull("gl"); |
| 25 |
| 26 var array = new ArrayBuffer(128); |
| 27 shouldBeNonNull("array"); |
| 28 |
| 29 var buf = gl.createBuffer(); |
| 30 shouldBeNonNull(buf); |
| 31 |
| 32 gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW); |
| 33 glErrorShouldBe(gl, gl.INVALID_OPERATION); |
| 34 |
| 35 gl.bindBuffer(gl.ARRAY_BUFFER, buf); |
| 36 glErrorShouldBe(gl, gl.NO_ERROR); |
| 37 |
| 38 gl.bufferData(gl.ARRAY_BUFFER, -10, gl.STATIC_DRAW); |
| 39 glErrorShouldBe(gl, gl.INVALID_VALUE); |
| 40 |
| 41 // This should not crash, but the selection of the overload is ambiguous per Web
IDL. |
| 42 gl.bufferData(gl.ARRAY_BUFFER, null, gl.STATIC_DRAW); |
| 43 gl.getError(); |
| 44 |
| 45 gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW); |
| 46 glErrorShouldBe(gl, gl.NO_ERROR); |
| 47 |
| 48 array = new ArrayBuffer(64); |
| 49 |
| 50 gl.bufferSubData(gl.ARRAY_BUFFER, -10, array); |
| 51 glErrorShouldBe(gl, gl.INVALID_VALUE); |
| 52 |
| 53 gl.bufferSubData(gl.ARRAY_BUFFER, -10, new Float32Array(8)); |
| 54 glErrorShouldBe(gl, gl.INVALID_VALUE); |
| 55 |
| 56 gl.bufferSubData(gl.ARRAY_BUFFER, 10, array); |
| 57 glErrorShouldBe(gl, gl.NO_ERROR); |
| 58 |
| 59 gl.bufferSubData(gl.ARRAY_BUFFER, 10, null); |
| 60 glErrorShouldBe(gl, gl.NO_ERROR); |
| 61 |
| 62 successfullyParsed = true; |
| 63 </script> |
| 64 |
| 65 <script src="../../resources/js-test-post.js"></script> |
| 66 </body> |
| 67 </html> |
OLD | NEW |