You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Impeller] Automatic compute synchronization on Metal and Vulkan #193869
The #188474 contract makes synchronization automatic: a write by an earlier dispatch or pass is visible to every later dispatch, draw, copy and readback without user action. Today it is not.
The Metal compute encoder is created with MTLDispatchTypeConcurrent, so dependent dispatches in one pass race unless the caller adds barriers. Hazards across encoders are already handled, since Metal resources are tracked.
On Vulkan the only automatic barrier is at the end of a compute pass, and it targets vertex input and index reads only. Fragment, uniform, sampled-texture, transfer, host and indirect consumers are not covered, and neither are render to compute or copy to compute.
Changes
Metal: create the compute encoder with MTLDispatchTypeSerial.
Vulkan: a compute-to-compute memory barrier between dispatches in a pass, and a barrier at the end of a compute pass whose destination covers vertex input, index and indirect reads, vertex, fragment and compute shader reads, transfer and host.
Vulkan: render and copy pass exits include the compute stage in their destination scope.
Keep AddBufferMemoryBarrier and AddTextureMemoryBarrier as the manual override.
Testing
On Metal and Vulkan, with Vulkan synchronization validation enabled:
Two dependent dispatches in one pass with no manual barrier.
A compute pass writing a vertex buffer that a later render pass draws.
A render pass writing a texture that a later compute pass reads.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
[Impeller] Synchronize compute dispatches and passes automatically
[Impeller] Synchronize compute dispatches and passes automatically
[Impeller] Synchronize compute dispatches and passes automatically
[Flutter GPU] Compute shaders on Metal and Vulkan (flutter#193805)
[Flutter GPU] Compute shaders on Metal and Vulkan (flutter#193805)
github-actions commentedon Nov 9, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.