content/canvas/test/reftest/webgl-hanging-fb-test.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 <html class="reftest-wait">
michael@0 3 <head>
michael@0 4 <meta charset="UTF-8">
michael@0 5
michael@0 6 <script type="text/javascript" src="webgl-utils.js"></script>
michael@0 7 <script type="text/javascript">
michael@0 8 /* Hanging Framebuffer Test
michael@0 9 *
michael@0 10 * Clear the canvas to green, but create and bind a new framebuffer
michael@0 11 * before returning. This will fail if we blindly read from the bound
michael@0 12 * framebuffer, instead of binding to the screen and reading from that.
michael@0 13 *
michael@0 14 * How failure looks isn't well defined, since this is an empty framebuffer,
michael@0 15 * thus is incomplete, and should cause errors if it's read from.
michael@0 16 */
michael@0 17
michael@0 18 "use strict";
michael@0 19
michael@0 20 function renderGL(gl) {
michael@0 21 gl.clearColor(0.0, 1.0, 0.0, 1.0);
michael@0 22 gl.clear(gl.COLOR_BUFFER_BIT);
michael@0 23
michael@0 24 var fb = gl.createFramebuffer();
michael@0 25 gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
michael@0 26
michael@0 27 gl.finish();
michael@0 28 }
michael@0 29
michael@0 30 function renderFailure(canvas) {
michael@0 31 // This will also trigger RAF for us.
michael@0 32 var context = canvas.getContext("2d");
michael@0 33 context.fillText('WebGL failed.', 64, 64);
michael@0 34 }
michael@0 35
michael@0 36 function runTest() {
michael@0 37 var canvas = document.getElementById("canvas");
michael@0 38 var gl = initGL(canvas);
michael@0 39
michael@0 40 if (gl)
michael@0 41 renderGL(gl);
michael@0 42 else
michael@0 43 renderFailure(canvas);
michael@0 44
michael@0 45 waitForComposite(testComplete);
michael@0 46 }
michael@0 47
michael@0 48 function testComplete() {
michael@0 49 document.documentElement.removeAttribute("class");
michael@0 50 }
michael@0 51 </script>
michael@0 52 </head>
michael@0 53
michael@0 54 <body onload="rAF(runTest);">
michael@0 55 <canvas id="canvas" width="256" height="256"></canvas>
michael@0 56 </body>
michael@0 57
michael@0 58 </html>

mercurial