gpuconf

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

View Source
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.

View Source
var FrostedFooter = geom.R(0, 176, 320, 40)

FrostedFooter is a frosted bar (paint.BackdropBlur under a translucent fill) over the bottom of the scroll scene's viewport, drawn after it.

View Source
var Pink = color.NRGBA{0xff, 0x85, 0xc0, 255}

Pink is a color for changed content in the partial-frame checks.

Functions

func BlurPrecisionList

func BlurPrecisionList(radius float32) *paint.List

BlurPrecisionList is an opaque checkerboard (exact 8-bit colors in every renderer) under a square backdrop blur of radius.

func Conformance

func Conformance(t *testing.T, open func(t *testing.T) gpu.Device, opts ...Option)

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

func LayerComposite(ld gpu.LayerDesc, a float32) shaders.Instance

LayerComposite is a composite of layer ld (KindPatch, Kind.W = 1) covering its bounds with opacity a.

func PatchInstance

func PatchInstance(x, y, w, h float32, tex image.Point) shaders.Instance

PatchInstance draws the patch page's top-left w×h texels (of a tex-sized page) at x, y.

func ScrollList

func ScrollList(t testing.TB, off float32, extra func(*paint.List)) *paint.List

ScrollList is the scroll scene with its rows scrolled by off pixels; extra, when not nil, adds ops (hints) at the end.

func SolidPatch

func SolidPatch(w, h int, c color.RGBA) gpu.Upload

SolidPatch is an opaque w×h RGBA upload of c to the patch page at its origin.

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) Execute

func (lf *LastFrame) Execute(f *gpu.Frame) error

Execute implements gpu.Device.

func (*LastFrame) ReadPixels

func (lf *LastFrame) ReadPixels() (*image.RGBA, error)

ReadPixels implements gpu.PixelReader.

func (*LastFrame) Retained

func (lf *LastFrame) Retained(size image.Point) bool

Retained implements gpu.Retainer (false when the device is none).

type Option

type Option func(*suite)

An Option adjusts a Conformance run.

func Skip

func Skip(skip func(name string) bool) Option

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL