render

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 11 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 render defines the renderer interface that the software, GLES and Vulkan renderers implement.

Index

Constants

View Source
const MaxBorderColors = 10

Variables

This section is empty.

Functions

func CheckDraw

func CheckDraw(texture image.Point, src FRect, transform Transform, alpha float32, m Mask) error

func CheckGlass

func CheckGlass(texture image.Point, src FRect, alpha float32, m Mask, g Glass) error

func CheckGradient

func CheckGradient(g Gradient, m Mask) error

func CheckPixels

func CheckPixels(size image.Point, stride, n int) error

func CheckRows

func CheckRows(size image.Point, stride, n int, rows Rows) error

func CheckUpdate

func CheckUpdate(size image.Point, dst image.Rectangle, stride, n int) error

func DrawEffects

func DrawEffects(p Pass, e Effects)

func SoftwareDevice

func SoftwareDevice(name string) bool

func TransformNames

func TransformNames() []string

Types

type AlphaCut

type AlphaCut = lgpu.AlphaCut

type AsyncReadTarget

type AsyncReadTarget interface {
	ReadTarget
	ReadAsync() (PendingRead, error)
}

type AsyncReader

type AsyncReader interface {
	AsyncReads() bool
	NewAsyncTarget(size image.Point) (AsyncReadTarget, error)
}

type Axis

type Axis struct {
	Source   int
	Reversed bool
}

type Border

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

func GradientBorder

func GradientBorder(colors []Color, degrees float64) (Border, error)

func SolidBorder

func SolidBorder(c Color) Border

func (Border) Colors

func (b Border) Colors() []Color

func (Border) Gradient

func (b Border) Gradient() bool

func (Border) Line

func (b Border) Line(r image.Rectangle) (from, to [2]float32)

func (Border) Stops

func (b Border) Stops() BorderStops

func (Border) Turned

func (b Border) Turned(degrees float64) Border

type BorderStops

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

type Color

type Color struct {
	R, G, B, A uint8
}

func (Color) Premultiplied

func (c Color) Premultiplied() bool

func (Color) Premultiply

func (c Color) Premultiply() Color

type ColorTransform

type ColorTransform = lgpu.ColorTransform

type Counts

type Counts struct {
	Passes      uint64
	Filters     uint64
	Uploads     uint64
	GPUWaits    uint64
	Submits     uint64
	Targets     uint64
	Clears      uint64
	Imports     uint64
	ResetChecks uint64
	Programs    uint64
	ColdDraws   uint64
	Incomplete  uint64
}

type Effects

type Effects struct {
	Textures []Texture
	Stops    Texture
	Sources  []Texture
	Cut      Texture
	Color    *ColorTransform
}

type FRect

type FRect = lgpu.FRect

type Falloff

type Falloff = lgpu.Falloff

type Format

type Format uint8
const (
	ARGB8888 Format = iota + 1
	XRGB8888
	ABGR8888
	XBGR8888
	ARGB2101010
	XRGB2101010
	ABGR2101010
	XBGR2101010
)

func (Format) Decode

func (f Format) Decode(px []byte) Color

func (Format) DecodeRow

func (f Format) DecodeRow(row []byte)

func (Format) Opaque

func (f Format) Opaque() bool

func (Format) RGBOrder

func (f Format) RGBOrder() bool

func (Format) TenBit

func (f Format) TenBit() bool

type Glass

type Glass = lgpu.Glass

type Goo

type Goo = lgpu.Goo

type Gradient

type Gradient struct {
	Stops    Texture
	From, To [2]float32
	Alpha    float32
}

type LostPass

type LostPass struct{}

func (LostPass) Clear

func (LostPass) Clear(Color)

func (LostPass) ClearCut

func (LostPass) ClearCut()

func (LostPass) DrawGlass

func (LostPass) DrawScreenShader

func (LostPass) DrawScreenShader(ScreenShader, Texture, image.Rectangle, float32)

func (LostPass) DrawTexture

func (LostPass) End

func (LostPass) End() error

func (LostPass) FillGoo

func (LostPass) FillGoo(image.Rectangle, Color, Goo)

func (LostPass) FillGradient

func (LostPass) FillGradient(image.Rectangle, Gradient, Mask)

func (LostPass) FillRect

func (LostPass) FillRect(image.Rectangle, Color, Mask)

func (LostPass) Kawase

func (LostPass) SetColor

func (LostPass) SetColor(*ColorTransform)

func (LostPass) SetCut

func (LostPass) SetCut(Texture, AlphaCut)

type LostRead

type LostRead struct {
	Pix    []byte
	Stride int
}

func NewLostRead

func NewLostRead(size image.Point) *LostRead

func (*LostRead) Map

func (l *LostRead) Map() ([]byte, int, error)

func (*LostRead) Release

func (*LostRead) Release() error

func (*LostRead) Wait

func (*LostRead) Wait() error

type Mask

type Mask = lgpu.Mask

type NamedDevice

type NamedDevice interface {
	DeviceName() string
}

type OffThreadBuilder

type OffThreadBuilder interface {
	BuildOffThread() error
}

type Pass

type Pass interface {
	SetColor(t *ColorTransform)
	SetCut(t Texture, c AlphaCut)
	ClearCut()
	Clear(c Color)
	FillRect(r image.Rectangle, c Color, m Mask)
	FillGradient(r image.Rectangle, g Gradient, m Mask)
	Kawase(t Texture, dst image.Rectangle, offset float32, up bool)
	FillGoo(r image.Rectangle, c Color, g Goo)
	DrawTexture(t Texture, src FRect, dst image.Rectangle, transform Transform, alpha float32, m Mask)
	DrawScreenShader(s ScreenShader, t Texture, dst image.Rectangle, seconds float32)
	DrawGlass(t Texture, src FRect, dst image.Rectangle, alpha float32, m Mask, g Glass)
	End() error
}

type PendingRead

type PendingRead interface {
	Wait() error
	Map() ([]byte, int, error)
	Release() error
}

type ReadTarget

type ReadTarget interface {
	Target
	Read(pix []byte, stride int) error
	ReadRows(pix []byte, stride int, rows Rows) error
	Destroy() error
}

type Region

type Region []image.Rectangle

func (Region) Area

func (g Region) Area() int

func (Region) AreaIn

func (g Region) AreaIn(bounds image.Rectangle) int

func (Region) ClipInto

func (g Region) ClipInto(dst *region.Set, bounds image.Rectangle)

type Renderer

type Renderer interface {
	Speed() Speed
	Counts() Counts
	Formats() []Format
	NewTexture(format Format, size image.Point, stride int, data []byte) (Texture, error)
	NewBlankTexture(format Format, size image.Point) (Texture, error)
	NewTarget(size image.Point) (ReadTarget, error)
	NewTextureTarget(size image.Point) (TextureTarget, error)
	NewScreenShader(p *shader.Program) (ScreenShader, error)
	NewWorkingTarget(size image.Point) (TextureTarget, error)
	Begin(target Target, damage Region) (Pass, error)
	Lost() error
	Recover() error
	LoseDevice()
}

type RoundRect

type RoundRect = lgpu.RoundRect

type Rows

type Rows struct {
	From, To int
}

func AllRows

func AllRows(size image.Point) Rows

type ScreenShader

type ScreenShader interface {
	Prepare(target Target) error
	Destroy() error
}

ScreenShader is a shader program in the form a renderer draws with. Prepare does what drawing into target still takes, the last part a driver may refuse, so that a caller can draw without it while no pass is open.

type Speed

type Speed uint8
const (
	GPU Speed = iota
	CPUDriver
	Software
)

func DriverSpeed

func DriverSpeed(name string) Speed

type Target

type Target interface {
	Size() image.Point
}

type Texture

type Texture interface {
	Working() bool
	Size() image.Point
	Update(dst image.Rectangle, stride int, data []byte) error
	Destroy() error
}

Texture is a renderer's image. Update and Renderer.NewTexture may be handed a client's memory, which faults if the client shrank its file: a renderer reads data only from Go on the calling goroutine and stays usable when that read panics, and keeps no reference to data.

type TextureTarget

type TextureTarget interface {
	ReadTarget
	Texture() Texture
}

type Transform

type Transform uint8
const (
	Normal Transform = iota
	Rotate90
	Rotate180
	Rotate270
	Flipped
	Flipped90
	Flipped180
	Flipped270
)

func ParseTransform

func ParseTransform(s string) (Transform, bool)

func (Transform) Axes

func (t Transform) Axes() (horizontal, vertical Axis)

func (Transform) FRect

func (t Transform) FRect(r FRect, size image.Point) FRect

func (Transform) Invert

func (t Transform) Invert() Transform

func (Transform) Point

func (t Transform) Point(p, size image.Point) image.Point

func (Transform) Rect

func (Transform) Size

func (t Transform) Size(size image.Point) image.Point

func (Transform) String

func (t Transform) String() string

func (Transform) SwapsAxes

func (t Transform) SwapsAxes() bool

func (Transform) Unit

func (t Transform) Unit(x, y float64) (float64, float64)

Directories

Path Synopsis
Package gles is the GLES2 renderer: shm textures, premultiplied blending, and passes into framebuffers backed by textures or dmabufs.
Package gles is the GLES2 renderer: shm textures, premultiplied blending, and passes into framebuffers backed by textures or dmabufs.
Package rendertest holds the scene and checks every renderer's tests share, so each GPU renderer is held to the software renderer's pixels.
Package rendertest holds the scene and checks every renderer's tests share, so each GPU renderer is held to the software renderer's pixels.
Package soft is the CPU renderer over premultiplied ARGB8888 buffers.
Package soft is the CPU renderer over premultiplied ARGB8888 buffers.
Package vulkan renders the compositor's frames with Vulkan through lys-lib's gpu package, the stack lys-ui and lys-shell draw with.
Package vulkan renders the compositor's frames with Vulkan through lys-lib's gpu package, the stack lys-ui and lys-shell draw with.

Jump to

Keyboard shortcuts

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