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 ¶
- Variables
- type Config
- type Host
- func (h *Host) Adapter() string
- func (h *Host) Close() error
- func (h *Host) PutBitmap(key string, bm bitmap.Bitmap) error
- func (h *Host) PutLUT(asset string, t *lut.Table) error
- func (h *Host) PutTexture(item string, w, ht int, rgba []byte, opaque bool) error
- func (h *Host) Release(id string) error
- func (h *Host) Render(in renderhost.RenderInput, dst *image.RGBA) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
Adapter is the adapter the child drew on, name, backend and device type, to record next to a result.
func (*Host) Close ¶
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 ¶
PutBitmap uploads a bitmap of the rasterizer under its key; the child premultiplies it.
func (*Host) PutLUT ¶
PutLUT uploads the lookup table of a lut asset under the asset id (SDD-004 section 3.6).
func (*Host) PutTexture ¶
PutTexture uploads the premultiplied RGBA pixels of a media layer under its item id.
func (*Host) Release ¶
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.