Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
++
  • Loading branch information
jonahwilliams committed Sep 20, 2023
commit 061c72002e10339f99eb0cc5a00c1b0238c15d72
6 changes: 5 additions & 1 deletion impeller/renderer/backend/metal/surface_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@
id<MTLCommandBuffer> command_buffer =
ContextMTL::Cast(context.get())
->CreateMTLCommandBuffer("Present Waiter Command Buffer");
if ([[NSThread currentThread] isMainThread]) {
// If the threads have been merged, or there is a pending frame capture,
// then block on cmd buffer scheduling to ensure that the
// transaction/capture work correctly.
if ([[NSThread currentThread] isMainThread] ||
Copy link
Member

Choose a reason for hiding this comment

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

Would this check work if a custom embedder launched the engine in a thread other than the main thread?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think technically this only needs to match wherever we set the layer to presentsWithTransaction. But I suspect that is only for iOS? I'll have to check how macOS desktop is doing.

[[MTLCaptureManager sharedCaptureManager] isCapturing]) {
[command_buffer commit];
[command_buffer waitUntilScheduled];
[drawable_ present];
Expand Down