Bug 79683 - Fix bugs in printing of WebGL canvases
Summary: Fix bugs in printing of WebGL canvases
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kenneth Russell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-27 10:47 PST by Kenneth Russell
Modified: 2024-01-17 00:58 PST (History)
7 users (show)

See Also:


Attachments
Patch (5.44 KB, patch)
2012-02-27 13:03 PST, Kenneth Russell
kbr: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Russell 2012-02-27 10:47:42 PST
On some ports the printing of WebGL canvases is either broken or extremely inefficient. In the Chromium port, multiple readbacks of the context are being done, some of which are from the wrong source. A rewrite of WebGLRenderingContext::paintRenderingResultsToCanvas is needed.

This was discovered during investigation of Chromium issue 99393 (http://crbug.com/99393), although this fix does not fix that issue.
Comment 1 Kenneth Russell 2012-02-27 13:03:34 PST
Created attachment 129088 [details]
Patch
Comment 2 John Bauman 2012-02-27 13:16:06 PST
Comment on attachment 129088 [details]
Patch

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

> Source/WebCore/html/canvas/WebGLRenderingContext.cpp:-685
> -        canvas()->makePresentationCopy();

I believe removing this breaks when accelerated compositing is disabled.
Comment 3 Kenneth Russell 2012-02-27 13:25:46 PST
Comment on attachment 129088 [details]
Patch

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

>> Source/WebCore/html/canvas/WebGLRenderingContext.cpp:-685
>> -        canvas()->makePresentationCopy();
> 
> I believe removing this breaks when accelerated compositing is disabled.

It doesn't seem to. I've run Chromium with --disable-accelerated-compositing and WebGL displays fine. Turning off accelerated compositing in Safari causes WebGL to be disabled.
Comment 4 Kenneth Russell 2012-02-27 14:51:55 PST
Comment on attachment 129088 [details]
Patch

jbauman walked me through the code paths offline and it seems clear that the short-circuits I added above don't work in all cases, for example drawing a WebGL canvas into a 2D canvas. Withdrawing this patch from review.
Comment 5 Kenneth Russell 2012-02-27 15:07:22 PST
Additionally, I should mention that it looks like printing isn't broken in the common case, though it does look like redundant readbacks are being performed.
Comment 6 Kenneth Russell 2012-02-27 18:55:46 PST
After more testing, there are definitely bugs in the current printing code for WebGL-rendered canvases. Minimally, it looks like if the same page is printed multiple times, the contents of the canvas are always that which was on the first copy. Will look into this more after working around related stability issues.
Comment 7 John Bauman 2012-02-27 19:15:05 PST
I think the reason it always prints the same content is that in the normal (accelerated compositing disabled) case, the next time it would paint to the screen, layerComposited would be false when calling paintRenderedResultsToCanvas, which means that clearPresentationCopy would be called. When printing twice, the presentation copy isn't cleared (and makePresentationCopy won't do anything), so it'll draw from the old presentation copy.
Comment 8 Kimmo Kinnunen 2024-01-17 00:58:08 PST
Inactionable for current WebKit