Surface class Rendering

Manages the swapchain color textures a Scene composites onto the Flutter canvas, plus the pools of transient render-graph attachments.

Each Scene owns one Surface. A scene may render several views per frame (split-screen, picture-in-picture); each view gets its own swapchain ring and its own transient texture pool, so simultaneous views never share a render target within a frame. View 0 is the single-view default.

Every view, every frame, the renderer asks the surface for that view's next swapchain color texture via getNextSwapchainColorTexture; the surface rotates through a small ring per view so the GPU isn't asked to overwrite one the compositor is still reading. The tone-mapping pass renders the final image into this texture, which is then drawn to the canvas via Texture.asImage. A view keeps the ring and transient pool of its two most recent sizes, so a resolution that toggles (an adaptive render scale) reuses them instead of reallocating every target; a size left unused for a while is released.

Applications typically don't interact with Surface directly; it is driven internally by Scene.render / Scene.renderViews.

Constructors

Surface()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

getNextSwapchainColorTexture(Size size, [int viewIndex = 0, PixelFormat? format]) → Texture
Returns the next 8-bit swapchain color texture for view viewIndex at size, advancing that view's frame. A new size gets its own ring and transient pool; the previous size's are kept for a return.
lastSwapchainColorTexture([int viewIndex = 0]) → Texture?
The color texture most recently issued for viewIndex (the previous frame's output once the next frame begins), or null before the first frame or after a resize.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited