canvas: Add vello_cpu backend (#38282)

vello_cpu does not have any tests timeouts, because we do not need
download stuff from GPU as all work happens on CPU. So performance wise
it's better then classic vello at least for our usecase. There are some
vello bugs, but I think we will be able to sort them out within
upstream, eventually. Interestingly enough there are no new PASS like
they were with classic vello.

Difference with raqote can be observed here:
https://github.com/sagudev/servo/actions/runs/16549241085/attempts/1#summary-46802486798

## Known vello problems:

- https://github.com/linebender/vello/issues/1119
- https://github.com/linebender/vello/issues/1056
-
`/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html`
- `kurbo::Cap::Butt` is defect (only visible with big lineWidth)
https://github.com/linebender/vello/issues/1063
  - `/html/canvas/element/line-styles/2d.line.cross.html`
  - `/html/canvas/element/line-styles/2d.line.miter.acute.html`
- other lack of strong correct problems
(https://github.com/linebender/vello/issues/1063#issuecomment-2998084736):
  - `/html/canvas/element/path-objects/2d.path.rect.selfintersect.html`
- `putImageData(getImageData(...), ...)` is lossy (precision problems,
might be due to ImageData being unmultiplied)
-
`/html/canvas/element/pixel-manipulation/2d.imageData.put.unchanged.html`

Testing: Tested using vello_cpu_canvas subsuite

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev 2025-07-27 21:56:38 +02:00 committed by GitHub
parent 15be75f955
commit 056b1538c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 694 additions and 11 deletions

View file

@ -78,6 +78,8 @@ pub struct Preferences {
pub dom_canvas_text_enabled: bool,
/// Uses vello as canvas backend
pub dom_canvas_vello_enabled: bool,
/// Uses vello_cpu as canvas backend
pub dom_canvas_vello_cpu_enabled: bool,
pub dom_clipboardevent_enabled: bool,
pub dom_composition_event_enabled: bool,
pub dom_cookiestore_enabled: bool,
@ -258,6 +260,7 @@ impl Preferences {
dom_canvas_capture_enabled: false,
dom_canvas_text_enabled: true,
dom_canvas_vello_enabled: false,
dom_canvas_vello_cpu_enabled: false,
dom_clipboardevent_enabled: true,
dom_composition_event_enabled: false,
dom_cookiestore_enabled: false,