gpu

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT, MIT, Unlicense Imports: 28 Imported by: ? 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 implements the rendering of Gio drawing operations. It is used by package app and package gpu/headless and is otherwise not useful except for integrating with external window implementations.

Index

Constants

This section is empty.

Variables

View Source
var ErrDeviceLost = driver.ErrDeviceLost

ErrDeviceLost is returned from GPU operations when the underlying GPU device is lost and should be recreated.

Functions

func ShaderErr

func ShaderErr(g GPU) error

ShaderErr returns the reason for the latest shader paint or layer effect fallback, or nil if there has been none.

Types

type API

type API = driver.API

An API carries the necessary GPU API specific resources to create a Device. There is an API type for each supported GPU API such as OpenGL and Direct3D.

type Direct3D11

type Direct3D11 = driver.Direct3D11

Direct3D11 denotes the Direct3D API.

type Direct3D11RenderTarget

type Direct3D11RenderTarget = driver.Direct3D11RenderTarget

Direct3D11RenderTarget is a render target suitable for the Direct3D 11 backend.

type FBO

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

type GPU

type GPU interface {
	// Release non-Go resources. The GPU is no longer valid after Release.
	Release()
	// Clear sets the clear color for the next Frame.
	Clear(color color.NRGBA)
	// Frame draws the graphics operations from op into a viewport of target.
	Frame(frame *op.Ops, target RenderTarget, viewport image.Point) error
}

func New

func New(api API) (GPU, error)

New creates a GPU for the given API.

func NewWithDevice

func NewWithDevice(d driver.Device) (GPU, error)

NewWithDevice creates a GPU with a pre-existing device.

Note: for internal use only.

type Metal

type Metal = driver.Metal

Metal denotes the Apple Metal API.

type MetalRenderTarget

type MetalRenderTarget = driver.MetalRenderTarget

MetalRenderTarget is a render target suitable for the Metal backend.

type OpenGL

type OpenGL = driver.OpenGL

OpenGL denotes the OpenGL or OpenGL ES API.

type OpenGLRenderTarget

type OpenGLRenderTarget = driver.OpenGLRenderTarget

OpenGLRenderTarget is a render target suitable for the OpenGL backend.

type RenderTarget

type RenderTarget = driver.RenderTarget

A RenderTarget denotes the destination framebuffer for a frame.

type Stats

type Stats struct {
	// PathBuilds counts the filled shapes (clip.Outline, clip.Path, and
	// shapes made of them, like rounded rectangles and text drawn as
	// paths) flattened and uploaded as a new vertex buffer. A shape is
	// cached by the operation that drew it, so a shape drawn straight
	// into a frame's ops is built again every frame it is drawn, while
	// one replayed from a recording kept across frames is built once.
	PathBuilds uint64
	// PathVertexBytes counts bytes submitted for those path uploads.
	PathVertexBytes uint64
	// ShaderPipelines counts the paint.Shader pipeline sets built
	// successfully: one per Shader on its first paint, never again while
	// the GPU lives.
	ShaderPipelines uint64
	// ShaderFallbacks counts shader paints drawn as their Fallback colour
	// because the backend could not draw them; ShaderErr says why.
	ShaderFallbacks uint64
	// LayerRepaints counts affine layers rendered into an offscreen target.
	LayerRepaints uint64
	// LayerComposites counts affine layer quads drawn from that target.
	LayerComposites uint64
	// LayerFallbacks counts layers that could not be captured and either
	// drew directly or were omitted when capture-only.
	LayerFallbacks uint64
	// LayerTargetAllocations counts new and resized layer atlas textures,
	// including textures used by opacity layers.
	LayerTargetAllocations uint64
	// LayerCaptures counts shader layer sources rendered into an offscreen target.
	LayerCaptures uint64
	// LayerEffects counts composites drawn with a custom layer shader.
	LayerEffects uint64
	// LayerEffectFallbacks counts attempted layer draws that used the plain
	// composite, drew directly, or were skipped for a missing source or path clip.
	LayerEffectFallbacks uint64
}

Stats are a GPU's running totals, for finding drawing that defeats the renderer's caches (giokit).

func ReadStats

func ReadStats(g GPU) Stats

ReadStats returns g's totals; zero for a GPU this package didn't make.

type Vulkan

type Vulkan = driver.Vulkan

Vulkan denotes the Vulkan API.

type VulkanRenderTarget

type VulkanRenderTarget = driver.VulkanRenderTarget

VulkanRenderTarget is a render target suitable for the Vulkan backend.

Directories

Path Synopsis
Package headless implements headless windows for rendering an operation list to an image.
Package headless implements headless windows for rendering an operation list to an image.
internal
rendertest
Package rendertest is intended for testing of drawing ops only.
Package rendertest is intended for testing of drawing ops only.
rendertest/testshaders
Package testshaders holds the paint shaders of rendertest's paint.ShaderOp tests (giokit patch).
Package testshaders holds the paint shaders of rendertest's paint.ShaderOp tests (giokit patch).

Jump to

Keyboard shortcuts

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