Disable WebGL antialias in CanvasKit

We were accidentally turning on MSAA via the "antialias" context attrib,
then feeding the render target into Ganesh and saying it was non-MSAA.

This will cause rendering artifacts in Ganesh if MSAA is unknowingly
enabled when we try to do coverage-based AA.

Also, the WebGL spec does not give us control over the exact sample
count or even guarantee that "antialias" means MSAA, so I think it's
best to leave that flag disabled by default. If a client wants MSAA,
they can create their own offscreen surface and blit it into the main
canvas.

Change-Id: I45f1596bfe9258963cff4b5d0a3921c5ba43145f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291029
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Chris Dalton 2020-05-21 15:46:16 -06:00 committed by Skia Commit-Bot
parent 67e21a1925
commit 38e33df982
2 changed files with 6 additions and 1 deletions

View File

@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `CanvasKitInit(...)` now directly returns a Promise. As such, `CanvasKitInit(...).ready()`
has been removed.
### Fixed
- WebGL context is no longer created with "antialias" flag. Using "antialias" caused poor AA
quality in Ganesh when trying to do coverage-based AA with MSAA unknowingly enabled. It also
reduced performance.
## [0.15.0] - 2020-05-14
### Added

View File

@ -18,7 +18,7 @@
'alpha': get(attrs, 'alpha', 1),
'depth': get(attrs, 'depth', 1),
'stencil': get(attrs, 'stencil', 8),
'antialias': get(attrs, 'antialias', 1),
'antialias': get(attrs, 'antialias', 0),
'premultipliedAlpha': get(attrs, 'premultipliedAlpha', 1),
'preserveDrawingBuffer': get(attrs, 'preserveDrawingBuffer', 0),
'preferLowPowerToHighPerformance': get(attrs, 'preferLowPowerToHighPerformance', 0),