Skip to content

Commit fc48225

Browse files
authored
Optimize MetalRedrawer synchronization (#2673)
Remove `inflightSemaphore` because does not prevent from awaiting the main thread on the `nextDrawable()`. Replace `InflightCommandBuffers` and replace it with the Dispatch Group. Fixes https://youtrack.jetbrains.com/issue/CMP-9494/Optimize-MetalRedrawer-synchronization ## Release Notes N/A
1 parent 81056d4 commit fc48225

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/window/MetalRedrawer.ios.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,6 @@ internal class MetalRedrawer(
439439
picture.close()
440440
surface.flushAndSubmit()
441441

442-
surface.close()
443-
renderTarget.close()
444-
445442
if (useSeparateRenderThreadWhenPossible) {
446443
dispatch_semaphore_signal(drawCanvasSemaphore)
447444
}
@@ -481,6 +478,9 @@ internal class MetalRedrawer(
481478
}
482479
}
483480

481+
surface.close()
482+
renderTarget.close()
483+
484484
// Track current inflight command buffers to synchronously wait for their schedule in case app goes background
485485
inflightCommandBuffers.add(commandBuffer)
486486

0 commit comments

Comments
 (0)