beginFrame method

  1. @override
void beginFrame()
override

Tells the backend a new frame is starting.

The one member here that is about time rather than about resources, and it exists because every backend has something that has to rotate: on flutter_gpu it is the ring of per-frame uniform allocators, which cannot be reset in place because submit is asynchronous and the GPU may still be reading the frame before last. A backend with nothing to rotate implements this as nothing.

Never throws what the device said about an earlier frame, since 1.0.0-rc.1. An API that answers late (WebGPU's error scopes and uncapturederror) reports a refusal it heard after the call on errors, and one that cannot go on reports a DeviceLoss on lost; a throw here would land in whichever frame happened to start next, a long way from the call it was about, and fail that frame for nothing it did.

Implementation

@override
void beginFrame() {
  events.add(const TraceBeginFrame());
  inner.beginFrame();
}