-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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] make sure to render TiledTextureContents if the geometry doesn't fit in the texture's bounds. #51393
Conversation
…oesn't fit in the texture's bounds.
@bdero @jonahwilliams friendly ping |
std::optional<Rect> geometry_coverage = GetGeometry()->GetCoverage({}); | ||
if (GetInverseEffectTransform().IsIdentity() && | ||
GetGeometry()->IsAxisAlignedRect()) { | ||
GetGeometry()->IsAxisAlignedRect() && | ||
(!geometry_coverage.has_value() || | ||
Rect::MakeSize(texture_->GetSize()) | ||
.Contains(geometry_coverage.value()))) { |
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.
I don't fully understand this, could you explain it a bit more? I know for the regular texture contents we have some src/dst checking.
Since tiled texture contents is an arbitrary geometry, we have the axis aligned rect check first. What is the additional check doing?
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.
When the geometry is not contained in the texture that means we have to render texcoords outside of 0..1, so we can't take the fast pass of avoiding rendering. We need the clamping, decal, etc.
If you check out the issue this is where we could hack this conditional to give us the correct result by sending in Scale(1.001, 1.001, 1)
instead of Identity()
for the effect transform because the fast pass conditional was incorrectly ignoring the geometry and the full render was correct.
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.
But isn't that expressed in the coverage and the scaling below?
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.
Demonstrably, no. If you run the golden test without this patch it will render with the incorrect texture coords, instead stretching them to fill the whole geometry. That flow through the code lacks the math the express the effect transform correctly.
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.
I think since the effect transform was identity it was assumed it could be ignored, but it's not the case when the geometry is expanded.
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.
Oh I agree its not working! But, this code should be able to render a stretched rectangle right? It seems like there is a bug in the math there that we could fix?
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.
I played around with it again and I don't think so. The Snapshot
flow lacks the expressivity to represent rendering texcoords outside of 0..1. It's not a bug, but a limit of the abstraction. That's why it only works when rendering a subset inside of the texture.
If you set the scale to 1.0 you can see it renders at the correct size without the halo we need and there is no lever to pull to make it appear.
We can file an issue to redesign Snapshot
it will probably require having a matrix for the uvs and the vertices?
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.
Ack. The snapshot has a transform, but it assumes a srcRect. We could add support for that, but it isn't necessary here.
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. |
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
Would you file a bug to add this feature to the Snapshot?
|
…geometry doesn't fit in the texture's bounds. (flutter/engine#51393)
…145336) flutter/engine@89fb886...9162c83 2024-03-18 68449066+zijiehe-google-com@users.noreply.github.com [Fuchsia] only download fuchsia deps when necessary (flutter/engine#51439) 2024-03-18 30870216+gaaclarke@users.noreply.github.com [Impeller] make sure to render TiledTextureContents if the geometry doesn't fit in the texture's bounds. (flutter/engine#51393) 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
fixes flutter/flutter#144836
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.