-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Use final cmd buffer to present drawable. #46023
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -248,13 +248,22 @@ | |
| } | ||
|
|
||
| if (drawable_) { | ||
| TRACE_EVENT0("flutter", "waitUntilScheduled"); | ||
| id<MTLCommandBuffer> command_buffer = | ||
| ContextMTL::Cast(context.get()) | ||
| ->CreateMTLCommandBuffer("Present Waiter Command Buffer"); | ||
| [command_buffer commit]; | ||
| [command_buffer waitUntilScheduled]; | ||
| [drawable_ present]; | ||
| // 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] || | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]) { | ||
| TRACE_EVENT0("flutter", "waitUntilScheduled"); | ||
| [command_buffer commit]; | ||
| [command_buffer waitUntilScheduled]; | ||
| [drawable_ present]; | ||
| } else { | ||
| [command_buffer presentDrawable:drawable_]; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh wait, I need to double check if this messes up frame capture. If so we need to check if we're capturing a frame and block. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| [command_buffer commit]; | ||
| } | ||
| } | ||
|
|
||
| return true; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep this trace, but move it into
waitUntilScheduled's new scope?