Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] finish migration to new render pass API. #49740

Merged
merged 6 commits into from
Jan 12, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Jan 12, 2024

Part of flutter/flutter#140804

Migrate the rest of the commands in impeller to use the new API. Hide RenderPass::AddCommand. On subsequent changes I will be able to begin making some of these methods virtual so we can add more direct pass through. Though the vulkan backend will be blocked on changes to descriptor sets: #49686

cmd.stencil_reference = entity.GetClipDepth();
auto options = OptionsFromPass(pass);
cmd.pipeline = renderer.GetPorterDuffBlendPipeline(options);
#ifdef IMPELLER_DEBUG
Copy link
Member Author

Choose a reason for hiding this comment

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

I only added ifdefs where we do runtime string creation.

Copy link
Member

Choose a reason for hiding this comment

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

I prefer the macro style we had previously. Did you find the string creation wasn't getting stripped out?

FWIW this could be transformed to a static string too since we only have so many blend modes. I did that at some point but the PR got caught up and dropped.

Copy link
Member Author

Choose a reason for hiding this comment

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

Strings were still getting formatted, then dropped. We could add more static strings for these, I wouldn't be opposed. Feedback I got on the macro approach was that everyone hated it 😆

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.

LGTM, there is just one spot where there might be an accident logic change. Also, this introduces string copies which I think you were trying to avoid so maybe it's better to use the macro function still to set the debug labels.

cmd.stencil_reference = entity.GetClipDepth();
auto options = OptionsFromPass(pass);
cmd.pipeline = renderer.GetPorterDuffBlendPipeline(options);
#ifdef IMPELLER_DEBUG
Copy link
Member

Choose a reason for hiding this comment

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

I prefer the macro style we had previously. Did you find the string creation wasn't getting stripped out?

FWIW this could be transformed to a static string too since we only have so many blend modes. I did that at some point but the PR got caught up and dropped.

cmd.pipeline = renderer.GetClipPipeline(options);
pass.AddCommand(Command(cmd));
pass.SetPipeline(renderer.GetClipPipeline(options));
pass.SetStencilReference(entity.GetClipDepth());
Copy link
Member

Choose a reason for hiding this comment

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

Is this difference intentional? This used to be set outside of the conditional.

Copy link
Member Author

Choose a reason for hiding this comment

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

It shouldn't actually matter, this one is redundant since I call Draw immediately below.

if (label_.empty()) {
DEBUG_COMMAND_INFO(cmd, "Texture Fill");
pass.SetCommandLabel("Texture Fill");
Copy link
Member

Choose a reason for hiding this comment

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

You just set it to the unnamed label in non debug builds.

Copy link
Member Author

Choose a reason for hiding this comment

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

It will get dropped anyway, because SetCommandLabel will no-op

@@ -396,8 +397,7 @@ bool AtlasTextureContents::Render(const ContentContext& renderer,
return true;
}

Command cmd;
DEBUG_COMMAND_INFO(cmd, "AtlasTexture");
pass.SetCommandLabel("AtlasTexture");
Copy link
Member

Choose a reason for hiding this comment

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

FYI this is still incurring a copy because the parameter takes a std::string.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

RenderPass::OnSetLabel takes an std::string, it doesn't hit that?

Copy link
Member Author

Choose a reason for hiding this comment

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

RenderPass label vs Command label

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should rename SetCommandLabel at some point since the concept of Command has been eliminated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think that it would be better if the RenderPass label was provided during construction instead of via a Setter. Then we just need "SetLabel"

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.

lgtm with nit about being able to have static debug labels as a fallback

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 12, 2024
@auto-submit auto-submit bot merged commit 35336ad into flutter:main Jan 12, 2024
28 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 12, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 12, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 12, 2024
…141489)

flutter/engine@418c9e9...b8e5d47

2024-01-12 jonahwilliams@google.com [Impeller] move TrackedObjectsVK to separate file. (flutter/engine#49773)
2024-01-12 54558023+keyonghan@users.noreply.github.com Add gclient_variables back for linux_license and fix the excluded files (flutter/engine#49775)
2024-01-12 jonahwilliams@google.com [Impeller] Descriptor pool incremental allocation. (flutter/engine#49686)
2024-01-12 zanderso@users.noreply.github.com Relands: Refactors RBE support (flutter/engine#49660)
2024-01-12 jonahwilliams@google.com [Impeller] finish migration to new render pass API. (flutter/engine#49740)
2024-01-12 jonahwilliams@google.com [Impeller] remove Buffer type and associated abstractions. (flutter/engine#49702)
2024-01-12 54558023+keyonghan@users.noreply.github.com Remove `gclient_variables` from `linux_license.json` (flutter/engine#49766)

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 bdero@google.com,rmistry@google.com,zra@google.com 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
@jonahwilliams jonahwilliams deleted the finish_cmd_migration branch January 18, 2024 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants