Forward component transfer filter to WebRender
Categories
(Core :: Graphics: WebRender, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: jrmuizel, Assigned: tnikkel)
References
Details
Attachments
(12 files, 4 obsolete files)
32.83 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
32.96 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
11.50 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
8.73 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
7.89 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
2.10 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
26.85 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
7.33 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
5.21 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
1.17 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
1.13 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
2.17 KB,
patch
|
gw
:
review+
|
Details | Diff | Splinter Review |
Updated•7 years ago
|
Updated•7 years ago
|
Reporter | ||
Updated•7 years ago
|
Reporter | ||
Updated•7 years ago
|
Assignee | ||
Comment 1•7 years ago
|
||
This just gets the data into webrender, it was a huge headache. Still need to actually write shaders to do the work.
Check point to see if I've done something horribly wrong.
Reporter | ||
Comment 2•7 years ago
|
||
Can you write a summary of your approach?
Assignee | ||
Comment 3•7 years ago
|
||
We use a WrFilterData on the C++ side to hold the filter values (and function types), it's just a collection of pointer/size pairs for the values. We change the thing we pass around in C++ from nsTArray<FilterOp> to WrFilterHolder which contains a nsTArray<FilterOp>, nsTArray<WrFilterData>, and a nsTArray whose sole purpose is to own the memory for the values in the nsTArray<WrFilterData>.
The format for stacking contexts in the built display list goes from
PushStackingContext item
push_iter of Vec<FilterOp>
to
SetFilterOps item
push_iter of Vec<FilterOp>
1st SetFilterData item
push_iter of array of func types
push_iter funcR values
push_iter funcG values
push_iter funcB values
push_iter funcA values
.
.
.
nth SetFilterData item
push_iter of array of func types
push_iter funcR values
push_iter funcG values
push_iter funcB values
push_iter funcA values
PushStackingContext item
We need separate a SetFilterData item for each filter because we can't push_iter a variable sized thing.
When we iterate over the built display list to flatten it we work similarly to how gradients work with a SetGradientStops item before the actual gradient item. So when we see SetFilterOps or SetFilterData we use them to fill out values on the built display list iterator but don't those items return them to the iterator user and instead continue iterating until we hit the PushStackingContext item, at which point to the iterator consumer it appears as those the FilterOps and FilterDatas were on the PushStackingContext item. (This part is trickier too since we need a TempFilterData type that just holds ItemRange's until we get the actual bytes later.)
This gets the data all the way to where we construct the PictureCompositeKey. I'm not sure if we can just stick all these vecs on the PictureCompositeKey or not because I haven't looked at how it is used yet.
Reporter | ||
Comment 4•7 years ago
|
||
Reporter | ||
Updated•7 years ago
|
Assignee | ||
Updated•7 years ago
|
Assignee | ||
Comment 5•7 years ago
|
||
Assignee | ||
Comment 6•7 years ago
|
||
Assignee | ||
Comment 7•7 years ago
|
||
Can you direct this review to someone more appropriate if that person is not you?
Assignee | ||
Comment 8•7 years ago
|
||
Assignee | ||
Comment 9•7 years ago
|
||
Assignee | ||
Comment 10•7 years ago
|
||
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
Comment 13•7 years ago
|
||
Comment 14•7 years ago
|
||
It'd be great to add a small number of wrench reftests for this functionality too (unless I missed that in one of the patches I didn't look at).
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Assignee | ||
Comment 15•6 years ago
|
||
Assignee | ||
Comment 16•6 years ago
|
||
Assignee | ||
Comment 17•6 years ago
|
||
Assignee | ||
Comment 18•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 19•6 years ago
|
||
Assignee | ||
Comment 20•6 years ago
|
||
Comment 21•6 years ago
|
||
Comment 22•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 23•6 years ago
|
||
Updated•6 years ago
|
Comment 24•6 years ago
|
||
Comment 25•6 years ago
|
||
Looks good! There are a few nits / questions, but most of them can be left and handled as follow ups in the future. My only real question is the Hash/Eq on the Handle type - I don't this is needed? It'd also be great to add a few wrench reftests of this functionality, although again, that can be done as a follow up. Thanks!
Assignee | ||
Comment 26•6 years ago
|
||
(In reply to Glenn Watson [:gw] from comment #21)
::: gfx/wr/webrender/src/intern.rs
@@ +78,5 @@}
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
+#[derive(Debug, Copy, Clone, MallocSizeOf, PartialEq, Hash, Eq)]Why do we need to add Hash/Eq to this?
We put FilterDataHandle (== intern_types::filterdata::Handle) into the PictureCompositeKey enum and the PictureCompositeMode enum. PictureCompositeMode has PartialEq, and PictureCompositeKey has PartialEq, Hash, Eq. So we need PartialEq, Hash, Eq on Handle and Epoch since it's in Handle. Is there a better way to do it?
Comment 27•6 years ago
|
||
Yup, at least in theory. If what I've written below doesn't make sense / or doesn't seem easy to make work, let me know and I'll take a closer look or we can discuss the details on IRC.
The current problem is roughly that:
The PictureCompositeKey is hashable so that we can identify pictures that have the same content / filters, for purposes of invalidating cached tiles etc. If we store intern::Handle in that, the cache key will often change, because intern::Handle has items like an epoch in it, that get updated per-frame.
What we ideally want to do (and I'm not sure if there's gotchas here) is:
-
Store the unique identifier of the filter in PictureCompositeKey. We can do this by calling handle.uid(). This returns the constant part of an interned handle that uniquely identifies the interned content. The ItemUid returned by that method implements Hash and Eq, so that it can be used directly in PictureCompositeKey.
-
It should be fine to store the full handle in PictureCompositeMode enum, I think. This enum doesn't need to be hashed, so it doesn't have those strict requirements. The current PictureCompositeMode enum does require PartialEq, but I just tested locally and that's not actually needed (it compiles if I remove it). So hopefully, if you remove PartialEq from PictureCompositeMode, you should be able to store the intern::Handle in there.
The part that I'm a bit uncertain on is whether the first change above might mean that the complete handle is not currently available where/when the PictureCompositeMode enum is constructed. If that's the case, we might be able to fix that by using the extra scene data struct that's available for interner use (which is currently a () in your patch)?
Assignee | ||
Comment 28•6 years ago
|
||
This diff works. Seems far too easy. Maybe I'm missing something.
Comment 29•6 years ago
|
||
Assignee | ||
Comment 30•6 years ago
|
||
Comment 31•6 years ago
|
||
Yup, ship it!
Updated•6 years ago
|
Assignee | ||
Comment 32•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Comment 33•6 years ago
|
||
PictureKey contains a Picture so we need to increase it's size expectation too.
Updated•6 years ago
|
Assignee | ||
Comment 34•6 years ago
|
||
For some reason this fixes the wrench reftest on Windows (works fine without this change on linux/mac). I don't understand it. Is this sane?
Comment 35•6 years ago
|
||
Comment 36•6 years ago
|
||
Comment 37•6 years ago
|
||
Backed out 10 changesets (Bug 1505871) for wrench bustages CLOSED TREE
Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=230454693&repo=mozilla-inbound
Backout: https://hg.mozilla.org/integration/mozilla-inbound/rev/3c030119c0dcf447dd1afe7165b2d6846a0bc7f0
Comment 38•6 years ago
|
||
Comment 39•6 years ago
|
||
Assignee | ||
Comment 40•6 years ago
|
||
The original failure was because there is a test to make sure shaders contain a default case for all switch statements. The test isn't smart and it just string matches "switch" and "default:" even in comments, since I used the word switch in a comment this caused it to fail.
Comment 41•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cdcc424f1da3
https://hg.mozilla.org/mozilla-central/rev/f499cb201bd6
https://hg.mozilla.org/mozilla-central/rev/bc60982f2828
https://hg.mozilla.org/mozilla-central/rev/30cb5423d03f
https://hg.mozilla.org/mozilla-central/rev/e1f278d901a7
https://hg.mozilla.org/mozilla-central/rev/461c14f8a14c
https://hg.mozilla.org/mozilla-central/rev/457a27c7b181
https://hg.mozilla.org/mozilla-central/rev/1562b43107f2
https://hg.mozilla.org/mozilla-central/rev/55ba29bf61f0
https://hg.mozilla.org/mozilla-central/rev/30f9e207c3d4
https://hg.mozilla.org/mozilla-central/rev/44192297e3ae
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•5 years ago
|
Description
•