Documentation
¶
Overview ¶
Package render prepares ordered physical-pixel primitives for Vulkan submission. It does not own the display list or its borrowed font faces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListBuffer ¶
type ListBuffer struct {
// contains filtered or unexported fields
}
ListBuffer is a single-owner scratch area for repeated ListBatches calls. The slices it returns alias its storage: they are valid only until the next List or Release call, and must not be retained, shared across goroutines, or used while another List may run. This is safe for consumers that copy the data synchronously (Target.submit uploads instances into GPU memory and resolve copies the batches before recording returns); anything that keeps the slices past that point must use ListBatches instead. Retained frames hold only render.Frame, never these slices, so a blocked frame is re-listed on retry. Stats.Skipped shares the same lifetime. The zero value is ready to use.
func (*ListBuffer) Release ¶
func (b *ListBuffer) Release()
Release drops borrowed image references from the previous result. Call it once the result has been consumed so an idle buffer does not pin images.
type ListStats ¶
ListStats reports every skipped prepared quad by operation.
func ListBatches ¶
ListBatches groups consecutive atlas draws and isolates each image draw. First indexes the returned instances, retaining exact painter's order. The returned slices and map are freshly allocated and owned by the caller.
type Preparer ¶
Preparer owns the glyph atlas and the obligation to deliver its changes to the GPU mirror. Prepare hands the caller every change not yet known to be submitted; Submitted is the only acknowledgement. A frame that is retried, abandoned, superseded or never reached submission therefore never loses atlas changes: the next Prepare resends whole pages (placements are kept).
func NewPreparer ¶
NewPreparer bounds the grayscale glyph atlas. Call Prepare synchronously with layout; the atlas and shaped faces are not safe for concurrent use.
func (*Preparer) Prepare ¶
func (p *Preparer) Prepare(commands []layout.Command, scale float64, width, height int) (Frame, error)
Prepare converts logical rectangles once, using layout.Physical as the sole logical-to-physical edge-rounding boundary. A clip-push intersects its parent clip; rounded clips intentionally use only their axis-aligned bounds in V1. Clip-pop without a push and unknown operations are rejected, not dropped. Image commands without a source are rejected. Failed frames do not produce partial output.
func (*Preparer) PrepareInto ¶ added in v0.6.1
func (p *Preparer) PrepareInto(quads []Quad, commands []layout.Command, scale float64, width, height int) (Frame, error)
PrepareInto is Prepare reusing quads' backing array for the returned frame's Quads. The frame aliases quads, so it is valid only until quads is reused: callers that keep frames must use Prepare. Pass the last frame's Quads unchanged: its length tells how much of a past peak buffer is still needed.
func (*Preparer) Submitted ¶
Submitted acknowledges that uploads, as returned in the most recent Prepare's Frame.Uploads, were recorded in a successfully submitted GPU submission. Any other slice (an older, superseded frame or foreign data) is ignored and the latest frame's uploads stay owed. Call it on the Prepare owner's loop.
type Quad ¶
type Quad struct {
Op string
Rect layout.Rect
Clip layout.Rect
Color css.Color
Radii [4]float64
Widths layout.Edges
Colors css.ColorSides
Glyph text.Placement
Image image.Image
// Shape is the original box when the draw bounds extend past it.
Shape layout.Rect
// Shadow holds physical offset, blur and spread. Inset is carried separately.
Shadow [4]float64
Inset bool
}
Quad is a physical-pixel rectangle with a physical clip. Color is straight sRGB; conversion to premultiplied linear color belongs at the GPU boundary. Glyphs refer to an atlas placement valid only for this prepared frame.