Skip to content

[Impeller] Automatic compute synchronization on Metal and Vulkan #193869

Closed

Description

@bdero

Part of #188474.

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.

Dependencies

None.

Activity

  1. self-assigned this
    on Oct 5, 2026
  2. added
    c: new featureNothing broken; request for a new capability
    engineflutter/engine related. See also e: labels.
    e: impellerImpeller rendering backend issues and features requests
    on Oct 5, 2026
  3. moved this to 🤔 Needs Triage in Flutter GPUon Oct 5, 2026
  4. added 2 commits that reference this issue on Oct 11, 2026
    7fe7249
    47a00c4
  5. moved this from 🤔 Needs Triage to 💡 Features in Flutter GPUon Oct 19, 2026
  6. added a commit that references this issue on Oct 25, 2026
    0b9426b
  7. moved this from 💡 Features to ✅ Done in Flutter GPUon Oct 26, 2026
  8. added a commit that references this issue on Oct 26, 2026
    a3a21c8
  9. added a commit that references this issue on Oct 29, 2026
    3e73917
  10. github-actions commented on Nov 9, 2026

    @github-actions

    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.

  11. locked as resolved and limited conversation to collaborators on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

c: new featureNothing broken; request for a new capabilitye: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter-gputeam-fluttergpuOwned by Flutter GPU team

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions