diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/canvas/render-after-resize-test.html b/dom/canvas/test/webgl-conf/checkout/conformance/canvas/render-after-resize-test.html index 82621ffae1e1..351a19f6fdc8 100644 --- a/dom/canvas/test/webgl-conf/checkout/conformance/canvas/render-after-resize-test.html +++ b/dom/canvas/test/webgl-conf/checkout/conformance/canvas/render-after-resize-test.html @@ -1,5 +1,5 @@ @@ -14,58 +14,116 @@ found in the LICENSE.txt file.
- +
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/more/functions/texImage2DHTML.html b/dom/canvas/test/webgl-conf/checkout/conformance/more/functions/texImage2DHTML.html index 7f3b79e172ad..8d21c9de30c9 100644 --- a/dom/canvas/test/webgl-conf/checkout/conformance/more/functions/texImage2DHTML.html +++ b/dom/canvas/test/webgl-conf/checkout/conformance/more/functions/texImage2DHTML.html @@ -11,7 +11,48 @@ found in the LICENSE.txt file. - + + + + + + + + + + - - - - - - - - - - + + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/more/functions/texSubImage2DHTML.html b/dom/canvas/test/webgl-conf/checkout/conformance/more/functions/texSubImage2DHTML.html index 3950c899b5a3..c1acb7250a86 100644 --- a/dom/canvas/test/webgl-conf/checkout/conformance/more/functions/texSubImage2DHTML.html +++ b/dom/canvas/test/webgl-conf/checkout/conformance/more/functions/texSubImage2DHTML.html @@ -11,7 +11,47 @@ found in the LICENSE.txt file. - + + + + + + + + + - - - - - - - - - diff --git a/dom/canvas/test/webgl-conf/checkout/conformance2/renderbuffers/multisampled-depth-renderbuffer-initialization.html b/dom/canvas/test/webgl-conf/checkout/conformance2/renderbuffers/multisampled-depth-renderbuffer-initialization.html index f85dcbc19e73..7bd87890e2d9 100644 --- a/dom/canvas/test/webgl-conf/checkout/conformance2/renderbuffers/multisampled-depth-renderbuffer-initialization.html +++ b/dom/canvas/test/webgl-conf/checkout/conformance2/renderbuffers/multisampled-depth-renderbuffer-initialization.html @@ -29,6 +29,19 @@ if (!gl) { // Set the clear color to green. It should never show up. gl.clearColor(0, 1, 0, 1); + debug("Test renderbufferStorageMultisample with webgl1's DEPTH_STENCIL."); + { + const rb = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, rb); + wtu.shouldGenerateGLError(gl, 0, + "gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 0, gl.DEPTH_STENCIL, 1, 1)"); + wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, + "gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 1, gl.DEPTH_STENCIL, 1, 1)"); + wtu.shouldGenerateGLError(gl, gl.INVALID_OPERATION, + "gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 2, gl.DEPTH_STENCIL, 1, 1)"); + gl.deleteRenderbuffer(rb); + } + let c = gl.canvas; var maxSamples = gl.getInternalformatParameter( gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES)[0]; @@ -52,6 +65,7 @@ if (!gl) { } function runTest(gl, params) { + debug(""); debug("Test for depth buffer: " + JSON.stringify(params)); let resolve = params.alloc2 ? params.alloc2 : params.alloc1; gl.viewport(0, 0, resolve.w, resolve.h); diff --git a/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/00_test_list.txt index 83bfdd905d81..46ca3048a601 100644 --- a/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/00_test_list.txt +++ b/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/00_test_list.txt @@ -24,6 +24,8 @@ draw-buffers.html element-index-uint.html --min-version 2.0.1 framebuffer-completeness-draw-framebuffer.html framebuffer-completeness-unaffected.html +--min-version 2.0.1 framebuffer-render-to-layer.html +--min-version 2.0.1 framebuffer-render-to-layer-angle-issue.html --min-version 2.0.1 framebuffer-texture-changing-base-level.html --min-version 2.0.1 framebuffer-texture-level1.html framebuffer-unsupported.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/framebuffer-render-to-layer-angle-issue.html b/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/framebuffer-render-to-layer-angle-issue.html new file mode 100644 index 000000000000..1fbdb6bbeb49 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/framebuffer-render-to-layer-angle-issue.html @@ -0,0 +1,90 @@ + + + + + + +WebGL2 can render to layers in 3D texture angle issue check + + + + + + + + +
+ANGLE issue #4417 +
+ + + + + diff --git a/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/framebuffer-render-to-layer.html b/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/framebuffer-render-to-layer.html new file mode 100644 index 000000000000..c34f2a41436b --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance2/rendering/framebuffer-render-to-layer.html @@ -0,0 +1,440 @@ + + + + + + +WebGL2 can render to layers in 3D and 2D_ARRAY textures + + + + + + + +
+
+ + + + + diff --git a/dom/canvas/test/webgl-conf/checkout/js/webgl-test-utils.js b/dom/canvas/test/webgl-conf/checkout/js/webgl-test-utils.js index ba9af6cb5355..95a478889626 100644 --- a/dom/canvas/test/webgl-conf/checkout/js/webgl-test-utils.js +++ b/dom/canvas/test/webgl-conf/checkout/js/webgl-test-utils.js @@ -1722,7 +1722,32 @@ var glErrorShouldBe = function(gl, glErrors, opt_msg) { return glErrorShouldBeImpl(gl, glErrors, true, opt_msg); }; - +/** + * Tests that the given framebuffer has a specific status + * @param {!WebGLRenderingContext} gl The WebGLRenderingContext to use. + * @param {number|Array.} glStatuses The expected gl + * status or an array of expected statuses. + * @param {string} opt_msg Optional additional message. + */ +var framebufferStatusShouldBe = function(gl, target, glStatuses, opt_msg) { + if (!glStatuses.length) { + glStatuses = [glStatuses]; + } + opt_msg = opt_msg || ""; + const status = gl.checkFramebufferStatus(target); + const ndx = glStatuses.indexOf(status); + const expected = glStatuses.map((status) => { + return glEnumToString(gl, status); + }).join(' or '); + if (ndx < 0) { + var msg = "checkFramebufferStatus expected" + ((glStatuses.length > 1) ? " one of: " : ": "); + testFailed(msg + expected + ". Was " + glEnumToString(gl, status) + " : " + opt_msg); + } else { + var msg = "checkFramebufferStatus was " + ((glStatuses.length > 1) ? "one of: " : "expected value: "); + testPassed(msg + expected + " : " + opt_msg); + } + return status; +} /** * Tests that the first error GL returns is the specified error. Allows suppression of successes. @@ -3158,6 +3183,13 @@ var getRelativePath = function(path) { return relparts.join("/"); } +function chooseUrlForCrossOriginImage(imgUrl, localUrl) { + if (runningOnLocalhost()) + return getLocalCrossOrigin() + getRelativePath(localUrl); + + return img.src = getUrlOptions().imgUrl || imgUrl; +} + var setupImageForCrossOriginTest = function(img, imgUrl, localUrl, callback) { window.addEventListener("load", function() { if (typeof(img) == "string") @@ -3168,10 +3200,7 @@ var setupImageForCrossOriginTest = function(img, imgUrl, localUrl, callback) { img.addEventListener("load", callback, false); img.addEventListener("error", callback, false); - if (runningOnLocalhost()) - img.src = getLocalCrossOrigin() + getRelativePath(localUrl); - else - img.src = getUrlOptions().imgUrl || imgUrl; + img.src = chooseUrlForCrossOriginImage(imgUrl, localUrl); }, false); } @@ -3309,6 +3338,14 @@ function createImageFromPixel(buf, width, height) { return img; } +async function awaitTimeout(ms) { + await new Promise(res => { + setTimeout(() => { + res(); + }, ms); + }); +} + var API = { addShaderSource: addShaderSource, addShaderSources: addShaderSources, @@ -3342,6 +3379,7 @@ var API = { endsWith: endsWith, failIfGLError: failIfGLError, fillTexture: fillTexture, + framebufferStatusShouldBe: framebufferStatusShouldBe, getBytesPerComponent: getBytesPerComponent, getDefault3DContextVersion: getDefault3DContextVersion, getExtensionPrefixedNames: getExtensionPrefixedNames, @@ -3434,7 +3472,9 @@ var API = { runningOnLocalhost: runningOnLocalhost, getLocalCrossOrigin: getLocalCrossOrigin, getRelativePath: getRelativePath, + chooseUrlForCrossOriginImage: chooseUrlForCrossOriginImage, setupImageForCrossOriginTest: setupImageForCrossOriginTest, + awaitTimeout: awaitTimeout, none: false }; diff --git a/dom/canvas/test/webgl-conf/cherry_picks.txt b/dom/canvas/test/webgl-conf/cherry_picks.txt index ab4c833a3914..dc8e3640ffe4 100644 --- a/dom/canvas/test/webgl-conf/cherry_picks.txt +++ b/dom/canvas/test/webgl-conf/cherry_picks.txt @@ -1,19 +1,23 @@ -commit 7ff0c2857868fafa202f7b169266dd46250afa20 -Author: Jeff Gilbert -Date: Tue Feb 25 10:43:35 2020 -0800 +commit 2217a5170cf68932020867dd40c4137a748dd2e1 +Author: Jeff Gilbert +Date: Fri Mar 13 13:10:49 2020 -0700 - Add GLSL preprocessor comment behavior tests. (#3028) + Add Render();NoOpResize();Render(); tests. - Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1617512 + Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1621523 Cherries picked ================================================================================ Merge base from: ups/master -commit 37e233058f64357a13599ed5be92b72094ec7fba -Author: Ken Russell -Date: Thu Feb 20 18:10:31 2020 -0800 +commit b49347b2c51eba1a60e63046bd8b9db0f2f8efba +Author: Jeff Gilbert +Date: Mon Mar 9 11:48:08 2020 -0700 - Test Intel driver bug where clear/drawArrays reorder across bindFramebuffer. (#2997) + Add testcase for minimal glsl line comment, and related. (#3035) - Regression test for http://crbug.com/1018028 . + * Add testcase for minimal glsl line comment, and related. + + Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1620876 + + * Improve testcase description. diff --git a/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py b/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py index 7ab6eadf061e..ac0cc8d5032a 100755 --- a/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py +++ b/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py @@ -7,8 +7,9 @@ # Write a Mochitest manifest for WebGL conformance test files. import os -import re from pathlib import * +import re +import shutil # All paths in this file are based where this file is run. WRAPPER_TEMPLATE_FILE = 'mochi-wrapper.html.template' @@ -540,6 +541,7 @@ def GetFilePathListForDir(baseDir): if __name__ == '__main__': file_dir = Path(__file__).parent os.chdir(str(file_dir)) + shutil.rmtree(file_dir / 'generated', True) testEntryList = GetTestList() wrapperPathStrList = WriteWrappers(testEntryList) diff --git a/dom/canvas/test/webgl-conf/generated-mochitest.ini b/dom/canvas/test/webgl-conf/generated-mochitest.ini index b3befe79a31b..f037a515316b 100644 --- a/dom/canvas/test/webgl-conf/generated-mochitest.ini +++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini @@ -2722,6 +2722,8 @@ support-files = always-fail.html checkout/conformance2/rendering/element-index-uint.html checkout/conformance2/rendering/framebuffer-completeness-draw-framebuffer.html checkout/conformance2/rendering/framebuffer-completeness-unaffected.html + checkout/conformance2/rendering/framebuffer-render-to-layer-angle-issue.html + checkout/conformance2/rendering/framebuffer-render-to-layer.html checkout/conformance2/rendering/framebuffer-texture-changing-base-level.html checkout/conformance2/rendering/framebuffer-texture-level1.html checkout/conformance2/rendering/framebuffer-unsupported.html @@ -5305,7 +5307,7 @@ subsuite = webgl2-core subsuite = webgl2-core [generated/test_2_conformance2__renderbuffers__multisampled-depth-renderbuffer-initialization.html] subsuite = webgl2-core -fail-if = (os == 'mac') +fail-if = 1 [generated/test_2_conformance2__renderbuffers__multisampled-renderbuffer-initialization.html] subsuite = webgl2-core fail-if = (os == 'android') @@ -5371,6 +5373,12 @@ subsuite = webgl2-core subsuite = webgl2-core [generated/test_2_conformance2__rendering__framebuffer-completeness-unaffected.html] subsuite = webgl2-core +[generated/test_2_conformance2__rendering__framebuffer-render-to-layer-angle-issue.html] +subsuite = webgl2-core +fail-if = (os == 'win') +[generated/test_2_conformance2__rendering__framebuffer-render-to-layer.html] +subsuite = webgl2-core +fail-if = (os == 'android') || (os == 'mac') [generated/test_2_conformance2__rendering__framebuffer-texture-changing-base-level.html] subsuite = webgl2-core fail-if = (os == 'win') diff --git a/dom/canvas/test/webgl-conf/generated/test_2_conformance2__rendering__framebuffer-render-to-layer-angle-issue.html b/dom/canvas/test/webgl-conf/generated/test_2_conformance2__rendering__framebuffer-render-to-layer-angle-issue.html new file mode 100644 index 000000000000..ebb2a8438f02 --- /dev/null +++ b/dom/canvas/test/webgl-conf/generated/test_2_conformance2__rendering__framebuffer-render-to-layer-angle-issue.html @@ -0,0 +1,17 @@ + + + + + + + Mochitest wrapper for WebGL Conformance Test Suite tests + + + + + + + + + + diff --git a/dom/canvas/test/webgl-conf/generated/test_2_conformance2__rendering__framebuffer-render-to-layer.html b/dom/canvas/test/webgl-conf/generated/test_2_conformance2__rendering__framebuffer-render-to-layer.html new file mode 100644 index 000000000000..c8f97c25c346 --- /dev/null +++ b/dom/canvas/test/webgl-conf/generated/test_2_conformance2__rendering__framebuffer-render-to-layer.html @@ -0,0 +1,17 @@ + + + + + + + Mochitest wrapper for WebGL Conformance Test Suite tests + + + + + + + + + + diff --git a/dom/canvas/test/webgl-conf/mochitest-errata.ini b/dom/canvas/test/webgl-conf/mochitest-errata.ini index aac8802a9970..249737fd44cd 100644 --- a/dom/canvas/test/webgl-conf/mochitest-errata.ini +++ b/dom/canvas/test/webgl-conf/mochitest-errata.ini @@ -246,6 +246,8 @@ fail-if = 1 fail-if = os == 'mac' && os_version == '10.14' # macosx1014 due to 1563418 [generated/test_2_conformance2__textures__misc__tex-unpack-params-with-flip-y-and-premultiply-alpha.html] fail-if = 1 +[generated/test_2_conformance2__renderbuffers__multisampled-depth-renderbuffer-initialization.html] +fail-if = 1 #################################################### # Bugs @@ -444,6 +446,11 @@ skip-if = (os == 'android') || (os == 'linux') # application crashed [@ mozilla::WebGLTexture::TexSubImage] skip-if = (os == 'win') || (os == 'android') +[generated/test_2_conformance2__rendering__framebuffer-render-to-layer.html] +# pixel 0,0 channel 2 was 51 expected 63 +/- 9 +fail-if = (os == 'android') || (os == 'mac') + + ######################################################################## ######################################################################## # Android @@ -848,8 +855,6 @@ fail-if = (os == 'mac') #################### # failure on OSX -[generated/test_2_conformance2__renderbuffers__multisampled-depth-renderbuffer-initialization.html] -fail-if = (os == 'mac') [generated/test_2_conformance2__textures__misc__tex-unpack-params.html] skip-if = (os == 'mac' && debug) fail-if = (os == 'mac') @@ -1207,6 +1212,10 @@ skip-if = (os == 'win') skip-if = (os == 'win') [generated/test_2_conformance__textures__misc__tex-video-using-tex-unit-non-zero.html] skip-if = (os == 'win') +[generated/test_2_conformance2__rendering__framebuffer-render-to-layer-angle-issue.html] +# framebuffer layer 0 should be green +# framebuffer layer 1 should be green +fail-if = (os == 'win') [generated/test_2_conformance2__rendering__framebuffer-texture-changing-base-level.html] # https://bugzilla.mozilla.org/show_bug.cgi?id=1501868 (ANGLE bug) fail-if = (os == 'win')