gpu

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 18 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 gpu is the device-independent half of Tango's GPU renderer.

Renderer turns a paint.List into a Frame: instances of the quad uber-shader (internal/render/gpu/shaders) grouped into scissored batches, plus the texture uploads they sample. A Device (Metal, …) executes the Frame. The package itself never touches a GPU API, so the whole pipeline can be tested on the CPU with internal/render/gpu/cpuexec.

Index

Constants

View Source
const (
	TexMask  = 0 // R8 glyph atlas (shaders.Mask): its pages stacked vertically, 1 byte per texel
	TexColor = 1 // premultiplied RGBA patch page (shaders.Color), 4 bytes per texel
	// TexRamp holds the gradient color ramps (shaders.Ramp, sampled with
	// linear filtering): one row of paint.RampWidth premultiplied RGBA16Unorm
	// texels per gradient, 8 bytes per texel (4 little-endian uint16).
	TexRamp = 2
	// TexImage is the slot of the per-batch image texture (shaders.Img,
	// Batch.Image). Image textures are not written with Upload but created
	// whole by Frame.ImageUploads.
	TexImage = 3
	// TexLayer is the slot of the offscreen layer a batch's layer
	// composites sample (shaders.Layer, Batch.Layer). Layers are drawn by
	// the frame's batches (Batch.Target), never uploaded.
	TexLayer = 4
)

Texture indices for Upload.Tex; they match the quad shader's texture slots.

Variables

View Source
var (
	// ErrDeviceLost is wrapped by the errors a Device's Execute (so the
	// Renderer's Render) and its presenter return once the GPU is
	// unusable: the device was removed or reset, the app's GPU access was
	// revoked, or several frames in a row failed. It is permanent for that
	// Device; switch to the CPU renderer.
	ErrDeviceLost = errors.New("gpu: device lost")
	// ErrTargetTooLarge is wrapped by the error a Device's Execute (so the
	// Renderer's Render) returns for a frame whose render target, or a
	// texture it samples, exceeds the device's 2D texture limit (16384 on
	// every Mac GPU family and on D3D11 feature level 11): for example a
	// window wider than 16384 device pixels. Nothing is allocated or
	// submitted and the frame is not a GPU failure (it never leads to
	// ErrDeviceLost); the device keeps working for frames of a valid size.
	// Draw such a frame with the CPU renderer.
	ErrTargetTooLarge = errors.New("gpu: frame larger than the device texture limit")
)

Device errors shared by every backend (internal/render/gpu/metal, internal/render/gpu/d3d11, …), so a caller choosing between the GPU and the CPU renderer tests one value whichever device it opened. Backends wrap them with details and may re-export them under their own names (metal.ErrDeviceLost is gpu.ErrDeviceLost).

View Source
var ErrNotRetained = errors.New("gpu: device does not retain the previous frame")

ErrNotRetained is returned (wrapped) by a device asked to execute a partial frame (Frame.Dirty) whose target does not hold the previous frame's pixels; the Renderer then draws the whole frame.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	// Uploads are applied, in order, after every earlier batch has been
	// drawn and before this batch is drawn: the Renderer reuses the patch
	// page within a frame when it fills up, so a Device must keep uploads
	// and draws in command order (for example by copying from a staging
	// buffer with a blit encoded between the draws), not write the texture
	// while earlier draws may still read it. Usually empty.
	Uploads   []Upload
	Instances []shaders.Instance
	// Image is the ID of the image texture (ImageUpload) bound to TexImage
	// for this batch's KindImage instances; 0 when the batch has none (the
	// device binds any texture, which nothing samples).
	Image int
	// Scissor is the device-pixel rectangle drawing is limited to, in
	// main-target coordinates also when Target is a layer (the device
	// shifts it by the layer's -Bounds.Min and clips it to the layer); the
	// empty rectangle means the whole target.
	Scissor image.Rectangle
	// Target is the render target the batch draws into: 0 the frame's
	// target, n > 0 the layer Frame.Layers[n-1].
	Target int
	// Layer is the layer (n > 0: Frame.Layers[n-1]) bound to TexLayer for
	// the batch's layer composites (KindPatch instances with Kind.W = 1);
	// 0 when the batch has none. A batch never samples its own Target, and
	// only layers an earlier batch of the frame has drawn into: a device
	// rejects a frame whose batch samples a layer nothing drew into
	// (Execute returns an error).
	Layer int
	// Grab, when n > 0, makes the batch a backdrop copy instead of a draw
	// (a backdrop blur reads the target as drawn so far; see
	// paint.BackdropBlur): after every earlier batch has been drawn, layer n
	// is cleared to transparent (all of its texture) and the
	// device copies the pixels of Frame.Layers[n-1].Bounds (main-target
	// coordinates) from the batch's Target — the frame's target, or the
	// layer Target names — into layer n, whose texel (0, 0) receives
	// Bounds.Min. Bounds lies inside what the Target holds (the frame, or
	// the Target layer's Bounds); Grab never equals Target. The copy counts
	// as drawing into layer n (a later batch may sample it), and a frame's
	// partial-redraw scissors do not apply to it: in a partial frame it
	// copies the target's current pixels, retained ones included. A grab
	// batch has no Instances, Uploads, Scissor, Image or Layer. The
	// Renderer emits one before the blur passes of each BackdropBlur.
	Grab int
}

Batch is a run of instances drawn with one scissor rectangle.

type BudgetPolicy

type BudgetPolicy struct {
	AtlasMaxPages   int
	AtlasIdleFrames uint32
	ImageMaxBytes   int64
	ImageIdleFrames uint64
	LayerMaxBytes   int64
}

BudgetPolicy controls rebuildable GPU residency. It is internal and has no effect on renderer selection.

type CopyRegion

type CopyRegion struct {
	Src, Dst image.Rectangle
}

CopyRegion copies the pixels of Src to Dst (same size; both inside the frame's target).

type Device

type Device interface {
	Execute(f *Frame) error
}

Device executes frames on a GPU (or, in tests, on the CPU).

Batches run in order, each into its Target (see Frame.Layers): a device may split the frame into render passes wherever the target changes or a batch has Uploads, but must keep every batch's draws after those of the batches before it.

Texture contract: textures persist across frames until the Frame says otherwise. An ImageUpload whose ID the device already holds replaces that texture in place (contents and size), without an ImageFrees entry first: after a failed Execute the Renderer cannot know whether the frame's uploads arrived, so it uploads the image again under the same ID, and the device must then sample the new pixels, not the old ones (TestImageReuploadReplacesHeldTexture). Likewise an Upload overwrites its rectangle, and a changed MaskSize, ColorSize or RampSize recreates that texture.

type Frame

type Frame struct {
	// Size is the render target size in device pixels. A frame with a
	// zero or negative dimension has no pixels: Execute returns nil
	// without drawing or submitting anything.
	Size image.Point
	// Clear is the color the target is cleared to first: all of it, or in
	// a partial frame (see Dirty) only the Dirty rectangles.
	Clear color.NRGBA
	// Dirty, when not empty, makes the frame partial: the frame's target
	// keeps the pixels of the previous frame (the Renderer sends a partial
	// frame only to a Retainer that reports them retained), Copies are
	// applied, then only the Dirty rectangles are cleared to Clear and
	// drawn: every batch drawing into the frame's target is drawn once per
	// Dirty rectangle with its scissor intersected with that rectangle.
	// Dirty rectangles are disjoint, inside the target and at most
	// maxDirty. Layers are drawn as in a full frame. A device that does not
	// hold the previous frame (its target was recreated, or a frame failed
	// in a way that may have touched the target) returns an error wrapping
	// ErrNotRetained without drawing anything.
	Dirty []image.Rectangle
	// Copies move pixels within the frame's target before anything is
	// cleared or drawn (partial frames only). Every Src reads the pixels
	// as they were before any copy of the frame (a copy's own Src and Dst
	// may overlap), and the copies never overlap each other: no copy's Src
	// or Dst overlaps another copy's Src or Dst (the Renderer drops
	// overlapping ScrollRegions), so their order does not matter. A frame
	// with Copies but no Dirty is invalid: the device returns an error
	// instead of executing it as a full frame (which would clear the
	// target and drop the copies).
	Copies []CopyRegion
	// Uploads are applied, in order, before any batch is drawn (and before
	// the first batch's own Uploads).
	Uploads []Upload
	Batches []Batch
	// MaskSize, ColorSize and RampSize are the sizes of the TexMask,
	// TexColor and TexRamp textures. When one changes the device recreates
	// that texture; the old contents are dropped and the Renderer
	// re-uploads what it samples. A zero size is valid for a frame that
	// neither uploads to nor samples that texture (the device binds a
	// placeholder).
	MaskSize, ColorSize, RampSize image.Point
	// ImageFrees are image texture IDs the device releases, then
	// ImageUploads are created; both before Uploads and any batch. An ID
	// is never reused after it is freed.
	ImageFrees   []int
	ImageUploads []ImageUpload
	// Layers are this frame's offscreen layers (Batch.Target,
	// Batch.Layer): layer n is Layers[n-1]. A layer exists for this frame
	// only. It is transparent before the first batch drawing into it; a
	// device allocates its texture at that batch (one no batch draws into
	// needs none) and may give the texture to another layer, of the same
	// Size, once no later batch draws into or samples the layer.
	//
	// A device may also back a layer with a larger texture (one pooled for
	// a larger group): the layer then occupies the texture's top-left
	// Size texels, the batches drawing into it run with ViewSize the
	// texture's size, and the device rescales the UVs (and the half-texel
	// in Kind.Y, Kind.Z) of the layer composites sampling it, which the
	// Renderer normalizes by Size, to the texture's size.
	//
	// A batch drawing into a layer runs the quad shader with
	// shaders.FrameU.ViewSize the layer's Size (or its texture's size, see
	// above) and FrameU.Origin its
	// Bounds.Min, so instance geometry stays in main-target device pixels
	// (and so do the pixel positions the shader evaluates gradients,
	// dithering and checkerboards at, as paint.CPU evaluates them inside
	// groups); for the frame's target Origin is zero.
	Layers []LayerDesc
}

Frame is everything a Device needs to draw one frame. The Renderer reuses it between frames: a Device must not keep references to it (or to its slices) after Execute returns.

type ImageUpload

type ImageUpload struct {
	ID     int
	Size   image.Point
	Pix    []byte
	Stride int
}

ImageUpload creates the image texture ID (replacing a texture of that ID the device holds) of Size texels from premultiplied RGBA pixels: row y starts at Pix[y*Stride:] and holds Size.X texels of 4 bytes. The device keeps the texture across frames until ImageFrees names its ID.

type LayerDesc

type LayerDesc struct {
	Size   image.Point
	Bounds image.Rectangle // device pixels, main-target coordinates
}

LayerDesc describes an offscreen layer: a premultiplied RGBA8 render target the Renderer draws an opacity group into, then composites onto the target that encloses the group (see Frame.Layers).

The layer holds the device pixels of Bounds (main-target coordinates): Bounds.Min is its texel (0, 0). Size is the layer texture's size, at least Bounds.Size() (the Renderer rounds it up so a device can reuse textures of one size for different groups); texels beyond Bounds are never sampled.

type PixelReader

type PixelReader interface {
	ReadPixels() (*image.RGBA, error)
}

PixelReader is implemented by a Device that can read its frame target back (premultiplied RGBA of the last frame's Size): the Renderer's verify mode (SetVerify) uses it to compare a partial redraw with a full one. ReadPixels returns an error when the target holds no completed frame: before the first frame with pixels, and after a failed Execute that recreated the target (whose contents are then undefined).

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer implements paint.Renderer on top of a Device.

Mapping of display-list ops:

  • FillRect: one KindSolid instance (rounded corners by the shader's SDF).
  • StrokeRect: one KindStroke instance (shaders.StrokeCoverage, the formula paint.CPU draws with): width and dash pattern in device pixels; only the first 4 dash entries are carried (paint.CPU truncates the same way).
  • Text: one KindMask instance per glyph. The glyph's mask (paint.CPU.GlyphMask, placed by paint.GlyphPlacement exactly as paint.CPU does; TextGamma already applied) lives in the persistent mask atlas (internal/render/gpu/atlas), so only newly inserted glyphs are uploaded. The atlas entry holds the mask's offset from the pen, so a glyph found there is placed without asking paint.CPU again (one map lookup per glyph); empty glyphs (spaces) are remembered too. A glyph not in the atlas is culled before it is rasterized when the square of glyphReach ems (times 1+|Skew|) plus 2 pixels around its pen position misses the scissor; one in the atlas is culled by its exact box. A glyph the atlas cannot take (larger than a page, or no page left that this frame does not use) is drawn as a patch instead.
  • FillPath: one KindMask instance sampling the path's coverage mask (paint.CPU.PathMask: what paint.CPU fills with) in the mask atlas, cached by (Path pointer, device transform, scale) — so the same *Path must not change content (see paint.FillPath) — and rasterized only on a miss. Under a transform the key holds the transform's linear part and its translation's subpixel phase (1/4 px), and the mask is placed at the translation's whole pixels (see pathMask), so an icon's cached Path drawn inside a Translate is rasterized once for every whole-pixel position. Paths whose device bounds miss the scissor are not rasterized. A mask larger than an atlas page, or one the atlas has no room for this frame, is a patch.
  • ShadowRect: one KindShadow instance (shaders.ShadowCoverage, the formula paint.CPU's shadow masks hold) on the device geometry paint.ShadowPlacement gives (rectangle snapped to pixels, radii and sigma quantized as paint.CPU's mask cache keys them); a shadow without blur is a KindSolid instance like FillRect.
  • Gradient and LinearGradient (a two-stop linear Gradient) with a rect shape: one KindGradient instance. The stops' color ramp (paint.GradientRamp, premultiplied by paint.RampPremul) lives in a row of the ramp texture (TexRamp, rampCache: one row per distinct stop set, LRU over rampRows rows, uploaded only when written); the shader evaluates shaders.GradientT (paint.GradientT) at the pixel center, samples the row with linear filtering and applies a 4×4 ordered dither before the 8-bit write, which paint.CPU reproduces with paint.RampSample, paint.Dither4x4 and paint.DitherPremul. The ramp texture is RGBA16Unorm so low-contrast gradients keep sub-level steps for the dither to spread. A gradient with a Path shape is the same instance over the path's cached coverage mask (as FillPath's; Kind.W = 1, the mask's atlas rectangle in Dash), which multiplies the dithered ramp color. One beyond the rows the frame's other gradients leave, or whose path mask the atlas does not take, is a patch.
  • Checker: one KindChecker instance (paint.CheckerSelect per pixel; the two colors in Color and Dash).
  • Image: one KindImage instance on the device rectangle (radii as FillRect's), batched with its image's texture (Batch.Image, bound to TexImage): the shader filters it with shaders.SampleCatmullRom (paint.SampleCatmullRomF, what paint.CPU draws images with) at the pixel center. The texture holds paint.PrepareImage's pixels (premultiplied RGBA, reduced first per paint.ImageReduction) and is cached by image value and reduction size (imageCache): uploaded once (Frame.ImageUploads), freed after imageIdleFrames unused frames, when the cache exceeds imageCacheBytes, or by InvalidateImage (Frame.ImageFrees). An image over maxImageSide texels on a side, or beyond the frame's upload budget (64 MB by default; logged once), is a patch that frame.
  • PushOpacity…Pop groups, as paint.CPU draws them (the body drawn without the enclosing rounded clips, then composited through them with the alpha quantized to 8 bits): a group whose alpha quantizes to 0 draws nothing, one at 255 draws its body directly (unless it holds a rounded clip inside an enclosing rounded clip: then it takes a layer, so both apply). A group whose body is a single drawing op whose instance multiplies Color (FillRect, StrokeRect, ShadowRect, FillPath, Checker, one glyph of Text; clips around it allowed, but no rounded clip inside a rounded clip) draws that op directly with its color scaled by the alpha (no layer). Any other group is drawn natively into an offscreen layer (Frame.Layers: the group's device bounds within the scissor, Size rounded up to layerAlign) and composited by one KindPatch instance with Kind.W = 1 sampling the layer (TexLayer) with Color = alpha, under the enclosing clip. Groups nest (a layer drawn into a layer). Before the frame is executed, batches drawing into layers are moved ahead of the frame target's batches (see hoistLayers), so the target is drawn in one render pass however many groups the frame has.
  • PushTransform…Pop groups: the Renderer keeps the composed transform on its clip stack. Under a transform that only translates and scales uniformly by a positive factor (nativeXform; paint.CPU's own fast path) the body is drawn natively, as paint.CPU draws it: rects, radii, stroke widths, dashes, shadows, images and clips are mapped (mapOp, paint.CPU's execTransformed operation for operation); glyphs are placed and sized at the device scale·m.A with the translation added (glyphPlace, as paint.CPU's text); paths as above; gradients and checkers with mapped points, rects and cells. A subtree whose composed transform rotates, skews, mirrors or scales non-uniformly is rasterized whole by paint.CPU.RenderRegion (with the enclosing transform pushed first) into a patch in the RGBA patch page and drawn as KindPatch instances. A transform composing to the identity is ignored (its body draws natively). Every patch drawn under a native transform (an op the atlas, ramp or image cache does not take) carries that transform the same way.
  • BackdropBlur: run as paint.CPU runs it (paint.PlanBackdropBlur; see blur.go): a grab batch (Batch.Grab) copies the plan's source pixels from the current target into a layer, the downsampling pass (when the plan downsamples) and the horizontal and vertical blur passes each draw one shaders.BlurPass instance into a layer of the reduced size, and one composite instance draws the result into the current target under the current clip. Mapped like an Image under a native transform; inside a non-native one (a patch) paint.CPU draws nothing for it.
  • Ops this Renderer does not know (added to paint later; see opHandling) are patches too, over the whole scissor, and an unknown Push… op's whole group is one patch; hint ops (Damage, ScrollRegion) draw nothing: they drive partial redraws (damage.go, Frame.Dirty, Frame.Copies) on a Device that is a Retainer.
  • Ops added by pointer (&paint.FillRect{…}, &paint.PushClip{…}, &paint.Pop{} …) are dereferenced first and drawn exactly as the same ops added by value; a nil pointer op draws nothing. (paint.CPU matches op values only and skips pointer ops, so add ops by value.)
  • PushClip/Pop: a clip stack. Every clip's device rectangle (rounded as paint.CPU rounds it) is intersected into the batch scissor; the innermost rounded clip also goes to the instances' Clip/ClipRadii. Known limitation: with more than one rounded clip active, the corners of the outer rounded clips are clipped as plain rectangles for solid and glyph instances and for patches.

The patch page is one square texture, shelf-packed from empty every frame. It starts at patchPageMin texels and doubles (up to patchPageMax) after a frame that had to flush it, so a small UI keeps a small texture. When a patch does not fit, the page is flushed: packing restarts at the top, the following patch uploads go into Batch.Uploads of a new batch (applied after the earlier batches have drawn), and drawing continues; a patch larger than the page is split into page-sized tiles, each its own instance. So the texture never grows and any amount of patch area renders. Unused pages are allocated on first use and released after patchIdleFrames rendered frames without a patch.

Clip and opacity nesting is as tolerant as paint.CPU: extra Pops are ignored, unclosed pushes end with the list, and the depth is unbounded. Renderer is not safe for concurrent use.

func NewRenderer

func NewRenderer(dev Device) *Renderer

NewRenderer returns a Renderer drawing through dev.

func (*Renderer) InvalidateImage

func (r *Renderer) InvalidateImage(img image.Image)

InvalidateImage drops everything cached for img (by its image.Image value): its GPU textures, freed with the next frame, and paint.CPU's prepared pixels for patches. Call it after changing an image's pixels in place; the next frame drawing img uploads its current pixels.

func (*Renderer) Render

func (r *Renderer) Render(l *paint.List, size geom.Size, scale float32) error

Render converts l into a Frame and executes it on the device. A frame with no pixels (width or height 0 after scaling) is skipped without calling the device. When l carries redraw hints and the device retains its target, only the damaged part is redrawn (see damage.go); a partial frame whose hints leave nothing to redraw is not executed at all.

func (*Renderer) ResourceStats

func (r *Renderer) ResourceStats() ResourceStats

ResourceStats returns the latest internal residency/churn snapshot. It is intentionally an internal diagnostic seam; callers must not mutate it.

func (*Renderer) SetVerify

func (r *Renderer) SetVerify(on bool)

SetVerify turns verify mode on or off. In verify mode every partial redraw is checked: after it executes, the whole frame is drawn too and the two targets (read back with PixelReader; a device without it is not checked) are compared pixel for pixel (tolerance: see verifyPartial); a difference, which usually means the List's hints missed a change, is a *VerifyError that Render returns or logs (SetVerifyStrict). Verify mode is on by default except in builds with the tango_release tag; it costs two read-backs and a full frame per partial frame.

func (*Renderer) SetVerifyStrict

func (r *Renderer) SetVerifyStrict(on bool)

SetVerifyStrict sets what a verify mode difference does: strict, Render returns the *VerifyError (and the next frame is drawn in full); not strict, Render logs it (at most once every verifyLogEvery frames, with the count of the others) and returns nil, so the frame — the device's target holds the correct full redraw by then — is presented. The default is strict in test binaries (testing.Testing) and not strict otherwise: ui.Runner does not present a frame whose Render failed, so a strict development build would drop correctly drawn frames.

func (*Renderer) Trim

func (r *Renderer) Trim()

Trim releases what the renderer caches and can rebuild, for a low-memory warning (docs/specs/mobile-canvas.md §3.4): the glyph and path mask atlas shrinks to one empty page, optional ramp and patch pages are dropped, and every image texture is freed. The next frame re-rasterizes and re-uploads what it draws (the whole mask atlas texture, at its new size), so it costs more than usual but draws the same pixels. Main thread, between frames.

func (*Renderer) VerifyFailures

func (r *Renderer) VerifyFailures() (int, *VerifyError)

VerifyFailures returns how many partial frames verify mode found to differ from the full frame, and the last difference (nil if none).

type ResourceStats

type ResourceStats struct {
	AtlasPages        int
	AtlasBytes        int64
	ImageCount        int
	ImageBytes        int64
	RenderTargetBytes int64
	Uploads           uint64
	Evictions         uint64
	Reuploads         uint64
}

ResourceStats is an internal snapshot of GPU-owned residency and per-frame churn. It deliberately excludes shared WindowServer/IOSurface accounting.

type Retainer

type Retainer interface {
	Retained(size image.Point) bool
}

Retainer is implemented by a Device whose frame target keeps its pixels from one Execute to the next, so the Renderer may send it partial frames (Frame.Dirty, Frame.Copies). Retained reports whether the target holds the last frame executed, at size; the Renderer also requires that frame to have been executed successfully by itself.

type Upload

type Upload struct {
	Tex    int // TexMask, TexColor or TexRamp
	Rect   image.Rectangle
	Pix    []byte
	Stride int
}

Upload copies pixels into a texture before the frame's batches run. Rect is the destination rectangle in texels; row y of it starts at Pix[y*Stride:] and holds Rect.Dx() texels (1 byte each for TexMask, 4 for TexColor, 8 for TexRamp).

type VerifyError

type VerifyError struct {
	Region image.Rectangle // bounding box of the differing pixels
	Pixels int             // differing pixels (beyond the tolerance)
	Max    int             // largest channel difference
	Dirty  []image.Rectangle
	Copies []CopyRegion
}

VerifyError is what verify mode (SetVerify) reports when a partial redraw differs from the full frame: usually a Damage or ScrollRegion hint missed a change. When it is reported the device's target already holds the correct full frame.

func (*VerifyError) Error

func (e *VerifyError) Error() string

Directories

Path Synopsis
Package atlas is the GPU renderer's persistent mask atlas: an R8 texture holding coverage masks across frames — glyphs (KindGlyph) and filled paths (KindPath).
Package atlas is the GPU renderer's persistent mask atlas: an R8 texture holding coverage masks across frames — glyphs (KindGlyph) and filled paths (KindPath).
Package cpuexec runs the GPU quad shader (internal/render/gpu/shaders) on the CPU, so the GPU renderer's pipeline can be tested without a GPU.
Package cpuexec runs the GPU quad shader (internal/render/gpu/shaders) on the CPU, so the GPU renderer's pipeline can be tested without a GPU.
Package d3d11 is the Direct3D 11 backend of the GPU renderer: a gpu.Device that executes internal/render/gpu frames on a D3D11 device and a presenter that shows them in a window through a DXGI flip-model swap chain.
Package d3d11 is the Direct3D 11 backend of the GPU renderer: a gpu.Device that executes internal/render/gpu frames on a D3D11 device and a presenter that shows them in a window through a DXGI flip-model swap chain.
Package gen holds the shader sources generated from internal/render/gpu/shaders.
Package gen holds the shader sources generated from internal/render/gpu/shaders.
gl
Package gl is the OpenGL backend of the GPU renderer: a gpu.Device that executes internal/render/gpu frames with OpenGL 3.3 core and a presenter that shows them in a GTK3 GtkGLArea.
Package gl is the OpenGL backend of the GPU renderer: a gpu.Device that executes internal/render/gpu frames with OpenGL 3.3 core and a presenter that shows them in a GTK3 GtkGLArea.
nativewindow
Package nativewindow is the hand-over point between a platform canvas that owns a native window (an Android ANativeWindow) and the OpenGL ES presenter that draws into it (gl.NewPresenterAndroid).
Package nativewindow is the hand-over point between a platform canvas that owns a native window (an Android ANativeWindow) and the OpenGL ES presenter that draws into it (gl.NewPresenterAndroid).
internal
devkit
Package devkit holds the backend-neutral parts of the GPU devices (internal/render/gpu/d3d11, internal/render/gpu/gl): the layer texture pool, the partial-frame checks, the copy scratch sizing and the clearing quads, written over an abstract texture handle so they are tested on any machine.
Package devkit holds the backend-neutral parts of the GPU devices (internal/render/gpu/d3d11, internal/render/gpu/gl): the layer texture pool, the partial-frame checks, the copy scratch sizing and the clearing quads, written over an abstract texture handle so they are tested on any machine.
gpuconf
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.
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.
gputest
Package gputest holds the test scenes and image comparison shared by the GPU renderer's tests (internal/render/gpu with the CPU executor, internal/render/gpu/metal with a real device), so every backend is checked against paint.CPU on the same display lists with the same thresholds.
Package gputest holds the test scenes and image comparison shared by the GPU renderer's tests (internal/render/gpu with the CPU executor, internal/render/gpu/metal with a real device), so every backend is checked against paint.CPU on the same display lists with the same thresholds.
racetest
Package racetest reports whether the test binary was built with the race detector, so the GPU renderer's heavy pixel tests (the CPU executor runs the shader per pixel, 10–20× slower under -race) can run a reduced but representative set of cases there and keep the full set otherwise.
Package racetest reports whether the test binary was built with the race detector, so the GPU renderer's heavy pixel tests (the CPU executor runs the shader per pixel, 10–20× slower under -race) can run a reduced but representative set of cases there and keep the full set otherwise.
Package metal is the Metal Device of the GPU renderer (internal/render/gpu): it executes gpu.Frames into a persistent offscreen RGBA8 render target that ReadPixels reads back, and NewPresenter shows it in a CAMetalLayer.
Package metal is the Metal Device of the GPU renderer (internal/render/gpu): it executes gpu.Frames into a persistent offscreen RGBA8 render target that ReadPixels reads back, and NewPresenter shows it in a CAMetalLayer.
Package shaders holds the GPU renderer's shaders, written in Go against package sl.
Package shaders holds the GPU renderer's shaders, written in Go against package sl.

Jump to

Keyboard shortcuts

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