Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / state / fb-attach-implicit-target-assignment.html
blob1247c1f85693b5859c6f502afaa15212f454ea19
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 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>
15 </head>
16 <body>
17 <div id='description'></div>
18 <div id='console'></div>
19 <canvas id='canvas' width='2' height='2'> </canvas>
20 <script>
21 'use strict';
22 description('Test implicit target assignment during FB attachment');
24 const wtu = WebGLTestUtils;
25 const gl = wtu.create3DContext('canvas');
26 let fb, rb, tex;
28 (() => {
29 if (!gl) {
30 testFailed('context does not exist');
31 return;
34 fb = gl.createFramebuffer();
35 gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
37 wtu.glErrorShouldBe(gl, 0, 'No errors');
39 // -
41 debug('');
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');
57 // -
59 debug('');
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');
85 })();
87 debug('');
88 var successfullyParsed = true;
90 </script>
91 <script src='../../js/js-test-post.js'></script>
93 </body>
94 </html>