-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] cache render target properties on Render Pass. #48323
[Impeller] cache render target properties on Render Pass. #48323
Conversation
| RenderPass::RenderPass(std::weak_ptr<const Context> context, | ||
| const RenderTarget& target) | ||
| : context_(std::move(context)), | ||
| sample_count_(target.GetSampleCount()), |
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.
This could potentially lead to bugs since a RenderTarget's result to GetSampleCount isn't const. A call to RenderTarget::SetColorAttachment can change the results of GetSampleCount. Can we instead cache the result on the RenderTarget? There we have the knowledge to know if it has become stale.
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.
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.
Okay, I just saw the copy. This should be good. Can you add a comment to before these cached values why it is safe to cache this values. That at least gives a breadcrumb in case someone changes render_pass to a shared_ptr or something. Something like "These values are cached for performance and are safe since RenderPass owns a const copy of the RenderTarget".
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.
Done!
gaaclarke
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 modulo a comment since someone could easily make this thing that is safe, not safe.
|
Thanks @gaaclarke ! |
…ions) (#138918) Manual roll requested by [email protected] flutter/engine@342fb00...f331e0a 2023-11-22 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] pass const ref to binding helpers." (flutter/engine#48330) 2023-11-22 [email protected] Revert "Manual roll Dart SDK from f1fd14505782 to df958dc1ca7b (6 revisions)" (flutter/engine#48325) 2023-11-22 [email protected] [Impeller] cache render target properties on Render Pass. (flutter/engine#48323) 2023-11-22 [email protected] [Impeller] pass const ref to binding helpers. (flutter/engine#48318) 2023-11-22 [email protected] Roll Skia from 994558cd1fae to 30ecaac60b47 (1 revision) (flutter/engine#48324) 2023-11-22 [email protected] Roll Skia from 9086788fc341 to 994558cd1fae (1 revision) (flutter/engine#48322) 2023-11-22 [email protected] Expose a few more glyph apis from `ui.Paragraph` (flutter/engine#47698) 2023-11-22 [email protected] Roll Skia from efdec1f459ce to 9086788fc341 (2 revisions) (flutter/engine#48317) 2023-11-22 [email protected] Manual roll Dart SDK from f1fd14505782 to df958dc1ca7b (6 revisions) (flutter/engine#48316) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ions) (flutter#138918) Manual roll requested by [email protected] flutter/engine@342fb00...f331e0a 2023-11-22 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] pass const ref to binding helpers." (flutter/engine#48330) 2023-11-22 [email protected] Revert "Manual roll Dart SDK from f1fd14505782 to df958dc1ca7b (6 revisions)" (flutter/engine#48325) 2023-11-22 [email protected] [Impeller] cache render target properties on Render Pass. (flutter/engine#48323) 2023-11-22 [email protected] [Impeller] pass const ref to binding helpers. (flutter/engine#48318) 2023-11-22 [email protected] Roll Skia from 994558cd1fae to 30ecaac60b47 (1 revision) (flutter/engine#48324) 2023-11-22 [email protected] Roll Skia from 9086788fc341 to 994558cd1fae (1 revision) (flutter/engine#48322) 2023-11-22 [email protected] Expose a few more glyph apis from `ui.Paragraph` (flutter/engine#47698) 2023-11-22 [email protected] Roll Skia from efdec1f459ce to 9086788fc341 (2 revisions) (flutter/engine#48317) 2023-11-22 [email protected] Manual roll Dart SDK from f1fd14505782 to df958dc1ca7b (6 revisions) (flutter/engine#48316) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Otherwise we do three hashmap lookups everything we call OptionsFromPass(AndEntity) in a contents.
Before
16 / 392 = 4%
After
6/ 458 = 1.3%