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.
10 <meta charset='utf-
8'
>
11 <title>WebGL gl calls Conformance Tests
</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>
17 <div id='description'
></div>
18 <div id='console'
></div>
19 <canvas id='canvas' width='
2' height='
2'
> </canvas>
22 description('Test implicit target assignment during FB attachment');
24 const wtu
= WebGLTestUtils
;
25 const gl
= wtu
.create3DContext('canvas');
30 testFailed('context does not exist');
34 fb
= gl
.createFramebuffer();
35 gl
.bindFramebuffer(gl
.FRAMEBUFFER
, fb
);
37 wtu
.glErrorShouldBe(gl
, 0, 'No errors');
42 debug('framebufferRenderbuffer');
44 rb
= gl
.createRenderbuffer();
45 shouldBe('gl.isRenderbuffer(rb)', 'false');
46 gl
.bindRenderbuffer(gl
.RENDERBUFFER
, rb
);
47 shouldBe('gl.isRenderbuffer(rb)', 'true');
49 rb
= gl
.createRenderbuffer();
50 shouldBe('gl.isRenderbuffer(rb)', 'false');
51 gl
.framebufferRenderbuffer(gl
.FRAMEBUFFER
, gl
.COLOR_ATTACHMENT0
, gl
.RENDERBUFFER
, rb
);
52 wtu
.glErrorShouldBe(gl
, gl
.INVALID_OPERATION
, 'framebufferRenderbuffer must be preceeded by some bindRenderbuffer');
53 shouldBe('gl.isRenderbuffer(rb)', 'false');
55 wtu
.glErrorShouldBe(gl
, 0, 'No errors');
60 debug('framebufferTexture2D');
62 tex
= gl
.createTexture();
63 shouldBe('gl.isTexture(tex)', 'false');
64 gl
.bindTexture(gl
.TEXTURE_2D
, tex
);
65 shouldBe('gl.isTexture(tex)', 'true');
67 tex
= gl
.createTexture();
68 shouldBe('gl.isTexture(tex)', 'false');
69 gl
.framebufferTexture2D(gl
.FRAMEBUFFER
, gl
.COLOR_ATTACHMENT0
, gl
.TEXTURE_2D
, tex
, 0);
70 // https://bugzilla.mozilla.org/show_bug.cgi?id=1636524 :
71 wtu
.glErrorShouldBe(gl
, gl
.INVALID_OPERATION
, 'framebufferTexture2D must be preceeded by some bindTexture');
72 shouldBe('gl.isTexture(tex)', 'false');
74 gl
.bindTexture(gl
.TEXTURE_CUBE_MAP
, tex
);
75 wtu
.glErrorShouldBe(gl
, 0, 'No errors after bindTexture');
77 tex
= gl
.createTexture();
78 shouldBe('gl.isTexture(tex)', 'false');
79 gl
.framebufferTexture2D(gl
.FRAMEBUFFER
, gl
.COLOR_ATTACHMENT0
, gl
.TEXTURE_CUBE_MAP_POSITIVE_X
, tex
, 0);
80 wtu
.glErrorShouldBe(gl
, gl
.INVALID_OPERATION
, 'framebufferTexture2D must be preceeded by some bindTexture');
81 shouldBe('gl.isTexture(tex)', 'false');
83 gl
.bindTexture(gl
.TEXTURE_2D
, tex
);
84 wtu
.glErrorShouldBe(gl
, 0, 'No errors after bindTexture');
88 var successfullyParsed
= true;
91 <script src='../../js/js-test-post.js'
></script>