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

Directly use 4x4 matrices with surface textures instead of converting to and from the 3x3 variants. #54126

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

chinmaygarde
Copy link
Member

@chinmaygarde chinmaygarde commented Jul 25, 2024

SurfaceTextureGetTransformMatrix returns a col-major 4x4 matrix. We used to convert it to a 3x3 matrix. Then when applying the transformation in the shader, I'd convert it back to a 4x4 matrix.

Instead of all this (potentially lossy) flip-flopping, store the matrix just as we get it in 4x4 form and perform the conversion just once if necessary. Today, it is necessary only in the Skia backend. SkM44 already has a converter to convert to and from a 3x3 SkMatrix. So, use that instead of rolling our own.

I spent a lot of time debugging these conversions and transformations because we had rolled our own and the printers seemed to dump in row-major order irrespective of storage order. This caused a lot of confusion.

No change in functionality. Hopefully, the next person debugging transformations has an easier go at this.

…to and from the 33 variants.

SurfaceTextureGetTransformMatrix returns a col-major 4x4 matrix. We used to convert it to a 3x3 matrix. Then when applying the transformation in the shader, I'd convert it back to a 4x4 matrix.

Instead of all this (potentially lossy) flip-flopping, store the matrix just as we get it in 4x4 form and perform the conversion just once if necessary. Today, it is necessary only in the Skia backend. SkM44 already has a converter to convert to and from a 3x3 SkMatrix. So, use that instead of rolling our own.

I spent a lot of time debugging this conversions and transformation because we had rolled our own and the printers seemed to dump in col-major order irrespective of storage order. This caused a lot of confusion.

No change in functionality. Hopefully, the next person debugging transformations has an easier go at this.
@chinmaygarde chinmaygarde changed the title Directly use 44 matrices with surface textures instead of converting to and from the 33 variants. Directly use 4x4 matrices with surface textures instead of converting to and from the 3x3 variants. Jul 25, 2024
Copy link
Member

@jonahwilliams jonahwilliams 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 added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 26, 2024
@auto-submit auto-submit bot merged commit d69917c into flutter:main Jul 26, 2024
31 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 26, 2024
zanderso pushed a commit to flutter/flutter that referenced this pull request Jul 26, 2024
…ions) (#152379)

Manual roll requested by zra@google.com

flutter/engine@8714b54...342a425

2024-07-26 98614782+auto-submit[bot]@users.noreply.github.com Reverts
"[Impeller] Implement draw order optimization. (#54067)"
(flutter/engine#54136)
2024-07-26 skia-flutter-autoroll@skia.org Roll Skia from 06b26a1d51d7 to
cd892b576ade (1 revision) (flutter/engine#54134)
2024-07-26 chinmaygarde@google.com Directly use 4x4 matrices with
surface textures instead of converting to and from the 3x3 variants.
(flutter/engine#54126)
2024-07-26 skia-flutter-autoroll@skia.org Roll Skia from e9b8585af6b5 to
06b26a1d51d7 (1 revision) (flutter/engine#54132)
2024-07-26 bdero@google.com [Impeller] Implement draw order
optimization. (flutter/engine#54067)
2024-07-26 skia-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from
clqtZA8cx4GEXwcOe... to dUCMHqU6ihfIFKAw8... (flutter/engine#54130)

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 jonahwilliams@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
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…ions) (flutter#152379)

Manual roll requested by zra@google.com

flutter/engine@8714b54...342a425

2024-07-26 98614782+auto-submit[bot]@users.noreply.github.com Reverts
"[Impeller] Implement draw order optimization. (flutter#54067)"
(flutter/engine#54136)
2024-07-26 skia-flutter-autoroll@skia.org Roll Skia from 06b26a1d51d7 to
cd892b576ade (1 revision) (flutter/engine#54134)
2024-07-26 chinmaygarde@google.com Directly use 4x4 matrices with
surface textures instead of converting to and from the 3x3 variants.
(flutter/engine#54126)
2024-07-26 skia-flutter-autoroll@skia.org Roll Skia from e9b8585af6b5 to
06b26a1d51d7 (1 revision) (flutter/engine#54132)
2024-07-26 bdero@google.com [Impeller] Implement draw order
optimization. (flutter/engine#54067)
2024-07-26 skia-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from
clqtZA8cx4GEXwcOe... to dUCMHqU6ihfIFKAw8... (flutter/engine#54130)

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 jonahwilliams@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
@chinmaygarde chinmaygarde deleted the m44 branch August 22, 2024 19:45
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…ions) (flutter#152379)

Manual roll requested by zra@google.com

flutter/engine@8714b54...342a425

2024-07-26 98614782+auto-submit[bot]@users.noreply.github.com Reverts
"[Impeller] Implement draw order optimization. (flutter#54067)"
(flutter/engine#54136)
2024-07-26 skia-flutter-autoroll@skia.org Roll Skia from 06b26a1d51d7 to
cd892b576ade (1 revision) (flutter/engine#54134)
2024-07-26 chinmaygarde@google.com Directly use 4x4 matrices with
surface textures instead of converting to and from the 3x3 variants.
(flutter/engine#54126)
2024-07-26 skia-flutter-autoroll@skia.org Roll Skia from e9b8585af6b5 to
06b26a1d51d7 (1 revision) (flutter/engine#54132)
2024-07-26 bdero@google.com [Impeller] Implement draw order
optimization. (flutter/engine#54067)
2024-07-26 skia-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from
clqtZA8cx4GEXwcOe... to dUCMHqU6ihfIFKAw8... (flutter/engine#54130)

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 jonahwilliams@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
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 platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants