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
[Flutter GPU] Pass lifecycle: one recording pass per command buffer, ended by the next command #193867
A Flutter GPU pass never ends until submit(). lib/gpu creates the backend pass when the Dart pass is created and encodes every pass at submit, so on Metal two passes in one command buffer have two command encoders open at once, which Metal does not allow. Apps work around this today with one command buffer per render pass, and compute passes (#188480) would hit the same limit.
This implements the pass lifecycle decided on #188474. It changes render passes as well as compute, so it lands on its own.
Changes
A command buffer records one pass at a time, and passes execute in the order they are created.
Creating the next pass, or recording a copy or readback on the command buffer, ends the current pass. submit() ends the last one.
When a pass ends, its Metal or Vulkan encoder ends at that point, so a command buffer can hold any number of passes. OpenGL ES keeps encoding at submit, in the same order.
RenderPass.end() ends a pass explicitly and is harmless to call twice.
Any call on an ended pass throws a StateError naming what ended it, for example "RenderPass was ended when createRenderPass() was called on the same CommandBuffer".
Testing
gpu_test.dart on Metal, Vulkan and OpenGL ES:
Two render passes in one command buffer both render correctly.
Using a pass after the next pass was created, after a copy, or after end() throws.
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
[Flutter GPU] End each pass when the next command is recorded
[Flutter GPU] End each pass when the next command is recorded
[Flutter GPU] End each pass when the next command is recorded (flutte…
[Flutter GPU] End each pass when the next command is recorded (flutte…
github-actions commentedon Nov 3, 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.