Support SVG filter primitive subregions in WebRender
Categories
(Core :: Graphics: WebRender, task, P3)
Tracking
()
People
(Reporter: cbrewster, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 1 obsolete file)
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 2•5 years ago
|
||
Yes, I am still working on this, but if this is high priority I'm okay if someone wants to steal it.
Comment 3•5 years ago
|
||
We don't have anyone available to steal it, so it's all yours :)
Comment 4•5 years ago
|
||
Any news on this? Is the work you've done available anywhere? Looking at the linked spec, it looks like this is just defining another way of adding clip-rects to something, but I'm guessing it's more complicated than that?
Reporter | ||
Comment 5•5 years ago
|
||
Unfortunately, I haven't been able to devote as much time to this as I had hoped. I don't have a patch that got very far on this, but I can share what I had in mind.
I think you could get pretty far with adding clip-rects after each filter operation, but I don't think that alone is sufficient to support all possible SVG filters. Primarily, the issue I hit was that some SVG filter primitives require 2 inputs which allows you to create directed acyclic graphs with filter primitives. I found this difficult to represent in a WR scene since a scene is more of a tree. There currently some SVG filter stuff that I landed in WR (that Gecko doesn't use yet), and it processes the SVG filter in the render task graph instead of the scene since the render task graph can better represent complex SVG filter graphs. Since clip-rects are at the scene-level, I don't think they can be used here. So my plan was to add filter primitive subregion info to the SVG filter render tasks and provide those to the svg filter shaders so they can properly sample their inputs based on the subregion rules in the spec.
When I worked SVG filter support in WR during my internship this summer, I wrote down some notes as I went along: https://paper.dropbox.com/doc/WebRender-SVG-Filters--AuSX4~oBSNemlM0JKMJNebj2AQ-sSQSLopPODYlg7Lqzw9PZ
It is a bit of a brain dump, so it may or may not be very helpful.
Reporter | ||
Comment 6•5 years ago
|
||
Here's a high level view of where SVG filter are at so far:
WR API:
https://searchfox.org/mozilla-central/source/gfx/wr/webrender_api/src/display_item.rs#824-1005
Scene Building:
Create a single picture with an SVG filter composite mode with a list of filter primitives
https://searchfox.org/mozilla-central/source/gfx/wr/webrender/src/scene_building.rs#3544-3612
Render Task Creation:
Picture composite mode handling
https://searchfox.org/mozilla-central/source/gfx/wr/webrender/src/picture.rs#4499-4534
Filter primitive render task creation
https://searchfox.org/mozilla-central/source/gfx/wr/webrender/src/render_task.rs#842-1159
Shader:
https://searchfox.org/mozilla-central/source/gfx/wr/webrender/res/cs_svg_filter.glsl
Like I said, none of this is currently being used by Gecko at the moment, so feel free to take it in a different direction.
Reporter | ||
Comment 7•5 years ago
|
||
This patch adds support for filter primitive subregions within WebRender.
Filter primitive sizing is based off of Gecko's SVG filter implementation.
This patch also includes some modifications to surface filter inflation
and raster root surface scaling.
Reporter | ||
Comment 8•5 years ago
|
||
Depends on D69935
Reporter | ||
Comment 9•5 years ago
|
||
This is getting close to being ready for review, there are a few remaining pieces:
- Limit the size of SVG filter tasks.
- Fix a few cases of incorrect clipping within SVG tasks.
- Provide unrounded subregions to WebRender from Gecko as these shouldn't be rounded until transform scale factors have been applied within WebRender.
- Write more wrench reftests to exercise more edge cases.
Comment 10•5 years ago
|
||
Comment on attachment 9139064 [details]
Bug 1573657: Use nsDisplayFilter child bounds and paint rect when doing WebRender grouping
Revision D70147 was moved to bug 1573994. Setting attachment 9139064 [details] to obsolete.
Reporter | ||
Comment 11•5 years ago
|
||
WebRender expects subregions as unrounded floating-point values.
Prior to this, Gecko rounded filter primitive subregions immediately.
This change stores filter primitive subregions as unrounded float rects and adds
a helper method to round the subregion or filter region when needed.
There may be some extra overhead due to rounding on demand, if it is significant,
both the rounded and unrounded rects could be stored on the primitive description.
Depends on D70147
Reporter | ||
Comment 12•4 years ago
|
||
Unfortunately, I don't think I'll have time in the near future to bring this to completion. If someone wants to pick up where I left off, feel free to ping me with any questions.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 13•10 months ago
|
||
This bug is made largely obsolete by Bug 1824502 where I reimplemented a more complete set of SVG filters with subregion support (and let me tell you, that was hard).
Comment 14•4 months ago
|
||
Duping to bug 1824502 based on comment #13.
:ahale, feel free to undupe if you disagree.
Description
•