2 <title>WebGL test: bug
958491</title>
3 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
4 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
5 <script src=
"driver-info.js"></script>
7 <canvas id=
"c"></canvas>
10 // Give ourselves a scope to return early from:
12 var gl
= c
.getContext('webgl');
14 todo(false, 'WebGL is unavailable.');
18 function checkGLError(func
, info
, reference
) {
19 var error
= gl
.getError();
20 var prefix
= info
? ('[' + info
+ '] ') : '';
21 var text
= 'gl.getError should be 0x' + reference
.toString(16) +
22 ', was 0x' + error
.toString(16) + '.';
23 func(error
== reference
, prefix
+ text
);
27 var rb
= gl
.createRenderbuffer();
28 gl
.bindRenderbuffer(gl
.RENDERBUFFER
, rb
);
29 gl
.renderbufferStorage(gl
.RENDERBUFFER
, gl
.RGBA4
, 4, 4);
31 var fb
= gl
.createFramebuffer();
32 gl
.bindFramebuffer(gl
.FRAMEBUFFER
, fb
);
33 gl
.framebufferRenderbuffer(gl
.FRAMEBUFFER
, gl
.COLOR_ATTACHMENT0
,
36 checkGLError(ok
, 'before bad param query', 0);
38 var GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
= 0x8210;
39 var result
= gl
.getFramebufferAttachmentParameter(gl
.FRAMEBUFFER
,
41 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
);
43 checkGLError(ok
, 'after bad param query', gl
.INVALID_ENUM
);