-
Notifications
You must be signed in to change notification settings - Fork 6k
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] Migrate all ColorSourceContents to use a shared rendering routine. #50261
[Impeller] Migrate all ColorSourceContents to use a shared rendering routine. #50261
Conversation
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 "@test-exemption-reviewer" in 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. |
Pushing up before doing the full refactor to see those goldens. This might end up living in |
I refactored this to live in |
test-exempt: refactor |
template <typename VertexShaderT> | ||
bool DrawPositionsAndUVs( | ||
Rect texture_coverage, | ||
Matrix effect_transform, |
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.
Matrix effect_transform, | |
const Matrix& effect_transform, |
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.
RenderPass& pass, | ||
const PipelineBuilderMethod& pipeline_builder, | ||
typename VertexShaderT::FrameInfo frame_info, | ||
const BindFragmentCallback& bind_pipeline_callback) const { |
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.
Alternative suggestion, make color source contents have a virtual BindFragmentCallback
method and make this call it. If we have to pass a closure for non trivial cases then its going to end up closing over the entire contents anyway.
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.
Seems like a good approach. Done.
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.
Uhh actually applying this to my follow-up patch is a painful because we have multiple rendering branches for all of the gradients that need different binding behavior.
In all of the use cases we can capture the things we need by reference, and my understanding is that assigning a lambda to a stack std::function
shouldn't heap allocate as long as the set of captures is reasonably small.
One sec, gonna check this...
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.
The different gradients are basically different content classes though
if the contents is less verbose with this change it would make more sense to split them in two IMO.
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.
Briefly discussed offline, we can just switch this out later if necessary / ends up being too annoying. Some legit concerns over expanding our use of std::function
, like annoying stack traces, compiler differences, etc.
bool DrawPositions(const ContentContext& renderer, | ||
const Entity& entity, | ||
RenderPass& pass, | ||
const PipelineBuilderMethod& pipeline_builder, |
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.
Same here, can pipeline_builder be a virtual method on ColorSourceContents?
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.
c297203
to
19b60ea
Compare
1861b24
to
9b882af
Compare
std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline = | ||
pipeline_callback(options); | ||
pass.SetPipeline(pipeline); |
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.
Either move into SetPipeline or inline the call to avoid the additional shared_ptr release.
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.
Oopsies, done.
auto geometry_result = | ||
GetGeometry()->GetPositionBuffer(renderer, entity, pass); | ||
|
||
return DrawGeometry<VertexShaderT>(geometry_result, renderer, entity, pass, |
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.
return DrawGeometry<VertexShaderT>(geometry_result, renderer, entity, pass, | |
return DrawGeometry<VertexShaderT>(std::move(geometry_result), renderer, entity, pass, |
geometry_result contains shared_ptrs in the buffer views, should be moved.
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.
auto geometry_result = GetGeometry()->GetPositionUVBuffer( | ||
texture_coverage, effect_transform, renderer, entity, pass); | ||
|
||
return DrawGeometry<VertexShaderT>(geometry_result, renderer, entity, pass, |
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.
return DrawGeometry<VertexShaderT>(geometry_result, renderer, entity, pass, | |
return DrawGeometry<VertexShaderT>(std::move(geometry_result), renderer, entity, pass, |
Same here
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.
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
9cad64c
to
9792f6d
Compare
Okay, let's see how those goldens turn out, but all the color sources are done. |
Golden file changes are available for triage from new commit, Click here to view. |
Oh, the changed goldens are gone! |
bd03152
to
fa205f4
Compare
This reverts commit e4f5235.
fa205f4
to
ccd8718
Compare
I force pushed like a bad boy but let's see what happens. |
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!
Golden file changes are available for triage from new commit, Click here to view. |
It looks like this is failing on the tests added for #45308 |
Yup. Only for Vulkan though, which is peculiar. |
Something funky is going on with this test. No fragment stage uniforms are getting bound for either Vulkan or Metal. |
nvm, it is binding a struct. |
This was a silly ordering bug. |
…143425) flutter/engine@215d55f...0849250 2024-02-14 [email protected] [Impeller] replaces golden file count with a golden diff file (flutter/engine#50621) 2024-02-14 [email protected] [Impeller] Migrate all ColorSourceContents to use a shared rendering routine. (flutter/engine#50261) 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
This is going to be our "in" for performing StC in all the ColorSourceContents when necessary.
No semantic change.