UniformScratch class final

One reusable, zeroed buffer per block size, for a backend's bindUniformBlock.

Why it exists: a draw allocated every block it bound. Each backend made a fresh Float32List (and Impeller a second, rounded copy) for every uniform block of every draw: six to ten blocks a mesh a view, the shadow passes included, and four kilobytes for a skinned mesh's joints. All of it was garbage the moment the API had copied it, which every API here does at the call — WebGL2's bufferData, WebGPU's queue.writeBuffer, flutter_gpu's HostBuffer.emplace. So one buffer per size serves every block of that size, for the life of the device.

What a caller promises. The list zeroed answers is valid until the next call for the same size, so it is filled, handed to an API that copies, and forgotten, in that order; a backend that kept it past the copy would see the next draw's values in it.

Constructors

UniformScratch()
An empty set of buffers; each size is made the first time it is asked for.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sizes → int
How many sizes have a buffer: what this holds, for a debugger.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
zeroed(int sizeInBytes) → Float32List
A list of sizeInBytes / 4 floats, all zero: the same list every time this size is asked for, cleared first, so a member the caller does not write reads zero as it did in a fresh list.

Operators

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