gpuhost

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 15 Imported by: 1 module, 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 gpuhost drives the native GPU host of the export, the child process stuarty-render (ADR-0029 item 4, SDD-013 section 4.9). The child composes the frame plan on the GPU and is fed through its standard input and output, the way FFmpeg is fed frames. It runs under the process policy of FFmpeg (SDD-007 6.10): started by engine/ffmpeg, from an absolute path, with the minimal environment, a run directory, limits, a deadline and the kill of its whole process tree. This package is the only place that knows the pipe protocol of renderer/stuarty-renderer-gpu/src/proto.rs.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnavailable = errors.New("gpuhost: the GPU host is not available")

ErrUnavailable means the GPU host could not be started: the binary is missing or refuses to run, there is no graphics adapter, or the sandbox hides the devices. The export then draws on the CPU path.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Path is the absolute path of stuarty-render.
	Path string
	// Dir is the run directory: the child's working directory, HOME and temp directory.
	Dir *ffmpeg.RunDir
	// Deadline bounds the life of the child; the export deadline.
	Deadline time.Duration
	// MaxTextureBytes and MaxBitmapBytes are the budgets of the child; zero is its default
	// (renderhost.DefaultMaxTextureBytes, renderhost.DefaultMaxBitmapBytes).
	MaxTextureBytes, MaxBitmapBytes uint32
}

Config is what Start needs.

type Host

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

Host is a running stuarty-render. It is not safe for concurrent use.

func Start

func Start(ctx context.Context, r *ffmpeg.Runner, cfg Config) (*Host, error)

Start runs stuarty-render and waits for its answer to the init, which names the adapter. Any failure before that is ErrUnavailable. ctx ends the child with the kill of its process tree.

func (*Host) Adapter

func (h *Host) Adapter() string

Adapter is the adapter the child drew on, name, backend and device type, to record next to a result.

func (*Host) Close

func (h *Host) Close() error

Close ends the child: end of input first, so it exits by itself, then the kill of its tree when it does not within a few seconds. It returns what the run reported, nil for a clean end.

func (*Host) PutBitmap

func (h *Host) PutBitmap(key string, bm bitmap.Bitmap) error

PutBitmap uploads a bitmap of the rasterizer under its key; the child premultiplies it.

func (*Host) PutLUT

func (h *Host) PutLUT(asset string, t *lut.Table) error

PutLUT uploads the lookup table of a lut asset under the asset id (SDD-004 section 3.6).

func (*Host) PutTexture

func (h *Host) PutTexture(item string, w, ht int, rgba []byte, opaque bool) error

PutTexture uploads the premultiplied RGBA pixels of a media layer under its item id.

func (*Host) Release

func (h *Host) Release(id string) error

Release forgets the texture, bitmap or lookup table with that id or key; an unknown one is not an error.

func (*Host) Render

func (h *Host) Render(in renderhost.RenderInput, dst *image.RGBA) error

Render draws the frame into dst: RGBA, no stride padding, exactly Output.Width by Output.Height. The child draws the whole frame; a band is not used on this path.

Jump to

Keyboard shortcuts

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