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

[Impeller] only use porter duff or vertices.uber for drawVertices. #52345

Merged
merged 10 commits into from
Apr 24, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Apr 23, 2024

Simplifcation that will allow us to remove the special case position_color.vert and vertices.frag shaders, not done here because drawAtlas also needs to be updated. This also fixes sparkle-party like rendering bugs where we incorrectly relied on a color filter.

The problem with doing advanced blends between the vertices with a color filters was three fold:

  1. We would render incorrectly when vertices overlapped.
  2. We had to disable MSAA to remove artifacts
  3. The sub render pass was slow.

Below is an example of the incorrect rendering caused by overlapping vertices on the sparkle party app.

Skia (Advanced blend)

flutter_02

Impeller (ToT)

flutter_01

Impeller w/ patch

flutter_03

Fixes flutter/flutter#131345

if (texture) {
FS::BindTextureSamplerDst(pass, texture, dst_sampler);
} else {
// We need to bind something so validation layers doesn't complain.
Copy link
Member Author

Choose a reason for hiding this comment

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

The validation layers must be satisfied.

@@ -629,22 +646,6 @@ void ContentContext::InitializeCommonlyUsedShadersIfNeeded() const {
options.stencil_mode = stencil_mode;
CreateIfNeeded(clip_pipelines_, options);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't need the bootstrap texture anymore since the empty texture warms the same shader cache but is actually useful.

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

auto-submit bot pushed a commit that referenced this pull request Apr 24, 2024
…er (#52348)

The drawAtlas component of #52345 . DrawAtlas did not have the same advanced blend/overlapping issues as draw vertices because of the sorting and generation of the sub-atlas, but given that the vertices uber shader exists we can just use that instead.

Will eventually allow deleting the other drawVertices special case shaders.
@jonahwilliams jonahwilliams requested a review from bdero April 24, 2024 21:21
@jonahwilliams
Copy link
Member Author

PTAL @chinmaygarde / @bdero

} else {
texture = texture_;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: If the texture is nullptr here, set it to the empty texture right away so you don't have to do all the null checks later? Stuff like the size, y scale coord, etc. will just work without additional checks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh good idea 👍

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

@@ -715,6 +715,10 @@ class ContentContext {
return GetPipeline(vertices_uber_shader_, opts);
}

// An empty 1x1 texture for binding drawVertices/drawAtlas or other cases
Copy link
Member

Choose a reason for hiding this comment

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

Specify that its a 1x1 black transparent texture so callers can reason about potential issues with sampling and mixing from this empty texture.

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

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 24, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 24, 2024
Copy link
Contributor

auto-submit bot commented Apr 24, 2024

auto label is removed for flutter/engine/52345, due to Pull request flutter/engine/52345 is not in a mergeable state.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 24, 2024
@auto-submit auto-submit bot merged commit f48f3b6 into flutter:main Apr 24, 2024
31 checks passed
@jonahwilliams jonahwilliams deleted the remove_rest_of_vertices branch April 24, 2024 23:45
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 25, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 25, 2024
…147348)

flutter/engine@b30c0a7...f48f3b6

2024-04-24 [email protected] [Impeller] only use porter duff or vertices.uber for drawVertices. (flutter/engine#52345)
2024-04-24 [email protected] Roll Fuchsia Linux SDK from le_-uFgRD5DjvvqgL... to PJBX8xxRnd5vCFnQM... (flutter/engine#52376)
2024-04-24 [email protected] [Impeller] Remove additional shader bootstrap. (flutter/engine#52368)
2024-04-24 [email protected] Remove TODO I will never do: `runIfNot` is deprecated. (flutter/engine#52308)
2024-04-24 [email protected] Roll Dart SDK from 38c43a01a51e to 9a0f141e9a67 (1 revision) (flutter/engine#52373)
2024-04-24 [email protected] [Impeller] Cleanup legacy StencilModes and document overdraw prevention. (flutter/engine#52372)
2024-04-24 [email protected] Roll Skia from afcc1db27593 to 864f6d868ec0 (1 revision) (flutter/engine#52371)
2024-04-24 [email protected] Move zlib to //flutter/third_party (flutter/engine#52366)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from le_-uFgRD5Dj to PJBX8xxRnd5v

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
auto-submit bot pushed a commit that referenced this pull request Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Impeller] Faster DrawVertices/DrawAtlas via subpass elimination.
2 participants