OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright (c) 2010 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 <html> | |
7 <head> | |
8 <link rel="stylesheet" href="../resources/js-test-style.css"/> | |
9 <script src="../resources/js-test-pre.js"></script> | |
10 <script src="resources/webgl-test.js"></script> | |
11 </head> | |
12 <body> | |
13 <div id="description"></div> | |
14 <div id="console"></div> | |
15 | |
16 <script> | |
17 description("Test bufferData/bufferSubData with ArrayBuffer input"); | |
18 | |
19 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>'); | |
20 | |
21 var gl = create3DContext(); | |
22 shouldBeNonNull("gl"); | |
23 | |
24 var array = new ArrayBuffer(128); | |
25 shouldBeNonNull("array"); | |
26 | |
27 var buf = gl.createBuffer(); | |
28 shouldBeNonNull(buf); | |
29 | |
30 gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW); | |
31 glErrorShouldBe(gl, gl.INVALID_OPERATION); | |
32 | |
33 gl.bindBuffer(gl.ARRAY_BUFFER, buf); | |
34 glErrorShouldBe(gl, gl.NO_ERROR); | |
35 | |
36 gl.bufferData(gl.ARRAY_BUFFER, -10, gl.STATIC_DRAW); | |
37 glErrorShouldBe(gl, gl.INVALID_VALUE); | |
38 | |
39 // This should not crash, but the selection of the overload is ambiguous per Web
IDL. | |
40 gl.bufferData(gl.ARRAY_BUFFER, null, gl.STATIC_DRAW); | |
41 gl.getError(); | |
42 | |
43 gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW); | |
44 glErrorShouldBe(gl, gl.NO_ERROR); | |
45 | |
46 array = new ArrayBuffer(64); | |
47 | |
48 gl.bufferSubData(gl.ARRAY_BUFFER, -10, array); | |
49 glErrorShouldBe(gl, gl.INVALID_VALUE); | |
50 | |
51 gl.bufferSubData(gl.ARRAY_BUFFER, -10, new Float32Array(8)); | |
52 glErrorShouldBe(gl, gl.INVALID_VALUE); | |
53 | |
54 gl.bufferSubData(gl.ARRAY_BUFFER, 10, array); | |
55 glErrorShouldBe(gl, gl.NO_ERROR); | |
56 | |
57 gl.bufferSubData(gl.ARRAY_BUFFER, 10, null); | |
58 glErrorShouldBe(gl, gl.NO_ERROR); | |
59 | |
60 successfullyParsed = true; | |
61 </script> | |
62 | |
63 <script src="../resources/js-test-post.js"></script> | |
64 </body> | |
65 </html> | |
OLD | NEW |