Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance2 / buffers / buffer-overflow-test.html
blob9334ba5cb6cb2824d0d31df87927064e174642e9
1 <!--
2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
5 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>WebGL buffer overflow test for bindBufferRange</title>
12 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
13 <script src="../../js/js-test-pre.js"></script>
14 <script src="../../js/webgl-test-utils.js"></script>
15 </head>
16 <body>
17 <div id="description"></div>
18 <div id="console"></div>
19 <script>
20 "use strict";
21 description("WebGL buffer overflow test: buffer overflow will not lead to failure in bindBufferRange");
23 var wtu = WebGLTestUtils;
25 var gl = wtu.create3DContext(undefined, undefined, 2);
27 debug("");
28 var buffer1 = gl.createBuffer();
29 gl.bindBufferRange(gl.TRANSFORM_FEEDBACK_BUFFER, 0, buffer1, 0, 4);
30 wtu.glErrorShouldBe(gl, gl.NO_ERROR,
31 "Calling bindBufferRange on a buffer where no storage is allocated should succeed.");
32 shouldBe("buffer1", "gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_BINDING, 0)");
33 shouldBe("4", "gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_SIZE, 0)");
34 shouldBe("0", "gl.getIndexedParameter(gl.TRANSFORM_FEEDBACK_BUFFER_START, 0)");
36 var buffer2 = gl.createBuffer();
37 gl.bindBuffer(gl.UNIFORM_BUFFER, buffer2);
38 gl.bufferData(gl.UNIFORM_BUFFER, 4, gl.STATIC_DRAW);
39 gl.bindBufferRange(gl.UNIFORM_BUFFER, 1, buffer2, 0, 8);
40 wtu.glErrorShouldBe(gl, gl.NO_ERROR,
41 "Calling bindBufferRange on a buffer where the storage is not big enough should succeed.");
42 shouldBe("buffer2", "gl.getIndexedParameter(gl.UNIFORM_BUFFER_BINDING, 1)");
43 shouldBe("8", "gl.getIndexedParameter(gl.UNIFORM_BUFFER_SIZE, 1)");
44 shouldBe("0", "gl.getIndexedParameter(gl.UNIFORM_BUFFER_START, 1)");
46 debug("");
47 var successfullyParsed = true;
48 </script>
49 <script src="../../js/js-test-post.js"></script>
50 </body>
51 </html>