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

Add a display list op to clear the transformation stack. #32050

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

chinmaygarde
Copy link
Member

This allows for the implementation of the
DisplayListCanvasRecoder::didSetM44. Instead of another operation that
clears the transformation stack along with setting a new transformation
on it. A single no-payload operation that clears the stack is added.
Existing ops to push to the stack are then reused.

@chinmaygarde
Copy link
Member Author

This patch has a friend in Impeller that I'll land at the same time.

chinmaygarde added a commit to chinmaygarde/impeller that referenced this pull request Mar 15, 2022
chinmaygarde added a commit to chinmaygarde/impeller that referenced this pull request Mar 15, 2022
Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM

@chinmaygarde chinmaygarde changed the title Add a display list op to clear to transformation stack. Add a display list op to clear the transformation stack. Mar 15, 2022
@@ -152,6 +152,11 @@ void SkMatrixDispatchHelper::transformFullPerspective(

// clang-format on

void SkMatrixDispatchHelper::transformReset() {
matrix_ = {};
matrix33_ = {};
Copy link
Member Author

@chinmaygarde chinmaygarde Mar 15, 2022

Choose a reason for hiding this comment

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

Hmm, I think saved_ needs to be cleared as well. And, I think there is a bug here where calling an imbalaned restore will call pop_back on an empty vector which is undefined behavior.

Fixing both issues.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nevermind. I can't confirm this.

Copy link
Contributor

Choose a reason for hiding this comment

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

SkMatrixDispatchHelper already has a reset() method. I'm not sure if it is used any more (I used to collect saveLayer bounds in their native coordinate space, but had to back off on that due to bugs).

You don't want saved_ to be cleared, if they restore() then they should undo the reset. The set to identity should not escape the enclosing save/restore.

There probably should be a protection here for over-restore, but the caller generally already does that. It would be redundant for existing use cases, but we shouldn't rely on that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

I think it should be resetTransform rather than transformReset, but other than that it's pretty straightforward. I'll leave the name change up to you since there isn't a good way to fit in with the transformFullPerspective and transform2DAffine names.

@chinmaygarde
Copy link
Member Author

Right, I was attempting to be consistent with transformFullPerspective and transform2DAffine. Even the AIKS call is ResetTransform. We can make this consistent later.

@flar
Copy link
Contributor

flar commented Mar 15, 2022

Looks like this needs an Impeller update.

chinmaygarde added a commit to flutter/impeller that referenced this pull request Mar 16, 2022
@chinmaygarde chinmaygarde added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Mar 16, 2022
This allows for the implementation of the
DisplayListCanvasRecoder::didSetM44. Instead of another operation that
clears the transformation stack along with setting a new transformation
on it. A single no-payload operation that clears the stack is added.
Existing ops to push to the stack are then reused.
@skia-gold
Copy link

Gold has detected about 18 new digest(s) on patchset 1.
View them at https://flutter-engine-gold.skia.org/cl/github/32050

@chinmaygarde
Copy link
Member Author

The gold failure can't possibly be related. There was an assertion there earlier.

@flutter-dashboard
Copy link

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.

Changes reported for pull request #32050 at sha ba26d52

@zanderso
Copy link
Member

@mdebbar Do you know what's going on with the gold checks?

@mdebbar
Copy link
Contributor

mdebbar commented Mar 16, 2022

These are golden changes from my PR: #31907. They are supposed to be uploaded during post-submit and considered as the new baseline. But something went wrong in post-submit. I'm looking into it now.

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Mar 16, 2022
@chinmaygarde
Copy link
Member Author

The test failure is a known flake flutter/flutter#95751

@chinmaygarde chinmaygarde merged commit 81547d1 into flutter:main Mar 16, 2022
@chinmaygarde chinmaygarde deleted the transformreset branch March 16, 2022 19:40
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 17, 2022
zanderso pushed a commit to flutter/flutter that referenced this pull request Mar 17, 2022
* 09d7bcc Optionally specify the target dir in tools/gn (flutter/engine#32065)

* a00ba24 Fix done button click not blur in iOS keyboard (flutter/engine#31718)

* 81547d1 Add a display list op to clear to transformation stack. (flutter/engine#32050)

* 2309bcc Add WASM target in gn (flutter/engine#31670)

* 852e800 [web] Remove the --passfail flag when calling goldctl in post-submit (flutter/engine#32071)

* eb1c50d Fix issues with nested gradients in html renderer. (flutter/engine#31887)

* fb0fd74 Update the magic number for JPEG to just FF D8 FF. (flutter/engine#32076)

* 233c17c Wrap the global timeline event handler callback in a std::atomic (flutter/engine#32073)

* dfde2aa Roll Dart SDK from 24bf86f16411 to 5bc905e69609 (9 revisions) (flutter/engine#32075)
dnfield pushed a commit to dnfield/engine that referenced this pull request Apr 26, 2022
dnfield pushed a commit that referenced this pull request Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants