Documentation
¶
Overview ¶
Package fakedevice is an explicit.Device that records every call, for the unit tests of the explicit renderer without a GPU. It checks the design limits of SPEC §9.3 as the real backends do, so a renderer that breaks one fails its test with GPULimitExceeded.
Flutter: no counterpart
Index ¶
- func Bytes(b explicit.Buffer) []byte
- type BufferWrite
- type Call
- type Device
- func (d *Device) Begin() (explicit.Encoder, error)
- func (d *Device) Calls() []Call
- func (d *Device) Close() error
- func (d *Device) Closed() bool
- func (d *Device) CompleteReads()
- func (d *Device) Description() string
- func (d *Device) Limits() explicit.Limits
- func (d *Device) Live() Live
- func (d *Device) NewBindGroup(p explicit.Pipeline, group int, entries []explicit.Binding) (explicit.BindGroup, error)
- func (d *Device) NewBuffer(size int, usage explicit.BufferUsage) (explicit.Buffer, error)
- func (d *Device) NewPipeline(desc explicit.PipelineDesc) (explicit.Pipeline, error)
- func (d *Device) NewSampler(desc explicit.SamplerDesc) (explicit.Sampler, error)
- func (d *Device) NewSwapchain(h gpu.SurfaceHandle) (explicit.Swapchain, error)
- func (d *Device) NewTexture(desc explicit.TextureDesc) (explicit.Texture, error)
- func (d *Device) Ops() []string
- func (d *Device) Reset()
- func (d *Device) SetLimits(l explicit.Limits)
- func (d *Device) WriteBuffer(b explicit.Buffer, offset int, data []byte)
- func (d *Device) WriteTexture(t explicit.Texture, level int, r image.Rectangle, data []byte, stride int)
- type Live
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BufferWrite ¶
type BufferWrite struct {
// Offset is where the data went in the buffer.
Offset int
// Data is a copy of the bytes written.
Data []byte
// Usage is what the buffer was made for.
Usage explicit.BufferUsage
}
BufferWrite is one call of WriteBuffer.
Flutter: no counterpart
type Call ¶
type Call struct {
// Op is the name of the method: "NewBuffer", "BeginPass", "Draw", ...
Op string
// Args are the arguments, as text.
Args string
}
Call is one call the renderer made, in order. Op names the method and Args are its arguments in a readable form.
Flutter: no counterpart
type Device ¶
type Device struct {
// Err, when set, is what the next call that can fail returns, once.
Err error
// AcquireErrs are the errors that the next calls of Swapchain.Acquire return, one
// each, before it succeeds again.
AcquireErrs []error
// Rotation is the pre-rotation that the swapchains report after Configure, as Android's
// currentTransform does: with a quarter turn their images have the width and height swapped.
Rotation explicit.Rotation
// StaleOnce makes the next Present leave its swapchain stale, as Android's surface turning
// does: Stale is true until Configure, which then reports RotationAfter.
StaleOnce bool
RotationAfter explicit.Rotation
// CompleteReadsOnSubmit makes Submit run the done functions of the reads of the frame,
// as a device that waits for the GPU does.
CompleteReadsOnSubmit bool
// Name is what Description says.
Name string
// Writes are the calls of WriteBuffer, with a copy of their data.
Writes []BufferWrite
// Quiet stops the device from keeping the log of its calls and the copies of the buffer
// writes, so that a benchmark of the renderer counts what the renderer allocates and not
// what the log does.
Quiet bool
// contains filtered or unexported fields
}
Device is the fake device. The zero value is not usable; use New.
Flutter: no counterpart
func (*Device) CompleteReads ¶
func (d *Device) CompleteReads()
CompleteReads runs the done function of every ReadTexture that is waiting, as the GPU finishing the frame would. The real backends never call it inside the frame that asked, and neither does this: the test calls it after Submit.
Flutter: no counterpart
func (*Device) Description ¶
Description names the device, for the renderer's log.
Flutter: no counterpart
func (*Device) Live ¶
Live returns how many resources of each kind are alive.
Flutter: no counterpart
func (*Device) NewBindGroup ¶
func (d *Device) NewBindGroup(p explicit.Pipeline, group int, entries []explicit.Binding) (explicit.BindGroup, error)
NewBindGroup implements explicit.Device.
func (*Device) NewPipeline ¶
NewPipeline implements explicit.Device.
func (*Device) NewSampler ¶
NewSampler implements explicit.Device.
func (*Device) NewSwapchain ¶
NewSwapchain implements explicit.Device.
func (*Device) NewTexture ¶
NewTexture implements explicit.Device.
func (*Device) Reset ¶
func (d *Device) Reset()
Reset forgets the calls and the buffer writes made so far, for a benchmark that draws many frames.
Flutter: no counterpart
func (*Device) SetLimits ¶
SetLimits changes the limits the device checks, to test code that reads them.
Flutter: no counterpart
func (*Device) WriteBuffer ¶
WriteBuffer implements explicit.Device.
type Live ¶
type Live struct {
Buffers, Textures, Samplers, Pipelines int
}
Live is how many resources of each kind the device made that were not destroyed yet. A renderer that keeps making resources and never destroys them (a texture for each frame) shows here as a count that grows. Bind groups are not counted: the real devices take them from the pool of a frame, which is reset when the frame is done, and their Destroy does nothing.
Flutter: no counterpart