Bug 212594 - [ macOS ] REGRESSION(r262366): webgl/1.0.3/conformance/canvas/buffer-offscreen-test.html & webgl/2.0.0/conformance/canvas/buffer-offscreen-test.html are constant failures
Summary: [ macOS ] REGRESSION(r262366): webgl/1.0.3/conformance/canvas/buffer-offscree...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-01 07:34 PDT by Jacob Uphoff
Modified: 2021-08-31 01:43 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.48 KB, patch)
2020-06-02 19:21 PDT, Dean Jackson
eric.carlson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jacob Uphoff 2020-06-01 07:34:38 PDT
webgl/2.0.0/conformance/canvas/buffer-offscreen-test.html
webgl/1.0.3/conformance/canvas/buffer-offscreen-test.html

These tests became constant failures after commit r262366 for all of macOS.

History:

https://results.webkit.org/?suite=layout-tests&suite=layout-tests&test=webgl%2F2.0.0%2Fconformance%2Fcanvas%2Fbuffer-offscreen-test.html&test=webgl%2F1.0.3%2Fconformance%2Fcanvas%2Fbuffer-offscreen-test.html

Diffs:

--- /Volumes/Data/slave/catalina-release-tests-wk2/build/layout-test-results/webgl/1.0.3/conformance/canvas/buffer-offscreen-test-expected.txt
+++ /Volumes/Data/slave/catalina-release-tests-wk2/build/layout-test-results/webgl/1.0.3/conformance/canvas/buffer-offscreen-test-actual.txt
@@ -1,5 +1,14 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance/canvas/buffer-offscreen-test.html
-[ PASS ] All tests passed
+[ 1: PASS ] gl1 != null is true
+[ 2: PASS ] gl2 != null is true
+[ 3: PASS ] gl1.getContextAttributes().preserveDrawingBuffer == false is true
+[ 4: PASS ] gl2.getContextAttributes().preserveDrawingBuffer == false is true
+[ 5: PASS ] cleared corner should be blue, stencil should be preserved
+[ 6: PASS ] remainder of buffer should be cleared
+[ 7: PASS ] cleared corner should be blue, stencil should be preserved
+[ 8: FAIL ] at (0, 0) expected: 255,0,0,255 was 0,0,0,0
+[ 9: PASS ] successfullyParsed is true
+[ FAIL ] 1 failures reported
 

--- /Volumes/Data/slave/catalina-release-tests-wk2/build/layout-test-results/webgl/2.0.0/conformance/canvas/buffer-offscreen-test-expected.txt
+++ /Volumes/Data/slave/catalina-release-tests-wk2/build/layout-test-results/webgl/2.0.0/conformance/canvas/buffer-offscreen-test-actual.txt
@@ -1,5 +1,14 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance/canvas/buffer-offscreen-test.html
-[ PASS ] All tests passed
+[ 1: PASS ] gl1 != null is true
+[ 2: PASS ] gl2 != null is true
+[ 3: PASS ] gl1.getContextAttributes().preserveDrawingBuffer == false is true
+[ 4: PASS ] gl2.getContextAttributes().preserveDrawingBuffer == false is true
+[ 5: PASS ] cleared corner should be blue, stencil should be preserved
+[ 6: PASS ] remainder of buffer should be cleared
+[ 7: PASS ] cleared corner should be blue, stencil should be preserved
+[ 8: FAIL ] remainder of buffer should be un-cleared red at (0, 0) expected: 255,0,0,255 was 0,0,0,0
+[ 9: PASS ] successfullyParsed is true
+[ FAIL ] 1 failures reported
Comment 1 Radar WebKit Bug Importer 2020-06-01 07:35:04 PDT
<rdar://problem/63828783>
Comment 2 Ryan Haddad 2020-06-01 17:32:07 PDT
Marked tests as failing in r262400
Comment 3 Dean Jackson 2020-06-02 16:25:07 PDT
It's quite confusing as to how I could have broken this. Maybe another case where we are setting the GL state temporarily for compositing and not restoring it?
Comment 4 Dean Jackson 2020-06-02 16:26:20 PDT
Our visual result is correct. It's the content read from the in-progress draw that's wrong.
Comment 5 Dean Jackson 2020-06-02 18:25:49 PDT
Hmmm.. I see an extra call to clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT)
Comment 6 Dean Jackson 2020-06-02 18:31:51 PDT
Oh. I see.

We shouldn't prepare the canvas if it isn't going to be displayed. We're effectively swapping the drawing buffer on a canvas that is never drawn, so when it is read back out it is cleared.
Comment 7 Dean Jackson 2020-06-02 18:50:46 PDT
Now that I think of it, this whole area could do with some cleanup. We really only need a WebGLLayer when the owning canvas is put in the page. It's a bit weird that the GraphicsContextGL lets the WebGLLayer manage the IOSurface backbuffers. Instead it should just hand the current framebuffer surface to the layer.

I don't want to make such a big change right now though.
Comment 8 Dean Jackson 2020-06-02 19:03:39 PDT
This is slightly tricky since we indicate we need preparation as we touch GL, but we only know if we need to actually prepare at the end of the run loop.

So I guess the Document::prepareCanvasesForDisplayIfNeeded has an even more correct name now. It should check if the canvas element is actually in its body before preparing.
Comment 9 Dean Jackson 2020-06-02 19:21:27 PDT
Created attachment 400880 [details]
Patch
Comment 10 Alexey Proskuryakov 2020-06-03 09:56:16 PDT
Comment on attachment 400880 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400880&action=review

> Source/WebCore/ChangeLog:3
> +        [ macOS ] REGRESSION(r262366): webgl/1.0.3/conformance/canvas/buffer-offscreen-test.html & webgl/2.0.0/conformance/canvas/buffer-offscreen-test.html are constant failures

Could you please unmark the tests in a single commit with the fix?
Comment 11 Dean Jackson 2020-06-03 11:38:30 PDT
Comment on attachment 400880 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=400880&action=review

>> Source/WebCore/ChangeLog:3
>> +        [ macOS ] REGRESSION(r262366): webgl/1.0.3/conformance/canvas/buffer-offscreen-test.html & webgl/2.0.0/conformance/canvas/buffer-offscreen-test.html are constant failures
> 
> Could you please unmark the tests in a single commit with the fix?

Yes, I should have thought of that.
Comment 12 Dean Jackson 2020-06-03 11:49:29 PDT
Committed r262498: <https://trac.webkit.org/changeset/262498>