-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Share LazyGlyphAtlas across EntityPass #38244
Conversation
jonahwilliams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I understand the change that this PR is trying to make.
LazyGlyphAtlas is attached to the entity pass allowing it to be used across multiple text content canvas operations. Moving it to the canvas makes it harder to reuse.
|
Hi @jonahwilliams |
|
Oh I see, sorry I misunderstood. yes that will accomplish reuse. We're going to end up with a few more objects that can be shared across entity pass, the tesselator to start with, and at some point some sort of geometry cache too. Is canvas.cc a reasonable place to put these for now, or should we create a separate class to hold them @chinmaygarde ? |
|
From PR review triage: @jonahwilliams Do you have any thoughts about this PR? |
|
Old comment stands:
|
|
Thanks @jonahwilliams. Sounds like this one is waiting for an answer from @chinmaygarde |
|
I think it was setup this way because we expected to use an atlas per pass with the passes being setup concurrently from multiple threads. This will get in the way of that effort but we can rework that when the time comes. |
|
That seems like a reason to hold off on this. I think what I'd like to know is if we have multiple passes (due to a platform view), does each pass collect glyphs for only their own pass - or all passes? If its the former, we might not want to make this change. |
Sorry for my poor knowledge about that. Emm but why do platform views need to collect glyphs for only in their pass ? |
|
not the platform view, but when there is a platform view in the tree the scene is divided in two. I'm unsure if each part collects glyphs individually or not |
|
Got you. I m also not very sure on that........ @chinmaygarde maybe more know about this? Would you mind sharing your thought on that. O(∩_∩)O |
|
I can do some research into that later this week. Either way, I'd be a bit concerned that the different passes would step on each other if they shared a glyph atlas. The only way to make that work would be to collect the glyphs for all passes up front. |
|
Thinking a bit more about this, I don't think this is the model we want to go with for multiple passes. For one, this will make encoding multiple passes concurrently harder. But I am also not sure how this works when we submit one pass but keep adding to the texture atlas referenced by it for subsequent passes. Closing this but will keep it referenced in the icebox for when we think about improving atlas management. |
|
I think we should revisit this. its true it may not be the ideal behavior when platform views are involved, but actually today we're doing much worse than we should when there are multiple entity passes because we end up re-creating the glyph atlas N times per frame. this is part of the issue in flutter/flutter#121476 So LGTM to me, if @chinmaygarde is OK with it |
jonahwilliams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@luckysmg if you're able to update the tests I think we can land this. |
|
sgtm |
List which issues are fixed by this PR. You must list at least one issue.
flutter/flutter#116815
Now, every
EntityPasswill create a singleLazyGlyphAtlasto use inCanvas::DrawTextFrame, but it seems that there is no need for creating aLazyGlyphAtlasfor perEntityPass, and I think maybe we can create a singleLazyGlyphAtlasto reuse it acrossEntityPass.Pre-launch Checklist
///).