Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <title>WebGL test: bug 958491</title> |
michael@0 | 3 | <script src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 4 | <link rel="stylesheet" href="/tests/SimpleTest/test.css"> |
michael@0 | 5 | <script src="driver-info.js"></script> |
michael@0 | 6 | <script src="webgl-util.js"></script> |
michael@0 | 7 | <body> |
michael@0 | 8 | <canvas id="c"></canvas> |
michael@0 | 9 | <script> |
michael@0 | 10 | |
michael@0 | 11 | // Give ourselves a scope to return early from: |
michael@0 | 12 | (function() { |
michael@0 | 13 | var gl = WebGLUtil.getWebGL('c'); |
michael@0 | 14 | if (!gl) { |
michael@0 | 15 | todo(false, 'WebGL is unavailable.'); |
michael@0 | 16 | return; |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | // Catch actual WebGLUtil errors, not GL errors. |
michael@0 | 20 | function errorFunc(str) { |
michael@0 | 21 | ok(false, 'Error: ' + str); |
michael@0 | 22 | } |
michael@0 | 23 | WebGLUtil.setErrorFunc(errorFunc); |
michael@0 | 24 | |
michael@0 | 25 | function checkGLError(func, info, reference) { |
michael@0 | 26 | var error = gl.getError(); |
michael@0 | 27 | var prefix = info ? ('[' + info + '] ') : ''; |
michael@0 | 28 | var text = 'gl.getError should be 0x' + reference.toString(16) + |
michael@0 | 29 | ', was 0x' + error.toString(16) + '.'; |
michael@0 | 30 | func(error == reference, prefix + text); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | // Begin test: |
michael@0 | 34 | var rb = gl.createRenderbuffer(); |
michael@0 | 35 | gl.bindRenderbuffer(gl.RENDERBUFFER, rb); |
michael@0 | 36 | gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 4, 4); |
michael@0 | 37 | |
michael@0 | 38 | var fb = gl.createFramebuffer(); |
michael@0 | 39 | gl.bindFramebuffer(gl.FRAMEBUFFER, fb); |
michael@0 | 40 | gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, |
michael@0 | 41 | gl.RENDERBUFFER, rb); |
michael@0 | 42 | |
michael@0 | 43 | checkGLError(ok, 'before bad param query', 0); |
michael@0 | 44 | |
michael@0 | 45 | var GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; |
michael@0 | 46 | var result = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, |
michael@0 | 47 | gl.COLOR_ATTACHMENT0, |
michael@0 | 48 | GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING); |
michael@0 | 49 | |
michael@0 | 50 | checkGLError(ok, 'after bad param query', gl.INVALID_ENUM); |
michael@0 | 51 | })(); |
michael@0 | 52 | |
michael@0 | 53 | </script> |
michael@0 | 54 |