| Summary: | REGRESSION (Safari 17 beta): WebGL contexts drawn into canvas contexts are upside-down when premultipliedAlpha is false | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Paul Neave <paul.neave> | ||||
| Component: | WebGL | Assignee: | Dan Glastonbury <djg> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | dino, kbr, kkinnunen, patrick.martin.r, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari 17 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=261069 | ||||||
| Attachments: |
|
||||||
Ouch! Note that the comments in the test case are slightly wrong. // 2D canvas is rendered upside-down if premultipliedAlpha is set to true above This should be "is set to false above". The description in this report is correct though. When premultipliedAlpha is false (not the default value), the render from GL into 2D is upside down. Copying from the internal analysis: https://commits.webkit.org/262518@main seems to be the cause. And I assume it is the call to `readCompositedResults()` or `paintRenderingResultsToPixelBuffer()` that produces a NativeImage that is a different orientation to the one we'd get otherwise. They are always flipped when rendering into the 2D canvas. (In reply to Dean Jackson from comment #3) > Note that the comments in the test case are slightly wrong. > > // 2D canvas is rendered upside-down if premultipliedAlpha is set to true > above > > This should be "is set to false above". > > The description in this report is correct though. When premultipliedAlpha is > false (not the default value), the render from GL into 2D is upside down. Thanks Dean, yes that's correct - that was a typo. Pull request: https://github.com/WebKit/WebKit/pull/15970 Committed 266225@main (ae8167890120): <https://commits.webkit.org/266225@main> Reviewed commits have been landed. Closing PR #15970 and removing active labels. This may also be happening with WebGL 1 & OffscreenCanvas.toImageBitmap and bitmaprendererer contexts. I need to double check, but I'm definitely getting similar behavior with my library that uses that method. (In reply to Patrick Martin from comment #8) > This may also be happening with WebGL 1 & OffscreenCanvas.toImageBitmap and > bitmaprendererer contexts. I need to double check, but I'm definitely > getting similar behavior with my library that uses that method. Oh no! Can you create a simple example to demonstrate this? It might be worth submitting a new bug report as this bug is regarding premultipliedAlpha, which is now fixed. (In reply to Paul Neave from comment #9) > (In reply to Patrick Martin from comment #8) > > This may also be happening with WebGL 1 & OffscreenCanvas.toImageBitmap and > > bitmaprendererer contexts. I need to double check, but I'm definitely > > getting similar behavior with my library that uses that method. > > Oh no! Can you create a simple example to demonstrate this? It might be > worth submitting a new bug report as this bug is regarding > premultipliedAlpha, which is now fixed. BugĀ 261069 has been submitted for that issue. |
Created attachment 467067 [details] Demo of Safari 17 upside-down webgl-canvas bug In Safari 17 (Mac TP and iOS 17 beta), when drawing a WebGL1 context into a 2D canvas context, pixels are flipped in the y-axis (upside-down) when 'premultipliedAlpha' is set to false. Please view the attachment in Safari 16 (or any other browser) and compare to Safari 17. The first rectangle is the WebGL canvas. The second rectangle is the 2D canvas. In Safari 17, the second image appears upside-down. This only occurs when premultipliedAlpha is set to false.