Documentation
¶
Overview ¶
Package gputest has what the display tests of the GPU renderers share: the scenes the renderers are compared on, the comparison with the software renderer's image, and its tolerance. It is test support and has no Flutter counterpart.
Index ¶
- Constants
- Variables
- func CanvasScene(fn func(c *ui.Canvas)) *ui.Scene
- func DamagePicture(rect ui.Rect) *ui.Picture
- func DamageScene(pics ...*ui.Picture) *ui.Scene
- func EvenStops(n int) []float64
- func FillPaint(argb uint32) *ui.Paint
- func ImageScene(pix []byte, quality ui.FilterQuality) *ui.Scene
- func Pattern(n int) *ui.Image
- func PictureOf(fn func(c *ui.Canvas)) *ui.Picture
- func RetainedFrames(n int, clip func(b *ui.SceneBuilder)) []*ui.Scene
- func Scale4(s float32) *ui.Matrix4
- func ScrolledList(rows int, scroll float64) *ui.Scene
- func ShaderPaint(sh ui.Shader) *ui.Paint
- func StarPath() *ui.Path
- func StripesAndDisc(c *ui.Canvas)
- func StrokePaint(argb uint32, width float64, cap ui.StrokeCap, join ui.StrokeJoin) *ui.Paint
- func TextureScene(id int64, quality ui.FilterQuality) *ui.Scene
- type CullShape
- type CullTransform
- type Diff
- type EffectScene
- type ShapeScene
- type TextureCase
- type TextureKind
- type Tolerance
Constants ¶
const ( ScrolledWidth = 800 ScrolledHeight = 600 ScrolledRowHeight = 48 )
The size of the viewport of ScrolledList, and the height of one of its rows.
const EffectSize = 128
EffectSize is the width and height of the surface of the effect scenes.
const ShapeSize = 128
ShapeSize is the width and height of the surface of the shape scenes.
const TextureSize = 8
TextureSize is the side of the textures of the texture tests, in texels.
const TextureWindow = 128
TextureWindow is the side of the window of the texture tests, in pixels.
Variables ¶
var ProofTolerances = map[string]Tolerance{
"shapes-basic": {Over8Permille: 20, Over32Permille: 5},
"shapes-clips": {Over8Permille: 30, Over32Permille: 3},
"gradients": {Over8Permille: 10, Over32Permille: 3},
"blend-modes": {Over8Permille: 15, Over32Permille: 5},
"effects": {Over8Permille: 1},
"text-tour": {Over8Permille: 1},
"decorations": {Over8Permille: 3, Over32Permille: 1},
"rendering-tour": {Over8Permille: 1},
}
ProofTolerances is how far the GPU renderers may be from the software renderer in each proof scene (the scenes are the goldens of the proof tool, SPEC §9.2). A scene that is registered without an entry here fails the parity tests, so a step that adds one states its tolerance.
Flutter: no counterpart
var ScenesTolerance = Tolerance{Over8Permille: 12, Over32Permille: 6, Over96: 40}
ScenesTolerance is how far the picture of a scene of internal/scenetest (viewport3d, SPEC §27.12) on a backend may be from its golden, which Vulkan on lavapipe made: the backends compile the shaders in their own ways and place the samples of the multisampling in their own ways, so the edges differ a little.
Functions ¶
func CanvasScene ¶
CanvasScene is a scene of one picture: a white background, then what fn draws.
func DamagePicture ¶
DamagePicture is a picture of one rectangle, for the tests of damage tracking.
Flutter: no counterpart
func ImageScene ¶
func ImageScene(pix []byte, quality ui.FilterQuality) *ui.Scene
ImageScene draws the pixels as an image in the layers of the tests: what TextureScene must look like.
func Pattern ¶
Pattern is an n x n image of a color gradient with a grid and a transparent corner, to show orientation, filtering and alpha.
func RetainedFrames ¶
func RetainedFrames(n int, clip func(b *ui.SceneBuilder)) []*ui.Scene
RetainedFrames makes the scenes of a retained layer: the layer is built in the first and added again in the others, as a RepaintBoundary that does not change.
Flutter: no counterpart
func ScrolledList ¶
ScrolledList is a tall list drawn through a viewport: rows rows of ScrolledRowHeight pixels, each with an icon made of curves (filled), a stroked outline with round joins, an arc and a dotted line, the way a page of icons and SVG pictures draws, clipped to the viewport of ScrolledWidth x ScrolledHeight pixels and moved up by scroll pixels. Only the rows in the viewport are visible; the rest are what a renderer must skip cheaply. It is for the benchmarks and the culling tests of the GPU renderers.
Flutter: no counterpart
func StripesAndDisc ¶
StripesAndDisc is something with an edge and a gradient to put layers over.
func StrokePaint ¶
StrokePaint is a stroking paint of the color with the width, cap and join.
func TextureScene ¶
func TextureScene(id int64, quality ui.FilterQuality) *ui.Scene
TextureScene shows the registered texture in the layers of the tests.
Types ¶
type CullShape ¶
type CullShape struct {
Name string
// Atlas says that the renderers draw the shape from the coverage atlas, so that drawing it in
// view asks the atlas for tiles.
Atlas bool
Draw func(c *ui.Canvas, r ui.Rect, p *ui.Paint)
}
CullShape is one kind of shape command for the culling tests of the GPU renderers: Draw draws a shape that fits the rectangle with the paint.
func CullShapes ¶
func CullShapes() []CullShape
CullShapes are the kinds of shape commands that culling decides about.
type CullTransform ¶
CullTransform is a transform the culling tests draw under.
func CullTransforms ¶
func CullTransforms() []CullTransform
CullTransforms are a translation, a scale and a rotation (and no transform).
type Diff ¶
type Diff struct {
Pixels, Over8, Over32, Over96, Max int
}
Diff compares two images inside a rectangle: the number of pixels whose largest channel difference is above each threshold, and the largest difference.
type EffectScene ¶
type EffectScene struct {
Name string
Tolerance Tolerance
// Build makes the scene, EffectSize pixels square.
Build func() *ui.Scene
}
EffectScene is a drawing of the paint shaders, color filters, blend modes and layers, with the tolerance the GPU renderers are held to against the software renderer.
func EffectScenes ¶
func EffectScenes() []EffectScene
EffectScenes returns the drawings of gradients, image shaders, color filters, blend modes, vertices and layers that both GPU renderers are compared with the software renderer on.
type ShapeScene ¶
type ShapeScene struct {
Name string
// Over8Permille, Over32Permille and Over96 are the Tolerance.
Over8Permille, Over32Permille, Over96 int
Draw func(c *ui.Canvas)
}
ShapeScene is a drawing of analytic shapes on a surface of ShapeSize pixels, with the tolerance the GPU renderers are held to against the software renderer.
func ShapeScenes ¶
func ShapeScenes() []ShapeScene
ShapeScenes returns the drawings of shapes, clips and the blend modes of the blend unit that both GPU renderers are compared with the software renderer on.
func (ShapeScene) Tolerance ¶
func (s ShapeScene) Tolerance() Tolerance
Tolerance returns the scene's tolerance.
type TextureCase ¶
type TextureCase struct {
Name string
Kind TextureKind
Quality ui.FilterQuality
Tolerance Tolerance
// Texels is the content of the texture, in the layout of its format.
Texels []byte
// Reference is the same picture as sRGB-encoded RGBA8 pixels, which the software renderer draws as an image.
Reference []byte
}
TextureCase is one texture of the tests, how it is sampled, and how far the GPU may be from the software image.
func TextureCases ¶
func TextureCases() []TextureCase
TextureCases returns the textures of the tests.
type TextureKind ¶
type TextureKind int
TextureKind says how a texture of the tests stores its texels.
const ( // TextureRGBA8 is RGBA8Unorm with sRGB-encoded values. TextureRGBA8 TextureKind = iota // TextureBGRA8 is BGRA8Unorm with sRGB-encoded values. TextureBGRA8 // TextureRGBA16F is RGBA16Float with linear values. TextureRGBA16F )
The kinds of texture of the tests.
func (TextureKind) TexelBytes ¶
func (k TextureKind) TexelBytes() int
TexelBytes is the size of a texel of the kind.
type Tolerance ¶
type Tolerance struct{ Over8Permille, Over32Permille, Over96 int }
Tolerance is how far a GPU image may be from the software renderer's in a region: of its pixels, at most Over8Permille differ by more than 8 levels (the edges, where the distance field and the exact area differ a little), at most Over32Permille by more than 32, and at most Over96 pixels by more than 96.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package editorscene makes the scenes of a frame in which only the caret of a text editor blinks, for the allocation tests and benchmarks of the renderers (SPEC §15, step 29.15).
|
Package editorscene makes the scenes of a frame in which only the caret of a text editor blinks, for the allocation tests and benchmarks of the renderers (SPEC §15, step 29.15). |