-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] dont print format strings for blend filter and snapshots. #57105
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,6 @@ | |
| #include <optional> | ||
| #include <utility> | ||
|
|
||
| #include "impeller/base/strings.h" | ||
|
|
||
| namespace impeller { | ||
|
|
||
| ContentsFilterInput::ContentsFilterInput(std::shared_ptr<Contents> contents, | ||
|
|
@@ -18,7 +16,7 @@ ContentsFilterInput::ContentsFilterInput(std::shared_ptr<Contents> contents, | |
| ContentsFilterInput::~ContentsFilterInput() = default; | ||
|
|
||
| std::optional<Snapshot> ContentsFilterInput::GetSnapshot( | ||
| const std::string& label, | ||
| std::string_view label, | ||
| const ContentContext& renderer, | ||
| const Entity& entity, | ||
| std::optional<Rect> coverage_limit, | ||
|
|
@@ -27,14 +25,14 @@ std::optional<Snapshot> ContentsFilterInput::GetSnapshot( | |
| coverage_limit = entity.GetContents()->GetCoverageHint(); | ||
| } | ||
| if (!snapshot_.has_value()) { | ||
| snapshot_ = contents_->RenderToSnapshot( | ||
| renderer, // renderer | ||
| entity, // entity | ||
| coverage_limit, // coverage_limit | ||
| std::nullopt, // sampler_descriptor | ||
| msaa_enabled_, // msaa_enabled | ||
| /*mip_count=*/mip_count, | ||
| SPrintF("Contents to %s Filter Snapshot", label.c_str())); // label | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of removing this argument, can we just send the argument directly here. That way we'd remove the sprintf but keep valuable debugging information?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It always gets sprintf'd with the existing texture label. I just don't think these are useful - you can already see the pipeline in the debugger. and if we do find out we need them its easy to add back.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are printed out in validation logs too, you won't always have the opportunity to inspect the pipeline. Where ever it is getting sprintf's? We should be able to just take a string verbatim instead of trying to modify it. That's more useful than having no label. If we are trying to debug a customer's issue it won't be easy to add them back in.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gaaclarke do you use this feature? I don't . If it turns out to be useful, we can add it back.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I've benefited from having debug labels when responding to a warning printed out from validation layers. We've had vulkan in a good state for a while I think we've forgotten how useful they can be. Respectfully, I think you are throwing out the baby with the bath water. The expensive part is the sprintf/malloc/free calls, not the actual labelling. I'd rather we throw those out first and remeasure.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a baby or bathwater. its a debug label. If we need it, we can add it back.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we keep the string literals in the source code and conditionally use them? Then the compiler will just rip them out if they aren't used. They aren't going to be easy to bring back. Bringing them back would be recreating something we already had, it will be easier for us to just maintain them. Any patch will bit rot pretty fast.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You PR that landed today basically did that, right? It makes it so naming textures is a noop, so can we just keep the literals in the code to make them easy to turn on? |
||
| snapshot_ = contents_->RenderToSnapshot(renderer, // renderer | ||
| entity, // entity | ||
| coverage_limit, // coverage_limit | ||
| std::nullopt, // sampler_descriptor | ||
| msaa_enabled_, // msaa_enabled | ||
| /*mip_count=*/mip_count, // | ||
| label // | ||
| ); | ||
| } | ||
| return snapshot_; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,20 +18,19 @@ FilterContentsFilterInput::FilterContentsFilterInput( | |
| FilterContentsFilterInput::~FilterContentsFilterInput() = default; | ||
|
|
||
| std::optional<Snapshot> FilterContentsFilterInput::GetSnapshot( | ||
| const std::string& label, | ||
| std::string_view label, | ||
| const ContentContext& renderer, | ||
| const Entity& entity, | ||
| std::optional<Rect> coverage_limit, | ||
| int32_t mip_count) const { | ||
| if (!snapshot_.has_value()) { | ||
| snapshot_ = filter_->RenderToSnapshot( | ||
| renderer, // renderer | ||
| entity, // entity | ||
| coverage_limit, // coverage_limit | ||
| std::nullopt, // sampler_descriptor | ||
| true, // msaa_enabled | ||
| /*mip_count=*/mip_count, | ||
| SPrintF("Filter to %s Filter Snapshot", label.c_str())); // label | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| snapshot_ = filter_->RenderToSnapshot(renderer, // renderer | ||
| entity, // entity | ||
| coverage_limit, // coverage_limit | ||
| std::nullopt, // sampler_descriptor | ||
| true, // msaa_enabled | ||
| /*mip_count=*/mip_count, // | ||
| label); // label | ||
| } | ||
| return snapshot_; | ||
| } | ||
|
|
||
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.
👍