Thanks to visit codestin.com
Credit goes to github.com

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

[Impeller] Add GPUTracer for impeller metal backend #36499

Merged
merged 20 commits into from
Oct 20, 2022

Conversation

luckysmg
Copy link
Contributor

@luckysmg luckysmg commented Sep 29, 2022

List which issues are fixed by this PR. You must list at least one issue.
flutter/flutter#111421

We can add this in info.plist in our test app to get gputrace file if we save it locally.

<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>

Preview

metal_capture.mp4

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 Hixie said 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.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@luckysmg luckysmg changed the title Add interface for metal frame capture. [WIP] Add interface for metal frame capture. Sep 29, 2022
@luckysmg luckysmg changed the title [WIP] Add interface for metal frame capture. Add interface for metal frame capture. Sep 29, 2022
@luckysmg luckysmg marked this pull request as draft September 29, 2022 11:26
@ColdPaleLight ColdPaleLight changed the title Add interface for metal frame capture. [Impeller] Add interface for metal frame capture. Sep 29, 2022
@luckysmg luckysmg marked this pull request as ready for review September 30, 2022 02:47
@luckysmg luckysmg marked this pull request as draft October 1, 2022 01:36
@luckysmg luckysmg marked this pull request as ready for review October 8, 2022 06:36
@skia-gold
Copy link

Gold has detected about 2 new digest(s) on patchset 13.
View them at https://flutter-engine-gold.skia.org/cl/github/36499

@luckysmg
Copy link
Contributor Author

I think this is ready for review ^_^

/// The frame capture should only be used in development for frame
/// offline analysis.
///
class FrameCaptor {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Can we rename this to something like GPUTracer? Since we will be using this to trace more than just frames (like compute workloads).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done^_^

/// capture finishes. Otherwise, the Xcode will automatically open and show
/// trace result.
///
bool mtlSaveGPUTraceDocument = false;
Copy link
Member

Choose a reason for hiding this comment

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

This header is backend agnostic so I am not sure how best to reconcile the Metal specificity of this option. Perhaps just a MetalConfiguration sub-struct? Also, please use the style guide for naming save_gpu_trace_as_document.

Copy link
Contributor Author

@luckysmg luckysmg Oct 19, 2022

Choose a reason for hiding this comment

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

Thx for reviewing this^_^

This is what I think about:
In this config, we gather all backends gpu trace params. And every backend just picks the corresponding params to use.

Such as...

struct GPUTracerConfiguration {
  /// Params for metal backend.

  bool mtl_frame_capture_save_trace_as_document = false;
  bool mtl_xxxxxx = false;

  /// Params for GLES backend.
  bool gles_frame_capture_save_trace_as_document = false;

  /// Param for Vulkan backend.
  bool vk_xxxx = false
};

@luckysmg luckysmg changed the title [Impeller] Add interface for metal frame capture. [Impeller] Add GPUTracer for impeller Oct 19, 2022
@luckysmg luckysmg changed the title [Impeller] Add GPUTracer for impeller [Impeller] Add GPUTracer for impeller metal backend Oct 19, 2022
@luckysmg
Copy link
Contributor Author

luckysmg commented Oct 19, 2022

I just added GPUTracerMTL for metal backend. And if it is necessary, later I will add corresponding GPUTracer for other backends after this PR is landed. (GPUTracerVK and GPUTracerGLES, they will be with default implementation)
^_^.

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 needs tests platform-ios
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants