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

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Dec 7, 2023

fixes flutter/flutter#139165

before

Screenshot 2023-12-07 at 2 18 42 PM

after

Screenshot 2023-12-07 at 2 14 39 PM

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke gaaclarke marked this pull request as ready for review December 7, 2023 22:39
@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 #48805 at sha c65e3a1

Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

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

I haven't scrutinized how the UV mapping works super closely yet, but overall this LGTM!

Entity::TileMode tile_mode) {
switch (tile_mode) {
case Entity::TileMode::kDecal:
if (renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode()) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a todo/issue for emulating this when it's not supported? The halo won't render correctly on some devices w/ the current technique without this.

We already have a specialized pipeline that the old blur uses for this w/ the same vertex/uniform layouts (GaussianBlurDecalPipeline).

Copy link
Member Author

Choose a reason for hiding this comment

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

Done: flutter/flutter#139773

How do we look up availability on gpuinfo.org? I had a hard time finding it. It's just available to everyone on Vulkan right? The check is just for OpenGLES?

Copy link
Member

@bdero bdero Dec 7, 2023

Choose a reason for hiding this comment

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

Yeah decal is supported for Metal (via MTLSamplerAddressModeClampToZero) and our min Vulkan profile without any extensions. For OpenGLES we check for GL_EXT_texture_border_clamp or GL_NV_texture_border_clamp.

image

This looks worse than the situation actually is, though. I'm pretty sure "coverage" on gpuinfo.org is just "percentage of devices in the database" and doesn't weight for an estimation of actual usage. And of course, there are ancient devices on the list that Flutter doesn't support.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yea, good point. Over time the usefulness of gpuinfo.org will wane if they don't have some sort of filter for old devices. Something like filtering based on operating system would probably work since the OS developers will start dropping support.

Copy link
Contributor

@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!

@gaaclarke
Copy link
Member Author

gaaclarke commented Dec 7, 2023

I haven't scrutinized how the UV mapping works super closely yet, but overall this LGTM!

So, first we attempt to create the gutter by expanding the clip coverage to get the snapshot. That may or may not contain all the content for the gutter we need in the snapshot. Then when we downsample we blow out the uvs of the snapshot to create the gutter.

One place where this may not work is if we draw an image filter on an image whose "source rect" is smaller than the full image. I guess that may be possible with Canvas::DrawImageRect. It may not work because it will be grabbing extra content from the source texture, not creating the transparent gutter with kDecale.

// region can't give us the full gutter we want.
Vector2 texture_size = Vector2(input_texture->GetSize());
Quad vertices =
Quad guttered_uvs =
Copy link
Member Author

Choose a reason for hiding this comment

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

This math may assume that the centroid of the uv's is 0.5, 0.5 too so it may not work if that isn't the case? @bdero

@gaaclarke
Copy link
Member Author

I'm not certain if this handles all cases yet. This passes all of our existing tests and passes 1 new one so it's a step forward. The broken cases may be rare enough to ingore for now. I'm going to land it, implement clamping the sigma then poke around to see if I can break this.

@gaaclarke gaaclarke merged commit 6a687be into flutter:main Dec 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 8, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

[Impeller] New gaussian blur has gap.

3 participants