author | Phil Ringnalda <philringnalda@gmail.com> |
Tue, 28 Oct 2014 23:07:38 -0700 | |
changeset 212826 | 3a8b152acd9c569a66b7f44fc12f0162b2c867e0 |
parent 212825 | 162d085b801959d019e45c64cb237d3b17b67da7 |
child 212827 | 0d31658c4caa87de624513d94317879bee8d36f9 |
push id | 27730 |
push user | cbook@mozilla.com |
push date | Wed, 29 Oct 2014 12:26:03 +0000 |
treeherder | mozilla-central@fe5c1cb8075a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1087560 |
milestone | 36.0a1 |
backs out | ed403e9595061d360880b465e6b0d0413ae53136 64c7041ab5819811e91cec9873c78f02b719a678 4f040d3522a451aed00ce3a420ef8e62e378719b |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/canvas/test/webgl-mochitest.ini +++ b/dom/canvas/test/webgl-mochitest.ini @@ -1,21 +1,19 @@ [DEFAULT] -skip-if = ((os == 'linux') && (buildapp == 'b2g')) - support-files = webgl-mochitest/driver-info.js webgl-mochitest/webgl-util.js -[webgl-mochitest/test_backbuffer_channels.html] +[webgl-mochitest/test-backbuffer-channels.html] +[webgl-mochitest/test-hidden-alpha.html] [webgl-mochitest/test_depth_readpixels.html] [webgl-mochitest/test_draw.html] [webgl-mochitest/test_fb_param.html] [webgl-mochitest/test_fb_param_crash.html] -[webgl-mochitest/test_hidden_alpha.html] [webgl-mochitest/test_highp_fs.html] [webgl-mochitest/test_no_arr_points.html] [webgl-mochitest/test_noprog_draw.html] [webgl-mochitest/test_privileged_exts.html] [webgl-mochitest/test_texsubimage_float.html] [webgl-mochitest/test_webgl_available.html] skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests [webgl-mochitest/test_webgl_conformance.html]
--- a/dom/canvas/test/webgl-mochitest/mochi-to-testcase.py +++ b/dom/canvas/test/webgl-mochitest/mochi-to-testcase.py @@ -43,21 +43,16 @@ function ok(val, text) { debug(status + text); } function todo(val, text) { var status = val ? 'Test <font color=\\'orange\\'>UNEXPECTED PASS</font>: ' : 'Test <font color=\\'blue\\' >todo</font>: '; debug(status + text); } - -SimpleTest = { - waitForExplicitFinish: function() {}, - finish: function() {}, -}; </script> <div id='mochi-to-testcase-output'></div> \n''' fin = open(mochiPath, 'rb') fout = open(testPath, 'wb') includePattern = re.compile('<script\\s*src=[\'"](.*)\\.js[\'"]>\\s*</script>') cssPattern = re.compile('<link\\s*rel=[\'"]stylesheet[\'"]\\s*href=[\'"]([^=>]*)[\'"]>')
new file mode 100644 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/test-backbuffer-channels.html @@ -0,0 +1,111 @@ +<!DOCTYPE HTML> +<title>WebGL test: bug 958723</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<link rel="stylesheet" href="/tests/SimpleTest/test.css"> +<script src="driver-info.js"></script> +<script src="webgl-util.js"></script> +<body> +<script> + +function TestAttribs(attribs) { + debug('Testing attribs: ' + JSON.stringify(attribs)); + var canvas = document.createElement('canvas'); + var gl = canvas.getContext('experimental-webgl', attribs); + ok(gl, 'No tested attribs should result in failure to create a context'); + if (!gl) + return; + + var actual = gl.getContextAttributes(); + + ok(actual.alpha == attribs.alpha, + 'Resulting `alpha` should match request.'); + ok(actual.premultipliedAlpha == attribs.premultipliedAlpha, + 'Resulting `premultipliedAlpha` should match request.'); + ok(actual.preserveDrawingBuffer == attribs.preserveDrawingBuffer, + 'Resulting `preserveDrawingBuffer` should match request.'); + + // "The depth, stencil and antialias attributes, when set to true, are + // requests, not requirements." + if (!attribs.antialias) { + ok(!actual.antialias, 'No `antialias` if not requested.'); + } + if (!attribs.depth) { + ok(!actual.depth, 'No `depth` if not requested.'); + } + if (!attribs.stencil) { + ok(!actual.stencil, 'No `stencil` if not requested.'); + } + + var hasAlpha = !!gl.getParameter(gl.ALPHA_BITS); + var hasDepth = !!gl.getParameter(gl.DEPTH_BITS); + var hasStencil = !!gl.getParameter(gl.STENCIL_BITS); + var hasAntialias = !!gl.getParameter(gl.SAMPLES); + + ok(hasAlpha == actual.alpha, 'Bits should match `alpha` attrib.'); + ok(hasAntialias == actual.antialias, 'Bits should match `antialias` attrib.'); + ok(hasDepth == actual.depth, 'Bits should match `depth` attrib.'); + ok(hasStencil == actual.stencil, 'Bits should match `stencil` attrib.'); +} + +function CloneAttribs(attribs) { + return { + alpha: attribs.alpha, + antialias: attribs.antialias, + depth: attribs.depth, + premultipliedAlpha: attribs.premultipliedAlpha, + preserveDrawingBuffer: attribs.preserveDrawingBuffer, + stencil: attribs.stencil, + }; +} + +function SplitForAttrib(list, attrib) { + var ret = []; + + for (var i in list) { + var cur = list[i]; + if (cur[attrib]) + throw 'Attrib is already true.'; + + var clone = CloneAttribs(cur); + clone[attrib] = true; + + ret.push(cur); + ret.push(clone); + } + + return ret; +} + +function GenAttribList() { + var base = { + alpha: false, + antialias: false, + depth: false, + premultipliedAlpha: false, + preserveDrawingBuffer: false, + stencil: false, + }; + var list = [base]; + list = SplitForAttrib(list, 'alpha'); + list = SplitForAttrib(list, 'antialias'); + list = SplitForAttrib(list, 'depth'); + list = SplitForAttrib(list, 'premultipliedAlpha'); + list = SplitForAttrib(list, 'preserveDrawingBuffer'); + list = SplitForAttrib(list, 'stencil'); + + if (list.length != 1<<6) + throw 'Attribs list length wrong: ' + list.length; + + return list; +} + +var list = GenAttribList(); +for (var i in list) { + var attribs = list[i]; + TestAttribs(attribs); +} + +ok(true, 'Test complete.'); + +</script> +
new file mode 100644 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/test-hidden-alpha.html @@ -0,0 +1,153 @@ +<!DOCTYPE HTML> +<title>WebGL test: Hidden alpha on no-alpha contexts</title> +<script src='/tests/SimpleTest/SimpleTest.js'></script> +<link rel='stylesheet' href='/tests/SimpleTest/test.css'> +<script src='driver-info.js'></script> +<script src='webgl-util.js'></script> +<body> +<script id='vs' type='x-shader/x-vertex'> + attribute vec2 aPosCoord; + + void main(void) { + gl_Position = vec4(aPosCoord, 0.0, 1.0); + } +</script> + +<script id='fs' type='x-shader/x-fragment'> + precision mediump float; + + void main(void) { + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); + } +</script> +<canvas id='canvas' style='border: none;' width='100' height='100'></canvas> +<script> + +var posCoords_arr = new Float32Array(2 * 4); +var posCoords_buff = null; +function DrawQuad(gl, prog, x0, y0, x1, y1) { + gl.useProgram(prog); + + if (!posCoords_buff) { + posCoords_buff = gl.createBuffer(); + } + gl.bindBuffer(gl.ARRAY_BUFFER, posCoords_buff); + posCoords_arr[0] = x0; + posCoords_arr[1] = y0; + + posCoords_arr[2] = x1; + posCoords_arr[3] = y0; + + posCoords_arr[4] = x0; + posCoords_arr[5] = y1; + + posCoords_arr[6] = x1; + posCoords_arr[7] = y1; + gl.bufferData(gl.ARRAY_BUFFER, posCoords_arr, gl.STREAM_DRAW); + + gl.enableVertexAttribArray(prog.aPosCoord); + gl.vertexAttribPointer(prog.aPosCoord, 2, gl.FLOAT, false, 0, 0); + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); +} + +function DrawSquare(gl, prog, size) { + DrawQuad(gl, prog, -size, -size, size, size); +} + +function Reset(gl) { + gl.canvas.width += 1; + gl.canvas.width -= 1; +} + +function ReadCenterPixel(gl) { + var w = gl.drawingbufferWidth; + var h = gl.drawingbufferHeight; + var ret = new Uint8Array(4); + gl.readPixels(w/2, h/2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, ret); + return ret; +} + +function Test(gl, prog) { + gl.enable(gl.BLEND); + gl.blendFunc(gl.ZERO, gl.DST_ALPHA); + + var iColor = 64; + var fColor = iColor / 255.0; + + ////////////////// + + debug('clear(R,G,B,0)'); + + Reset(gl); + + gl.clearColor(fColor, fColor, fColor, 0.0); + gl.clear(gl.COLOR_BUFFER_BIT); + + var dataURL_pre = gl.canvas.toDataURL(); + //console.log('Before blending: ' + dataURL_pre); + + DrawSquare(gl, prog, 0.7); + + var pixel = ReadCenterPixel(gl); + ok(pixel[0] == iColor && + pixel[1] == iColor && + pixel[2] == iColor, 'Color should be the same.'); + ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.'); + + var dataURL_post = gl.canvas.toDataURL(); + //console.log('After blending: ' + dataURL_post); + ok(dataURL_post == dataURL_pre, + 'toDataURL should be unchanged after blending.'); + + ////////////////// + + debug('mask(R,G,B,0), clear(R,G,B,1)'); + + Reset(gl); + + gl.colorMask(true, true, true, false); + gl.clearColor(fColor, fColor, fColor, 1.0); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.colorMask(true, true, true, true); + + dataURL_pre = gl.canvas.toDataURL(); + //console.log('Before blending: ' + dataURL_pre); + + DrawSquare(gl, prog, 0.7); + + var pixel = ReadCenterPixel(gl); + ok(pixel[0] == iColor && + pixel[1] == iColor && + pixel[2] == iColor, 'Color should be the same.'); + ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.'); + ok(gl.getError() == 0, 'Should have no errors.'); + + dataURL_post = gl.canvas.toDataURL(); + //console.log('After blending: ' + dataURL_post); + ok(dataURL_post == dataURL_pre, + 'toDataURL should be unchanged after blending.'); + + ok(true, 'Test complete.'); +} + +(function(){ + var canvas = document.getElementById('canvas'); + var attribs = { + alpha: false, + antialias: false, + premultipliedAlpha: false, + }; + var gl = canvas.getContext('experimental-webgl', attribs); + ok(gl, 'WebGL should work.'); + ok(gl.getParameter(gl.ALPHA_BITS) == 0, 'Shouldn\'t have alpha bits.'); + + var prog = WebGLUtil.createProgramByIds(gl, 'vs', 'fs'); + ok(prog, 'Program should link.'); + prog.aPosCoord = gl.getAttribLocation(prog, 'aPosCoord'); + + setTimeout(function(){ Test(gl, prog); }, 500); +})(); + +</script> +</body>
deleted file mode 100644 --- a/dom/canvas/test/webgl-mochitest/test_backbuffer_channels.html +++ /dev/null @@ -1,111 +0,0 @@ -<!DOCTYPE HTML> -<title>WebGL test: bug 958723</title> -<script src="/tests/SimpleTest/SimpleTest.js"></script> -<link rel="stylesheet" href="/tests/SimpleTest/test.css"> -<script src="driver-info.js"></script> -<script src="webgl-util.js"></script> -<body> -<script> - -function TestAttribs(attribs) { - ok(true, 'Testing attribs: ' + JSON.stringify(attribs)); - var canvas = document.createElement('canvas'); - var gl = canvas.getContext('experimental-webgl', attribs); - ok(gl, 'No tested attribs should result in failure to create a context'); - if (!gl) - return; - - var actual = gl.getContextAttributes(); - - ok(actual.alpha == attribs.alpha, - 'Resulting `alpha` should match request.'); - ok(actual.premultipliedAlpha == attribs.premultipliedAlpha, - 'Resulting `premultipliedAlpha` should match request.'); - ok(actual.preserveDrawingBuffer == attribs.preserveDrawingBuffer, - 'Resulting `preserveDrawingBuffer` should match request.'); - - // "The depth, stencil and antialias attributes, when set to true, are - // requests, not requirements." - if (!attribs.antialias) { - ok(!actual.antialias, 'No `antialias` if not requested.'); - } - if (!attribs.depth) { - ok(!actual.depth, 'No `depth` if not requested.'); - } - if (!attribs.stencil) { - ok(!actual.stencil, 'No `stencil` if not requested.'); - } - - var hasAlpha = !!gl.getParameter(gl.ALPHA_BITS); - var hasDepth = !!gl.getParameter(gl.DEPTH_BITS); - var hasStencil = !!gl.getParameter(gl.STENCIL_BITS); - var hasAntialias = !!gl.getParameter(gl.SAMPLES); - - ok(hasAlpha == actual.alpha, 'Bits should match `alpha` attrib.'); - ok(hasAntialias == actual.antialias, 'Bits should match `antialias` attrib.'); - ok(hasDepth == actual.depth, 'Bits should match `depth` attrib.'); - ok(hasStencil == actual.stencil, 'Bits should match `stencil` attrib.'); -} - -function CloneAttribs(attribs) { - return { - alpha: attribs.alpha, - antialias: attribs.antialias, - depth: attribs.depth, - premultipliedAlpha: attribs.premultipliedAlpha, - preserveDrawingBuffer: attribs.preserveDrawingBuffer, - stencil: attribs.stencil, - }; -} - -function SplitForAttrib(list, attrib) { - var ret = []; - - for (var i in list) { - var cur = list[i]; - if (cur[attrib]) - throw 'Attrib is already true.'; - - var clone = CloneAttribs(cur); - clone[attrib] = true; - - ret.push(cur); - ret.push(clone); - } - - return ret; -} - -function GenAttribList() { - var base = { - alpha: false, - antialias: false, - depth: false, - premultipliedAlpha: false, - preserveDrawingBuffer: false, - stencil: false, - }; - var list = [base]; - list = SplitForAttrib(list, 'alpha'); - list = SplitForAttrib(list, 'antialias'); - list = SplitForAttrib(list, 'depth'); - list = SplitForAttrib(list, 'premultipliedAlpha'); - list = SplitForAttrib(list, 'preserveDrawingBuffer'); - list = SplitForAttrib(list, 'stencil'); - - if (list.length != 1<<6) - throw 'Attribs list length wrong: ' + list.length; - - return list; -} - -var list = GenAttribList(); -for (var i in list) { - var attribs = list[i]; - TestAttribs(attribs); -} - -ok(true, 'Test complete.'); - -</script> -
deleted file mode 100644 --- a/dom/canvas/test/webgl-mochitest/test_hidden_alpha.html +++ /dev/null @@ -1,155 +0,0 @@ -<!DOCTYPE HTML> -<title>WebGL test: Hidden alpha on no-alpha contexts</title> -<script src='/tests/SimpleTest/SimpleTest.js'></script> -<link rel='stylesheet' href='/tests/SimpleTest/test.css'> -<script src='driver-info.js'></script> -<script src='webgl-util.js'></script> -<body> -<script id='vs' type='x-shader/x-vertex'> - attribute vec2 aPosCoord; - - void main(void) { - gl_Position = vec4(aPosCoord, 0.0, 1.0); - } -</script> - -<script id='fs' type='x-shader/x-fragment'> - precision mediump float; - - void main(void) { - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - } -</script> -<canvas id='canvas' style='border: none;' width='100' height='100'></canvas> -<script> - -var posCoords_arr = new Float32Array(2 * 4); -var posCoords_buff = null; -function DrawQuad(gl, prog, x0, y0, x1, y1) { - gl.useProgram(prog); - - if (!posCoords_buff) { - posCoords_buff = gl.createBuffer(); - } - gl.bindBuffer(gl.ARRAY_BUFFER, posCoords_buff); - posCoords_arr[0] = x0; - posCoords_arr[1] = y0; - - posCoords_arr[2] = x1; - posCoords_arr[3] = y0; - - posCoords_arr[4] = x0; - posCoords_arr[5] = y1; - - posCoords_arr[6] = x1; - posCoords_arr[7] = y1; - gl.bufferData(gl.ARRAY_BUFFER, posCoords_arr, gl.STREAM_DRAW); - - gl.enableVertexAttribArray(prog.aPosCoord); - gl.vertexAttribPointer(prog.aPosCoord, 2, gl.FLOAT, false, 0, 0); - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); -} - -function DrawSquare(gl, prog, size) { - DrawQuad(gl, prog, -size, -size, size, size); -} - -function Reset(gl) { - gl.canvas.width += 1; - gl.canvas.width -= 1; -} - -function ReadCenterPixel(gl) { - var w = gl.drawingbufferWidth; - var h = gl.drawingbufferHeight; - var ret = new Uint8Array(4); - gl.readPixels(w/2, h/2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, ret); - return ret; -} - -function Test(gl, prog) { - gl.enable(gl.BLEND); - gl.blendFunc(gl.ZERO, gl.DST_ALPHA); - - var iColor = 64; - var fColor = iColor / 255.0; - - ////////////////// - - ok(true, 'clear(R,G,B,0)'); - - Reset(gl); - - gl.clearColor(fColor, fColor, fColor, 0.0); - gl.clear(gl.COLOR_BUFFER_BIT); - - var dataURL_pre = gl.canvas.toDataURL(); - //console.log('Before blending: ' + dataURL_pre); - - DrawSquare(gl, prog, 0.7); - - var pixel = ReadCenterPixel(gl); - ok(pixel[0] == iColor && - pixel[1] == iColor && - pixel[2] == iColor, 'Color should be the same.'); - ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.'); - - var dataURL_post = gl.canvas.toDataURL(); - //console.log('After blending: ' + dataURL_post); - ok(dataURL_post == dataURL_pre, - 'toDataURL should be unchanged after blending.'); - - ////////////////// - - ok(true, 'mask(R,G,B,0), clear(R,G,B,1)'); - - Reset(gl); - - gl.colorMask(true, true, true, false); - gl.clearColor(fColor, fColor, fColor, 1.0); - gl.clear(gl.COLOR_BUFFER_BIT); - gl.colorMask(true, true, true, true); - - dataURL_pre = gl.canvas.toDataURL(); - //console.log('Before blending: ' + dataURL_pre); - - DrawSquare(gl, prog, 0.7); - - var pixel = ReadCenterPixel(gl); - ok(pixel[0] == iColor && - pixel[1] == iColor && - pixel[2] == iColor, 'Color should be the same.'); - ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.'); - ok(gl.getError() == 0, 'Should have no errors.'); - - dataURL_post = gl.canvas.toDataURL(); - //console.log('After blending: ' + dataURL_post); - ok(dataURL_post == dataURL_pre, - 'toDataURL should be unchanged after blending.'); - - ok(true, 'Test complete.'); - SimpleTest.finish(); -} - -(function(){ - var canvas = document.getElementById('canvas'); - var attribs = { - alpha: false, - antialias: false, - premultipliedAlpha: false, - }; - var gl = canvas.getContext('experimental-webgl', attribs); - ok(gl, 'WebGL should work.'); - ok(gl.getParameter(gl.ALPHA_BITS) == 0, 'Shouldn\'t have alpha bits.'); - - var prog = WebGLUtil.createProgramByIds(gl, 'vs', 'fs'); - ok(prog, 'Program should link.'); - prog.aPosCoord = gl.getAttribLocation(prog, 'aPosCoord'); - - SimpleTest.waitForExplicitFinish(); - setTimeout(function(){ Test(gl, prog); }, 500); -})(); - -</script> -</body>