HostBuffer class base
HostBuffer is a bump allocator that managed a DeviceBuffer block list.
This is useful for chunking sparse data uploads, especially ephemeral uniform or vertex data that needs to change from frame to frame.
Different platforms have different data alignment requirements when reading DeviceBuffer data for shader uniforms. HostBuffer uses GpuContext.minimumUniformByteAlignment to align each emplacement automatically, so that they may be used in uniform bindings.
The length of each DeviceBuffer block is determined by blockLengthInBytes and cannot be changed after creation of the HostBuffer. If HostBuffer.emplace is given a ByteData that is larger than blockLengthInBytes, a new DeviceBuffer block is created that matches the size of the oversized ByteData.
Properties
- blockLengthInBytes → int
-
The length to use for each DeviceBuffer block.
final
- frameCount → int
-
The number of frames to cycle through before reusing device buffers.
Cycling to the next frame happens when reset is called.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
emplace(
ByteData bytes) → BufferView - Append byte data to the end of the HostBuffer and produce a BufferView that references the new data in the buffer.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Resets the bump allocator to the beginning of the first DeviceBuffer block.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- kDefaultBlockLengthInBytes → const int
- The default length to use for each DeviceBuffer block.