Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Thanks for looking into this. For my understanding, it is correct that you are now relying on Vello's internal use of My initial proposal in zullip was to rather explore a different architecture, one that would still be using our own As I remember the Vello codebase from a year ago, there was an interface for some sort of rendering backend, which then would use Anyway, if you are making progress with this I think it's a good idea simply to remove the raquote dependency, although longer term perhaps it could be replaced by something close to my proposal? |
That is eventual plan, but vello is missing some stuff.
We actually just need to write custom wgpu backend that uses our webgpu objects (sends IPC messages to webgpu thread). Anyway, vello started going into different direction, exploring more hybrid (because current vello GPU requirements are high in terms of features due to compute shaders) and cpu only approaches (the last one is only as fallback). Given this new circumstances I think this makes more sense (although I would be interested in exploring for vello to still live in content process). But I have an idea how we can still use our webgpu thread but keeping vello out of content process (canvas_paint_thread would send IPC to webgpu). Why? To better support hybrid. |
Yes.
I have yet to check it, but I think it's all good (we run from different wgpu Instances) although we are currently using different wgpu versions which could mask the problem. But we need to force vulkan (llvmpipe) in CI or else it will use GLES which fights with servo's uses of GL (we might have same problem with GLES in webgpu). |
What is missing?
A Vello release with WGPU is planned within the next couple of weeks :) (and I'm pretty sure it will work just fine with the same version of WGPU). |
Filter, but this is known in vello: linebender/vello#476
Yeah, the only potencial problems can be statics in wgpu or some other global states that are shared between wgpu instances (or servo in case of GL). But that's probably just me being paranoid (although keep in mind that typical wgpu users do not have multiple instances across multiple threads). |
447f9cf to
bc762d1
Compare
|
Sorry that I haven't gotten a chance to look at this yet. I hope to do so in the next couple days. This is very exciting! I would be in favor of removing the raqote backend even if some thing in Vello are missing. I think putting all of our effort behind a single canvas is a useful side-effect of removing support for raqote. |
Currently, I think we should keep both for now:
Also here are current test results: https://github.com/sagudev/servo/actions/runs/14968535017 EDIT: |
0131bdc to
b906b78
Compare
I fell into trap of over-generalization in #36793, but #36821 showed `Cow<[u8]>` is all we need (to reuse existing vec alloc or pass on a slice). Testing: There are WPT tests, but it's just refactor so rust keeps us safe. Split of #36821 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This is also required by spec: https://html.spec.whatwg.org/multipage/canvas.html#ensure-there-is-a-subpath and if we not ensure it vello will trigger debug asserts. Enforcing this at `PathBuilderRef` is the lowest possible level that avoids misuse (and avoids IPC messages if we were to do this in content process) while still keeping it from backend. Testing: There are tests in WPT Split of #36821 try run: https://github.com/sagudev/servo/actions/runs/15449044694 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
|
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#52971) with upstreamable changes. |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#52971). |
based on firefox code https://github.com/web-platform-tests/wpt/blob/2e547483d48c482395a801e2a82fdae5a60983e3/tools/wptrunner/wptrunner/browsers/firefox.py#L139 and web-platform-tests/wpt@9cc314e Testing: These are for testing Split of #36821 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This PR removes existing path(segment) abstractions in favor of `kurbo::BezPath`, well actually wrapped `kurbo::BezPath`, to ensure building of valid paths. This allows us better Path2D building in script and doing all validation and segmentation there and also allows us remove blocking is_point_in_path on Path2D as we can now do this in script. Current path is still done on canvas thread side as it will be harder to move to script (will be done as a follow up), but it now uses this new path abstraction. Using kurbo also allows us to ditch our manual svgpath parser with the one provided by kurbo. Same code is stolen from: #36821. Testing: Existing WPT tests Fixes: #37904 wpt run: https://github.com/sagudev/servo/actions/runs/16172191716 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
5d4d313 to
2870106
Compare
94bc0b0 to
e6df2f0
Compare
8e4d0de to
1c4cfbd
Compare
|
So many rebases to solve merge conflicts, most of which are actually my fault. |
jdm
left a comment
There was a problem hiding this comment.
I'm impressed! The new backend is really readable. You've done great work to improve all the canvas code for this change.
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
|
Heh, another rebase.
Yeah, that was the goal. Initial backend code was much larger and complicated. I was also able to upstream euclid <-> kurbo From/Into in kurbo, so that also helped. |
|
Congrats on landing this! |
Add vello backend by implementing Backend traits in canvas crate (so this lives in canvas_paint_thread - embedded process). Current implementation uses normal wgpu, so we block on GPU work. Vello backend is gated behind `vello` feature and `dom_canvas_vello_enabled` pref. Feature-wise this backend is on on par with raqote (sometimes better sometimes worse), but performance wise it's worse. ## Known vello problems: - image roundtrip does not work (fixed in linebender/vello#974) - linebender/vello#1066 (fixed) - clip layers are not working properly: linebender/vello#1061 - `/html/canvas/element/pixel-manipulation/2d.imageData.put.*` - `/html/canvas/element/path-objects/2d.path.clip.intersect.html` - linebender/vello#1056 - `/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html` - `kurbo::Cap::Butt` is defect (only visible with big lineWidth) linebender/vello#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 (linebender/vello#1063 (comment)): - `/html/canvas/element/path-objects/2d.path.rect.selfintersect.html` - There is currently no way to do put image properly in vello as we would need to ignore all clips and other stuff (we try to work around this on best effort basis) linebender/vello#1088 - `/html/canvas/element/pixel-manipulation/2d.imageData.put.*` - precision problems - `/html/canvas/element/path-objects/2d.path.stroke.scale2.html` - `/html/canvas/element/path-objects/2d.path.arc.scale.1.html` ## Known servo problems - bad performance due to blocking on GPU work - some get/put intensive tests `TIMEOUT` - proper shadow support (non-blocker as we already are living without it now) - support for rect shadow is there but unimplemented currently as that's the state in raqote Testing: `mach try vello` will run normal WPT (with raqote) + vello_canvas subsuite that runs only on `/html/canvas/element`. All subsuite expectations are stored separately. Fixes: servo#36823 Fixes: servo#35230 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Add vello backend by implementing Backend traits in canvas crate (so this lives in canvas_paint_thread - embedded process). Current implementation uses normal wgpu, so we block on GPU work. Vello backend is gated behind
vellofeature anddom_canvas_vello_enabledpref.Feature-wise this backend is on on par with raqote (sometimes better sometimes worse), but performance wise it's worse.
Known vello problems:
extend_mode_normalizedandextend_modelinebender/vello#974)/html/canvas/element/pixel-manipulation/2d.imageData.put.*/html/canvas/element/path-objects/2d.path.clip.intersect.html/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.htmlkurbo::Cap::Buttis defect (only visible with big lineWidth)Cap::Buttis rendered wrong linebender/vello#1063/html/canvas/element/line-styles/2d.line.cross.html/html/canvas/element/line-styles/2d.line.miter.acute.htmlCap::Buttis rendered wrong linebender/vello#1063 (comment)):/html/canvas/element/path-objects/2d.path.rect.selfintersect.html/html/canvas/element/pixel-manipulation/2d.imageData.put.*/html/canvas/element/path-objects/2d.path.stroke.scale2.html/html/canvas/element/path-objects/2d.path.arc.scale.1.htmlKnown servo problems
TIMEOUTTesting:
mach try vellowill run normal WPT (with raqote) + vello_canvas subsuite that runs only on/html/canvas/element. All subsuite expectations are stored separately.Fixes: #36823
Fixes: #35230