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

[Impeller] stencil buffer record/replay instead of MSAA storage. #47397

Merged
merged 10 commits into from
Nov 1, 2023

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Oct 27, 2023

When restoring from a backdrop filter, replay the clip affecting cmds into a new stencil buffer instead of storing 4x MSAA stencil buffer.

Fixes flutter/flutter#137561
Fixes flutter/flutter#137448
Fixes flutter/flutter#137302

Helps flutter/flutter#137108

@jonahwilliams jonahwilliams changed the title Conditionally save stencil [Impeller] stencil buffer record/replay instead of MSAA storage. Oct 31, 2023
@jonahwilliams jonahwilliams marked this pull request as ready for review October 31, 2023 20:52
@jonahwilliams jonahwilliams requested a review from bdero October 31, 2023 20:54
@jonahwilliams
Copy link
Member Author

I think (hope) we have golden test coverage for this, right? 😄

@jonahwilliams
Copy link
Member Author

Currently investigating performance on iOS using the backdrop filter perf (Partial repaint disabled). With this change:

  "average_gpu_frame_time": 247.9492189,
  "90th_percentile_gpu_frame_time": 249.023438,
  "99th_percentile_gpu_frame_time": 249.023438,
  "worst_gpu_frame_time": 249.023438,
  ...
   "average_frame_rasterizer_time_millis": 225.71757142857146,
  "stddev_frame_rasterizer_time_millis": 0.623428571428572,
  "90th_percentile_frame_rasterizer_time_millis": 226.62,
  "99th_percentile_frame_rasterizer_time_millis": 227.661,
  "worst_frame_rasterizer_time_millis": 227.661,

Without it

  "average_gpu_frame_time": 307.61718740000003,
"90th_percentile_gpu_frame_time": 310.058594,
"99th_percentile_gpu_frame_time": 310.058594,
"worst_gpu_frame_time": 310.058594,

...

  "average_frame_rasterizer_time_millis": 279.90400000000005,
"stddev_frame_rasterizer_time_millis": 1.0763076923076982,
"90th_percentile_frame_rasterizer_time_millis": 281.933,
"99th_percentile_frame_rasterizer_time_millis": 282.053,
"worst_frame_rasterizer_time_millis": 282.053,

So measurably better!

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.

Just minor comments.

I really hope this doesn't generally regress Metal in the common case. I'd much rather have this recorder/replay mechanism than the total_pass_reads_ mess.

///
/// These clips are replayed when restoring the backdrop so that the
/// stencil buffer is left in an identical state.
class EntityPassClipReplay {
Copy link
Member

Choose a reason for hiding this comment

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

EntityPassClipRecorder?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is much better

.clear_color = clear_color}, // color_attachment_config
GetDefaultStencilConfig(readable) // stencil_attachment_config
.clear_color = clear_color}, // color_attachment_config
kDefaultStencilConfig // stencil_attachment_config
Copy link
Member

Choose a reason for hiding this comment

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

Should be able to remove the readable param from CreateRenderTarget now

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

@@ -40,7 +40,7 @@ class InlinePassContext {
std::shared_ptr<CommandBuffer> command_buffer_;
std::shared_ptr<RenderPass> pass_;
uint32_t pass_count_ = 0;
uint32_t total_pass_reads_ = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Good riddance...

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 1, 2023
@auto-submit auto-submit bot merged commit 04329c5 into flutter:main Nov 1, 2023
25 checks passed
@jonahwilliams jonahwilliams deleted the conditionally_save_stencil branch November 1, 2023 00:28
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 1, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 1, 2023
…137656)

flutter/engine@db06c2e...a0ac6b4

2023-11-01 bdero@google.com [Impeller] Include cstdint everywhere that uint32_t is used. (flutter/engine#47533)
2023-11-01 bdero@google.com [Impeller] Fix nullopt access and simplify coverage computation in GetSubpassCoverage. (flutter/engine#47347)
2023-11-01 bdero@google.com [Impeller] OpenGLES: Ensure frag/vert textures are bound with unique texture units. (flutter/engine#47218)
2023-11-01 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from LCfhx_lTRJI51G0zc... to _TyF0etsONe5aqCbM... (flutter/engine#47532)
2023-11-01 jonahwilliams@google.com [Impeller] stencil buffer record/replay instead of MSAA storage. (flutter/engine#47397)
2023-11-01 chris@bracken.jp [macOS] Delete FlutterCompositor tests (flutter/engine#47527)
2023-10-31 bdero@google.com [Impeller] Place Rect statics under the Rect template. (flutter/engine#47529)
2023-10-31 skia-flutter-autoroll@skia.org Roll Skia from aaa225e0cc6d to 34ef20100acc (1 revision) (flutter/engine#47530)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from LCfhx_lTRJI5 to _TyF0etsONe5

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 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 e: impeller
Projects
No open projects
Archived in project
2 participants