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.
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>WebGL test: Check for error on ReadPixels from a depth-only FB.</title>
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
7 <script src="webgl-util.js"></script>
8 <script src="driver-info.js"></script>
9 </head>
10 <body>
11 <canvas id="c"></canvas>
12 <script>
13 "use strict";
15 (function() {
16 var gl = WebGLUtil.getWebGL('c');
17 if (!gl) {
18 todo(gl, 'Get GL working here first.');
19 return;
20 }
22 var rb = gl.createRenderbuffer();
23 gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
24 gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, 4, 4);
26 var fb = gl.createFramebuffer();
27 gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
28 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT,
29 gl.RENDERBUFFER, rb);
31 if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) != gl.FRAMEBUFFER_COMPLETE) {
32 todo(false, 'Depth-only FB incomplete. This is valid.');
33 return;
34 }
36 ok(!gl.getError(), 'Should have no errors after constructing FB.');
38 var pixels = new Uint8Array([1, 2, 3, 4]);
39 gl.readPixels(0, 0, // x,y
40 1, 1, // w,h
41 gl.RGBA, gl.UNSIGNED_BYTE, pixels);
43 ok(gl.getError() == gl.INVALID_OPERATION,
44 '1x1 color read from a depth FB should generated INVALID_OP.');
45 console.log('Data after 1x1 color-from-depth readpixels:');
46 console.log(pixels);
48 gl.readPixels(0, 0, // x,y
49 0, 0, // w,h
50 gl.RGBA, gl.UNSIGNED_BYTE, pixels);
52 ok(gl.getError() == gl.INVALID_OPERATION,
53 '0x0 color read from a depth FB should generated INVALID_OP.');
54 })();
56 ok(true, 'Test complete.');
58 </script>
59 </body>
60 </html>