GpuDevice class abstract interface

A GPU the renderer draws with.

This is the only layer that knows a GPU API. Today the backend is Flutter GPU (flutter_gpu); a WebGL2 backend can implement the same interface later. A null backend records commands for unit tests.

Objects it hands out are released when they become unreachable; there is nothing to destroy explicitly.

Implementers

Properties

caps → GpuCaps
What this device can do.
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

beginFrame() → void
Starts a frame — each view drawn is one. Call before recording it.
commands() → GpuCommands
A list of commands to record and submit.
createBuffer(ByteData data) → GpuBuffer
A buffer holding data, for vertices or indices that do not change.
createHostBuffer(int sizeInBytes) → GpuBuffer
A buffer of sizeInBytes the CPU can rewrite (GpuBuffer.write).
createSurface(int width, int height) → GpuSurface
A presentable target Flutter draws as a ui.Image.
createTexture(GpuTextureDesc desc) → GpuTexture
A texture.
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.
loadShaderLibrary(String fileName) → Future<GpuShaderLibrary>
Loads the package shader bundle fileName (for example core.shaderbundle) once.
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).
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.
toString() → String
A string representation of this object.
inherited

Operators

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