|
218 | 218 | return IRect::MakeSize(resolve_texture_->GetSize()); |
219 | 219 | } |
220 | 220 |
|
221 | | -static bool ShouldWaitForCommandBuffer() { |
222 | | -#if ((FML_OS_MACOSX && !FML_OS_IOS) || FML_OS_IOS_SIMULATOR) |
223 | | - // If a transaction is present, `presentDrawable` will present too early. And |
224 | | - // so we wait on an empty command buffer to get scheduled instead, which |
225 | | - // forces us to also wait for all of the previous command buffers in the queue |
226 | | - // to get scheduled. |
227 | | - return true; |
228 | | -#else |
229 | | - // On Physical iOS devices we still need to wait if we're taking a frame |
230 | | - // capture. |
231 | | - return [[MTLCaptureManager sharedCaptureManager] isCapturing]; |
232 | | -#endif // ((FML_OS_MACOSX && !FML_OS_IOS) || FML_OS_IOS_SIMULATOR) |
233 | | -} |
234 | | - |
235 | 221 | // |Surface| |
236 | 222 | bool SurfaceMTL::Present() const { |
237 | 223 | auto context = context_.lock(); |
@@ -262,16 +248,12 @@ static bool ShouldWaitForCommandBuffer() { |
262 | 248 | } |
263 | 249 |
|
264 | 250 | if (drawable_) { |
265 | | - // In certain situations, we need to wait until the command queue has been |
266 | | - // flushed before presenting to the onscreen texture. See the comments in |
267 | | - // `ShouldWaitForCommandBuffer` for more details. |
268 | | - if (ShouldWaitForCommandBuffer()) { |
269 | | - id<MTLCommandBuffer> command_buffer = |
270 | | - ContextMTL::Cast(context.get()) |
271 | | - ->CreateMTLCommandBuffer("Present Waiter Command Buffer"); |
272 | | - [command_buffer commit]; |
273 | | - [command_buffer waitUntilScheduled]; |
274 | | - } |
| 251 | + TRACE_EVENT0("flutter", "waitUntilScheduled"); |
| 252 | + id<MTLCommandBuffer> command_buffer = |
| 253 | + ContextMTL::Cast(context.get()) |
| 254 | + ->CreateMTLCommandBuffer("Present Waiter Command Buffer"); |
| 255 | + [command_buffer commit]; |
| 256 | + [command_buffer waitUntilScheduled]; |
275 | 257 | [drawable_ present]; |
276 | 258 | } |
277 | 259 |
|
|
0 commit comments