NullGpuDevice class final

A GpuDevice that draws nothing and records what it was asked to do.

Renderer logic (sorting, batching, uniform packing, culling) is tested on it without a GPU, and it stands in when no GPU is available, so code that renders keeps running headless. log holds one line per command.

Implemented types

Constructors

NullGpuDevice({GpuCaps caps = GpuCaps.all, Map<String, Map<String, NullUniformBlock>> shaders = const {}})
A null device reporting caps, whose shader libraries hold shaders (name → uniform blocks, each block name → member offsets and size).

Properties

caps → GpuCaps
What this device can do.
final
drawCount → int
Draw commands recorded since the last clearLog.
no setter
frameBytes ↔ int
Bytes copied through frameData since the last beginFrame.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
log → List<String>
Every command, in order.
final
pipelineCount → int
How many pipelines were created (each distinct one counts once).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shaders → Map<String, Map<String, NullUniformBlock>>
Shader name → its uniform blocks by GLSL type name.
final

Methods

beginFrame() → void
Starts a frame — each view drawn is one. Call before recording it.
override
clearLog() → void
Empties log.
commands() → GpuCommands
A list of commands to record and submit.
override
createBuffer(ByteData data) → GpuBuffer
A buffer holding data, for vertices or indices that do not change.
override
createHostBuffer(int sizeInBytes) → GpuBuffer
A buffer of sizeInBytes the CPU can rewrite (GpuBuffer.write).
override
createSurface(int width, int height) → GpuSurface
A presentable target Flutter draws as a ui.Image.
override
createTexture(GpuTextureDesc desc) → GpuTexture
A texture.
override
frameData(ByteData data) → GpuBufferView
Copies data into this frame's transient memory, aligned for use as uniforms, vertices or indices. A commands list made or submitted during the frame keeps it from being written again until the GPU has finished that list.
override
loadShaderLibrary(String fileName) → Future<GpuShaderLibrary>
Loads the package shader bundle fileName (for example core.shaderbundle) once.
override
maxMipLevels(int width, int height) → int
The most mip levels a width × height texture may have here. Flutter GPU allows floor(log2(min(width, height))), one fewer than a full chain (flutter/flutter#186176).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pipeline(GpuShader vertex, GpuShader fragment, {GpuVertexLayout? layout}) → GpuPipeline
The pipeline for vertex and fragment reading layout (null: the vertex shader's inputs, interleaved in declaration order). Cached: the same arguments return the same pipeline.
override
toString() → String
A string representation of this object.
inherited

Operators

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