[Impeller] Avoid sharing scale information between TextFrame rendering calls#182539
[Impeller] Avoid sharing scale information between TextFrame rendering calls#182539flar wants to merge 3 commits into
Conversation
…t-frame-no-render-data-sharing
|
I'm seeing some flashing text running Wondrous that I need to investigate... |
|
I tracked the problem down to a mismatch of the drawText operations encountered during the FirstPass and the eventual Render pass. See #182639 for a full writeup. It looks like the cull rects we use when traversing the Frame's DL during the FirstPass can sometimes be larger than the cull rects we use during the rendering pass. Log of cull rects encountered during a Wondrous frame that skipped a drawText call |
|
I've implemented a basic workaround for the issue I discovered while debugging the Wondrous behavior. I basically just skip RenderTextFrames until I find one that is appropriate for the call site, but...
An interesting side note - if we pass this information as a map then we could save it from frame to frame and avoid having to recompute bounds. Unfortunately, bounds are computed in device space and are sub-pixel based in some cases so this idea would only work for static text that isn't scrolling. |
|
Closing in favor of a better solution in #182886 |
Impeller has been storing rendering data specific to a single invocation of a text operation in the TextFrame object itself. Unfortunately, the TextFrame lives (most commonly, especially in a Flutter app) in the DisplayList which should be an immutable data store. Even more importantly, DisplayLists can be shared and appear multiple times in different graphics contexts within a single frame. This potentially means that Impeller might store "this TextFrame is rendering at a scale of 2x" and "this TextFrame is rendering at a scale of 50x" into the same TextFrame object in the same scene and then try to render that TextFrame with the most recently stored information for both instances. This issue was discovered during a code read of the way that glyph caches are managed in Impeller as mentioned in the targeted issue:
Fixes: #177424
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.