Documentation
¶
Index ¶
- type BackendKind
- type Engine
- func (e *Engine) Close() error
- func (e *Engine) OutputChannels() int
- func (e *Engine) Params() []ir.ParamSpec
- func (e *Engine) SamplePoint(layout runtime.Layout, idx int, phase float32, params *runtime.BoundParams) ([]float32, error)
- func (e *Engine) SamplePoints(layout runtime.Layout, indices []int, phase float32, ...) ([]float32, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendKind ¶
type BackendKind int
BackendKind selects the evaluation backend for an Engine.
const ( // BackendCPU evaluates effects on the CPU. Available under all build configurations. BackendCPU BackendKind = iota // BackendGPU evaluates effects on the GPU via WebGPU compute shaders. // Requires CGO_ENABLED=0. BackendGPU )
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is a compiled LFX effect ready for evaluation. It is not goroutine-safe.
func LoadFile ¶
LoadFile compiles the .lfx file at path and returns an Engine backed by the selected backend. Call engine.Close() when done to release any GPU resources.
func (*Engine) Close ¶
Close releases any resources held by the Engine. For GPU backends this releases the GPU device and all associated buffers. Safe to call on a nil Engine.
func (*Engine) OutputChannels ¶
OutputChannels returns the number of output channels: 1 (scalar), 3 (RGB), or 4 (RGBW).
func (*Engine) Params ¶
Params returns the effect's parameter specifications. Use with runtime.Bind to create a *runtime.BoundParams for sampling.
type Options ¶
type Options struct {
// Backend selects the evaluation backend. Defaults to BackendCPU.
Backend BackendKind
// GPUBackend selects the GPU backend when Backend == BackendGPU.
// Accepted values: "auto" (default), "metal", "vulkan", "dx12", "gl".
GPUBackend string
// BaseDir is the root directory for resolving module imports.
// If empty, LoadFile attempts to detect it from the source file path.
BaseDir string
// Resolver overrides the default module resolver. If nil, the file-system
// resolver rooted at BaseDir is used.
Resolver modules.Resolver
}
Options configures LoadFile.