★ wanayoo — archive 1999 https://github.com/flutter/engine/pull/22854Nouvelle recherche | Portail wanayoo
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

[embedder] [metal] Add support for Metal Renderer Config in the embedder API #22854

Merged
merged 5 commits into from Jan 2, 2021

Conversation

@iskakaushik
Copy link
Contributor

@iskakaushik iskakaushik commented Dec 3, 2020

No description provided.

@iskakaushik iskakaushik requested a review from chinmaygarde Dec 3, 2020
@google-cla google-cla bot added the cla: yes label Dec 3, 2020
@iskakaushik iskakaushik force-pushed the iskakaushik:embedder_metal_support_pr branch 5 times, most recently from bb95a27 to 65fe820 Dec 4, 2020
shell/platform/embedder/embedder.h Show resolved Hide resolved
shell/platform/embedder/embedder.h Outdated Show resolved Hide resolved
shell/platform/embedder/embedder.h Outdated Show resolved Hide resolved
shell/platform/embedder/embedder.h Outdated Show resolved Hide resolved
shell/platform/embedder/embedder.h Outdated Show resolved Hide resolved
shell/platform/embedder/embedder.h Outdated Show resolved Hide resolved
/// Handle for the MTLDevice.
FlutterMetalDevice device;
/// Handle for the MTLCommandQueue.
FlutterMetalCommandQueue command_queue;

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 8, 2020
Member

present_command_queue for clarity.

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 8, 2020
Member

I forget, does the embedder need to own a reference to the main command queue? Or, can the engine create a command queue on behalf of the embedder?

This comment has been minimized.

@iskakaushik

iskakaushik Dec 9, 2020
Author Contributor

I think this provides the embedder with most flexibility since it might want to time when the commit needs to happen, see: https://github.com/flutter/engine/pull/22606/files#diff-112f37d852d26e9e2c1040c0f0ab516a94450e5d48c37338612bd254040881d3R85. I will rename to present_command_queue for clarity.

@iskakaushik
Copy link
Contributor Author

@iskakaushik iskakaushik commented Dec 9, 2020

@chinmaygarde I think i've addressed the comments. PTAL

@iskakaushik iskakaushik force-pushed the iskakaushik:embedder_metal_support_pr branch from d13f423 to ba5b639 Dec 9, 2020
Copy link
Member

@chinmaygarde chinmaygarde left a comment

Other than the nits about naming in the public API, everything else looks fine to me. Mostly there.

typedef const void* FlutterMetalCommandQueue;

/// Alias for id<MTLTexture>.
typedef const void* FlutterMetalTextureBuffer;

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 17, 2020
Member

Nit: Just FlutterMetalTexture should be fine and matches the Apple API naming convention.

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 17, 2020
Member

Oh, I see. There is already the struct named that. Can be append Handle to these void * typedefs?

int64_t texture_id;
/// Handle to the MTLTexture that is owned by the embedder. Engine will render
/// the frame into this texture.
FlutterMetalTextureBuffer* texture;

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 17, 2020
Member

FlutterMetalTextureBuffer is already a pointer. Why the pointer to a pointer?

/// `FlutterMetalTextureCallback` callback.
typedef bool (*FlutterMetalPresentCallback)(
void* /* user data */,
const FlutterMetalTexture* /* texture */);

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 17, 2020
Member

Again, a pointer to a pointer. Those are usually only required for out parameters.

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 31, 2020
Member

I think you missed this double pointer indirection.

This comment has been minimized.

@iskakaushik

iskakaushik Dec 31, 2020
Author Contributor

@chinmaygarde this isn't a handle. This is just a pointer to a struct.

FlutterMetalCommandQueue present_command_queue;
/// The callback that gets invoked when the engine requests the embedder for a
/// texture to render to.
FlutterMetalTextureCallback get_next_drawable_texture_callback;

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 17, 2020
Member

Nit: The _texture_ in these ivars is redundant.

iskakaushik added 4 commits Dec 3, 2020
This change adds a FlutterMetalRendererConfig that lets embedders
specify metal as rendering api.

Also adds a test that validates rendering a gradient using metal.
@iskakaushik iskakaushik force-pushed the iskakaushik:embedder_metal_support_pr branch from ba5b639 to 36675aa Dec 29, 2020
@iskakaushik
Copy link
Contributor Author

@iskakaushik iskakaushik commented Dec 29, 2020

@chinmaygarde this addresses all the review comments. PTAL.

@iskakaushik iskakaushik force-pushed the iskakaushik:embedder_metal_support_pr branch from 36675aa to 3a25c8a Dec 29, 2020
Copy link
Member

@chinmaygarde chinmaygarde left a comment

I believe you missed one comment. Other than that, LGTM. Sorry about the late replies.

/// `FlutterMetalTextureCallback` callback.
typedef bool (*FlutterMetalPresentCallback)(
void* /* user data */,
const FlutterMetalTexture* /* texture */);

This comment has been minimized.

@chinmaygarde

chinmaygarde Dec 31, 2020
Member

I think you missed this double pointer indirection.

@chinmaygarde
Copy link
Member

@chinmaygarde chinmaygarde commented Jan 2, 2021 •

Tree is red because of a flake. This is the only commit tagged for CQ passing all presubmits. Landing manually.

@chinmaygarde chinmaygarde merged commit 70f0702 into flutter:master Jan 2, 2021
18 of 19 checks passed
18 of 19 checks passed
@flutter-dashboard
luci-engine Flutter build is currently broken. Please do not merge this PR unless it contains a fix to the broken build.
Details
@flutter-dashboard
Linux Android AOT Engine
Details
@flutter-dashboard
Linux Android Debug Engine
Details
@flutter-dashboard
Linux Android Scenarios
Details
@flutter-dashboard
Linux Fuchsia
Details
@flutter-dashboard
Linux Host Engine
Details
@flutter-dashboard
Linux Web Engine
Details
@flutter-dashboard
Linux Web Framework tests
Details
@flutter-dashboard
Mac Android AOT Engine
Details
@flutter-dashboard
Mac Android Debug Engine
Details
@flutter-dashboard
Mac Host Engine
Details
@flutter-dashboard
Mac Web Engine
Details
@flutter-dashboard
Mac iOS Engine
Details
@wip
WIP Ready for review
Details
@flutter-dashboard
Windows Android AOT Engine
Details
@flutter-dashboard
Windows Host Engine
Details
@cirrus-ci
build_and_test_linux_unopt_debug Task Summary
Details
@google-cla
cla/google All necessary CLAs are signed
@cirrus-ci
licenses_check Task Summary
Details
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 3, 2021
gspencergoog added a commit to gspencergoog/engine that referenced this pull request Jan 5, 2021
…der API (flutter#22854)

This change adds a FlutterMetalRendererConfig that lets embedders
specify metal as rendering api.

Also adds a test that validates rendering a gradient using metal.
yjbanov added a commit to yjbanov/engine that referenced this pull request Jan 7, 2021
…der API (flutter#22854)

This change adds a FlutterMetalRendererConfig that lets embedders
specify metal as rendering api.

Also adds a test that validates rendering a gradient using metal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants