Documentation
¶
Overview ¶
Package gpuconf is the device conformance suite of the GPU renderer: Conformance runs the checks every gpu.Device backend (internal/render/gpu/metal, internal/render/gpu/d3d11, …) must pass on the same display lists, through gpu.Renderer and directly with hand-built gpu.Frames, comparing the read-back target with paint.CPU at the thresholds of package gputest. Backend-specific checks (presenters, texture counts, pool and scratch limits) stay in the backend's own tests. It is imported only by tests.
It is a package of its own, not part of gputest, because it imports package gpu, whose in-package tests import gputest (an import cycle).
Index ¶
- Variables
- func BlurPrecisionList(radius float32) *paint.List
- func Conformance(t *testing.T, open func(t *testing.T) gpu.Device, opts ...Option)
- func LayerComposite(ld gpu.LayerDesc, a float32) shaders.Instance
- func PatchInstance(x, y, w, h float32, tex image.Point) shaders.Instance
- func ScrollList(t testing.TB, off float32, extra func(*paint.List)) *paint.List
- func SolidPatch(w, h int, c color.RGBA) gpu.Upload
- type LastFrame
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( ScrollViewport = geom.R(0, 24, 320, 192) ScrollSize = geom.Size{W: 320, H: 480} )
Scroll scenes: a window-sized list of rows scrolled inside a clipped viewport, between a header and a footer.
FrostedFooter is a frosted bar (paint.BackdropBlur under a translucent fill) over the bottom of the scroll scene's viewport, drawn after it.
var Pink = color.NRGBA{0xff, 0x85, 0xc0, 255}
Pink is a color for changed content in the partial-frame checks.
Functions ¶
func BlurPrecisionList ¶
BlurPrecisionList is an opaque checkerboard (exact 8-bit colors in every renderer) under a square backdrop blur of radius.
func Conformance ¶
Conformance runs the device conformance suite as subtests of t. open returns a new, working device for the subtest it is given (skipping it when the platform has none, closing the device in t.Cleanup); each subtest opens its own. The device must implement gpu.PixelReader (every check reads the target back), or the subtest fails; the partial-frame subtests (Partial/…) run only when it implements gpu.Retainer.
Options (Skip) adjust the run; a backend still being written skips the subtests of features it does not support yet.
Besides the gpu.Frame contract the subtests check these behaviours, documented in package gpu (frame.go):
- a frame with a zero or negative Size succeeds and draws nothing;
- a zero MaskSize, ColorSize or RampSize is valid for a frame that neither uploads to nor samples that texture;
- ReadPixels fails before the first frame with pixels and after a failed Execute that recreated the target;
- a batch sampling a layer no earlier batch drew into fails Execute;
- a frame with Copies but no Dirty fails Execute;
- a partial frame on a target that does not hold the previous frame fails with gpu.ErrNotRetained.
Like every gputest user, the calling package pins the pure-Go text engine with gputest.Main in its TestMain; the SystemText subtest switches to the platform's engine for itself. Subtests do not run in parallel.
func LayerComposite ¶
LayerComposite is a composite of layer ld (KindPatch, Kind.W = 1) covering its bounds with opacity a.
func PatchInstance ¶
PatchInstance draws the patch page's top-left w×h texels (of a tex-sized page) at x, y.
func ScrollList ¶
ScrollList is the scroll scene with its rows scrolled by off pixels; extra, when not nil, adds ops (hints) at the end.
Types ¶
type LastFrame ¶
type LastFrame struct {
gpu.Device
Dirty int
Copies []gpu.CopyRegion
PartialCopies []gpu.CopyRegion
}
LastFrame forwards to a device (its gpu.Retainer and gpu.PixelReader included, so the Renderer redraws partially and verifies) and keeps the last frame's number of Dirty rectangles and its Copies.
In verify mode the Renderer follows every partial frame with a full one (Renderer.SetVerify), so Dirty and Copies then describe that full frame; PartialCopies keeps the Copies of the last partial frame (one with Dirty rectangles), which the verification frame does not replace.
func (*LastFrame) ReadPixels ¶
ReadPixels implements gpu.PixelReader.
type Option ¶
type Option func(*suite)
An Option adjusts a Conformance run.
func Skip ¶
Skip skips every subtest (at any depth) for which skip returns true. skip gets the subtest's name relative to the test calling Conformance, as its path of subtest names joined with "/" — for example "Scenes", "Scenes/images@1.5", "Partial/Scenes/image@2", "LayerUploadOrder" — and is asked at the start of every subtest, before it opens a device, so skipping a parent skips its children. Several Skip options combine: a subtest is skipped when any of them says so.