Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Nov 22, 2023

No point in passing by value and moving, just pass a const ref through. Trivial performance improvement.

Before

  /// Bind uniform buffer for resource named FragInfo.
  static bool BindFragInfo(ResourceBinder& command, BufferView view) {
    return command.BindResource(ShaderStage::kFragment, kResourceFragInfo, kMetadataFragInfo, std::move(view));
  }

  /// Bind combined image sampler for resource named texture_sampler.
  static bool BindTextureSampler(ResourceBinder& command, std::shared_ptr<const Texture> texture, std::shared_ptr<const Sampler> sampler) {
    return command.BindResource(ShaderStage::kFragment, kResourceTextureSampler, kMetadataTextureSampler, std::move(texture), std::move(sampler));
  }

After

  /// Bind uniform buffer for resource named FragInfo.
  static bool BindFragInfo(ResourceBinder& command, const BufferView& view) {
    return command.BindResource(ShaderStage::kFragment, kResourceFragInfo, kMetadataFragInfo, view);
  }

  /// Bind combined image sampler for resource named texture_sampler.
  static bool BindTextureSampler(ResourceBinder& command, const std::shared_ptr<const Texture>& texture, const std::shared_ptr<const Sampler>& sampler) {
    return command.BindResource(ShaderStage::kFragment, kResourceTextureSampler, kMetadataTextureSampler, texture, sampler);
  }

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not guaranteed that this will execute faster. The move may be faster than the reference. It's the cost of the move versus the indirection of accessing by reference.

@jonahwilliams
Copy link
Contributor Author

But we're not moving into this function, nor is BindResource moving - it takes a reference.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, bind is just taking a reference? The we move just to take a reference anyways? Okay.

@jonahwilliams
Copy link
Contributor Author

Yeah, i think originally it all moved - then the clang tidy lints told us to make Bind take a reference, but it left this since it is generated code.

@Hixie
Copy link
Contributor

Hixie commented Nov 22, 2023

test-exempt: code gen change

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 22, 2023
@auto-submit auto-submit bot merged commit d51c75c into flutter:main Nov 22, 2023
@jonahwilliams jonahwilliams deleted the extra_move branch November 22, 2023 20:04
@jonahwilliams jonahwilliams added the revert Label used to revert changes in a closed and merged pull request. label Nov 22, 2023
@jonahwilliams
Copy link
Contributor Author

Revert added as there are lint failures in compute tessellator.

auto-submit bot pushed a commit that referenced this pull request Nov 22, 2023
@auto-submit auto-submit bot removed the revert Label used to revert changes in a closed and merged pull request. label Nov 22, 2023
auto-submit bot added a commit that referenced this pull request Nov 22, 2023
Reverts #48318
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
No point in passing by value and moving, just pass a const ref through. Trivial performance improvement.

# Before
```cpp
  /// Bind uniform buffer for resource named FragInfo.
  static bool BindFragInfo(ResourceBinder& command, BufferView view) {
    return command.BindResource(ShaderStage::kFragment, kResourceFragInfo, kMetadataFragInfo, std::move(view));
  }

  /// Bind combined image sampler for resource named texture_sampler.
  static bool BindTextureSampler(ResourceBinder& command, std::shared_ptr<const Texture> texture, std::shared_ptr<const Sampler> sampler) {
    return command.BindResource(ShaderStage::kFragment, kResourceTextureSampler, kMetadataTextureSampler, std::move(texture), std::move(sampler));
  }
  ```

# After
```cpp
  /// Bind uniform buffer for resource named FragInfo.
  static bool BindFragInfo(ResourceBinder& command, const BufferView& view) {
    return command.BindResource(ShaderStage::kFragment, kResourceFragInfo, kMetadataFragInfo, view);
  }

  /// Bind combined image sampler for resource named texture_sampler.
  static bool BindTextureSampler(ResourceBinder& command, const std::shared_ptr<const Texture>& texture, const std::shared_ptr<const Sampler>& sampler) {
    return command.BindResource(ShaderStage::kFragment, kResourceTextureSampler, kMetadataTextureSampler, texture, sampler);
  }
  ```
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 22, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 22, 2023
…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
caseycrogers pushed a commit to caseycrogers/flutter that referenced this pull request Dec 29, 2023
…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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants