FakeBackend class final

A device that records rather than draws.

Implemented types

Constructors

FakeBackend({Set<String> missingShaders = const <String>{}, bool supportsWireframe = true})

Properties

completesImmediately bool
Whether onFrameComplete runs its callback at once.
getter/setter pair
createdTextures List<RenderTargetSpec>
final
defaultColorFormat TextureFormat
The colour format this device prefers.
no setteroverride
defaultDepthStencilFormat TextureFormat
The depth/stencil format this device prefers. Legitimately TextureFormat.unknown on a context that has none.
no setteroverride
depthRange DepthRange
What this backend's clip space maps depth onto.
no setteroverride
disposed bool
Whether dispose has been called, for a test that wants to assert a device was actually torn down rather than merely dropped.
getter/setter pair
framebufferOrigin FramebufferOrigin
The engine's own convention, so a fake never exercises the remap. The backends that need the other one are covered by running them.
no setteroverride
frames int
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hdrColorFormat TextureFormat
The format to render high dynamic range colour into.
no setteroverride
passes List<FakePass>
Every pass ever opened, in the order it was opened.
final
pendingFrames List<void Function()>
Frames whose work the GPU has not "finished".
final
preferredSampleCount int
Samples to use for multisampled targets, or 1 for none.
no setteroverride
releasedGeometry List<GeometryBuffer>
final
releasedTextures List<TextureHandle>
What was handed back one at a time, in the order it was handed back.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shaders FakeShaderLibrary
The compiled bundle this device was built with.
final
supportsCubeTextures bool
Whether a cube texture can be created and sampled.
no setteroverride
supportsMipmaps bool
True, because a fake has nothing to be incapable with. The real answer is a device property, and the two backends that have one disagree.
no setteroverride
supportsOffscreenMsaa bool
Whether a multisampled offscreen target is available at all.
no setteroverride
supportsWireframe bool
Settable, because the interesting case is the backend that says no — OpenGL ES has no glPolygonMode, and the engine is supposed to decline its own wireframe setting rather than let the request reach a backend that would refuse it mid-frame.
final
uploadedPixels List<ByteData>
The bytes of each of those, for a test that cares what colour it was.
final
uploadedTextures List<RenderTargetSpec>
Pixel uploads, in order, so a test can assert what reached the device.
final
uploads List<GeometryUsage>
Recorded with its usage, because a backend exists that cannot change its mind about one later.
final

Methods

beginFrame() → void
Tells the backend a new frame is starting.
override
beginRenderPass(RenderPassDescriptor descriptor) CommandEncoder
Opens a pass and returns the encoder that records into it.
override
createCubeTextureFromPixels({required int size, required TextureFormat format, required List<ByteData> faces, List<List<ByteData>>? mipLevels}) TextureHandle?
Uploads six square images as one cube texture.
override
createPipeline(ShaderHandle vertex, ShaderHandle fragment, {VertexLayoutSpec? layout}) PipelineHandle
Links two stages into something that can be bound.
override
createTexture(RenderTargetSpec spec) TextureHandle
A brand-new texture matching spec, with the single TextureHandle that will ever stand for it.
override
createTextureFromPixels({required int width, required int height, required TextureFormat format, required ByteData pixels, List<ByteData>? mipLevels}) TextureHandle?
Creates a texture already holding pixels.
override
dispose() → void
Releases every persistent resource this device holds — the textures and geometry buffers handed out by createTexture, createTextureFromPixels, createCubeTextureFromPixels and uploadGeometry.
override
finishOldestFrame() → void
Lets the oldest unfinished frame complete.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFrameComplete(void whenDone()) → void
Runs whenDone once the GPU has finished with the frame being encoded now.
override
present(TextureHandle frame, {BoxFit fit = BoxFit.fill, FilterQuality quality = FilterQuality.none}) Widget
Nothing was drawn, so there is nothing to show, and pretending otherwise would be worse than refusing: a test handed a blank widget could assert something about a frame that never existed. Nothing under test here reaches this — only an application does, once per frame.
override
readPixels(TextureHandle texture) Future<ByteData?>
Null, which is a legitimate answer rather than a refusal: it is what a real device says about a texture whose pixels cannot be read.
override
releaseGeometry(GeometryBuffer geometry) → void
Releases one geometry buffer, rather than waiting for the whole device to go.
override
releaseTexture(TextureHandle texture) → void
Gives one back, rather than waiting for the whole device to go.
override
toString() String
A string representation of this object.
inherited
uploadGeometry(ByteData bytes, GeometryUsage usage) GeometryBuffer
Uploads geometry that will outlive the frame.
override

Operators

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