From 2c98757892b1c3dc416201b458d53a342ef354f7 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 1 Sep 2020 12:04:10 -0700 Subject: [PATCH 1/4] Add test for fb with mismatched attachment rb/tex-targets for #2558. --- .../conformance2/rendering/00_test_list.txt | 1 + ...ebuffer-mismatched-attachment-targets.html | 159 ++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html diff --git a/sdk/tests/conformance2/rendering/00_test_list.txt b/sdk/tests/conformance2/rendering/00_test_list.txt index 46ca3048a6..791f42698d 100644 --- a/sdk/tests/conformance2/rendering/00_test_list.txt +++ b/sdk/tests/conformance2/rendering/00_test_list.txt @@ -24,6 +24,7 @@ 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-mismatched-attachment-targets.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 diff --git a/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html b/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html new file mode 100644 index 0000000000..5e115c0170 --- /dev/null +++ b/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html @@ -0,0 +1,159 @@ + + + + + + +WebGL2 can render to framebuffer attachments with different targets + + + + + + + + +
+
+ + + + + From 2c79c2958e2b4c888fc4e67246a3251f513e8d41 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 1 Sep 2020 16:56:31 -0700 Subject: [PATCH 2/4] Allow _UNSUPPORTED. Also don't output opt_msg if omitted. --- ...ebuffer-mismatched-attachment-targets.html | 4 +++- sdk/tests/js/webgl-test-utils.js | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html b/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html index 5e115c0170..20be6decd2 100644 --- a/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html +++ b/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html @@ -132,7 +132,9 @@ debug(`mipLevel: ${mipLevel}`); color.attach(gl.COLOR_ATTACHMENT0, mipLevel); depth.attach(gl.DEPTH_ATTACHMENT, mipLevel); - wtu.framebufferStatusShouldBe(gl, gl.FRAMEBUFFER, gl.FRAMEBUFFER_COMPLETE); + if (!wtu.framebufferStatusShouldBe(gl, gl.FRAMEBUFFER, [gl.FRAMEBUFFER_COMPLETE, gl.FRAMEBUFFER_UNSUPPORTED])) { + continue; + } gl.clear(gl.COLOR_BUFFER_BIT); wtu.checkCanvas(gl, [255, 0, 0, 255], `framebuffer layer ${mipLevel} should be cleared red`); diff --git a/sdk/tests/js/webgl-test-utils.js b/sdk/tests/js/webgl-test-utils.js index ca605dfb60..8897ead4d0 100644 --- a/sdk/tests/js/webgl-test-utils.js +++ b/sdk/tests/js/webgl-test-utils.js @@ -1751,13 +1751,20 @@ var framebufferStatusShouldBe = function(gl, target, glStatuses, opt_msg) { 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); + let msg = "checkFramebufferStatus expected" + ((glStatuses.length > 1) ? " one of: " : ": ") + + expected + ". Was " + glEnumToString(gl, status); + if (opt_msg) { + msg += ": " + opt_msg; + } + testFailed(msg); + return false; + } + let msg = "checkFramebufferStatus was " + ((glStatuses.length > 1) ? "one of: " : "expected value: ") + expected; + if (opt_msg) { + msg += ": " + opt_msg; } - return status; + testPassed(msg); + return true; } /** From 15f7519212edd6e2d939ebbb808cfc7b55f136bd Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 1 Sep 2020 17:42:46 -0700 Subject: [PATCH 3/4] Skip test if not _COMPLETE. --- .../framebuffer-mismatched-attachment-targets.html | 3 ++- sdk/tests/js/webgl-test-utils.js | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html b/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html index 20be6decd2..34ea409ce7 100644 --- a/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html +++ b/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html @@ -132,7 +132,8 @@ debug(`mipLevel: ${mipLevel}`); color.attach(gl.COLOR_ATTACHMENT0, mipLevel); depth.attach(gl.DEPTH_ATTACHMENT, mipLevel); - if (!wtu.framebufferStatusShouldBe(gl, gl.FRAMEBUFFER, [gl.FRAMEBUFFER_COMPLETE, gl.FRAMEBUFFER_UNSUPPORTED])) { + const maybeStatus = wtu.framebufferStatusShouldBe(gl, gl.FRAMEBUFFER, [gl.FRAMEBUFFER_COMPLETE, gl.FRAMEBUFFER_UNSUPPORTED]); + if (!maybeStatus || maybeStatus[0] != gl.FRAMEBUFFER_COMPLETE) { continue; } diff --git a/sdk/tests/js/webgl-test-utils.js b/sdk/tests/js/webgl-test-utils.js index 8897ead4d0..cf9c14d9e8 100644 --- a/sdk/tests/js/webgl-test-utils.js +++ b/sdk/tests/js/webgl-test-utils.js @@ -1759,12 +1759,15 @@ var framebufferStatusShouldBe = function(gl, target, glStatuses, opt_msg) { testFailed(msg); return false; } - let msg = "checkFramebufferStatus was " + ((glStatuses.length > 1) ? "one of: " : "expected value: ") + expected; + let msg = `checkFramebufferStatus was ${glEnumToString(gl, status)}`; + if (glStatuses.length > 1) { + msg += `, one of: ${expected}`; + } if (opt_msg) { msg += ": " + opt_msg; } testPassed(msg); - return true; + return [status]; } /** From f6f9a820bb90dd521a16fd54283c9e49747c7b18 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 8 Sep 2020 17:14:33 -0700 Subject: [PATCH 4/4] Update description(). --- .../rendering/framebuffer-mismatched-attachment-targets.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html b/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html index 34ea409ce7..a8a28d6444 100644 --- a/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html +++ b/sdk/tests/conformance2/rendering/framebuffer-mismatched-attachment-targets.html @@ -34,7 +34,7 @@ "use strict"; debug(""); -description("Test that WebGL2 can render to layers in 3D textures"); +description("Test framebuffer attachments with different targets"); const wtu = WebGLTestUtils; const gl = wtu.create3DContext("example", undefined, 2);