Documentation
¶
Index ¶
- Constants
- type BehaviourProvider
- type CmdBehaviour
- type DeadCodeElimination
- func (t *DeadCodeElimination) BuffersCommands() bool
- func (t *DeadCodeElimination) Flush(ctx context.Context, out transform.Writer) error
- func (t *DeadCodeElimination) PostLoop(ctx context.Context, out transform.Writer)
- func (t *DeadCodeElimination) PreLoop(ctx context.Context, out transform.Writer)
- func (t *DeadCodeElimination) Request(id api.CmdID)
- func (t *DeadCodeElimination) Transform(ctx context.Context, id api.CmdID, c api.Cmd, out transform.Writer) error
- type DependencyGraph
- func (g *DependencyGraph) GetCmdID(cmdIndex int) api.CmdID
- func (g *DependencyGraph) GetHierarchyStateMap() map[StateAddress]StateAddress
- func (g *DependencyGraph) GetStateAddressOf(key StateKey) StateAddress
- func (g *DependencyGraph) Print(ctx context.Context, b *CmdBehaviour)
- func (g *DependencyGraph) SetRoot(key StateKey)
- type DependencyGraphBehaviourProvider
- type LivenessTree
- type StateAddress
- type StateKey
Constants ¶
const NullStateAddress = StateAddress(0)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BehaviourProvider ¶
type BehaviourProvider interface {
GetBehaviourForCommand(context.Context, *api.GlobalState, api.CmdID, api.Cmd, *DependencyGraph) CmdBehaviour
}
type CmdBehaviour ¶
type CmdBehaviour struct { Reads []StateAddress // States read by a command. Modifies []StateAddress // States read and written by a command. Writes []StateAddress // States written by a command. Roots []StateAddress // States labeled as root by a command. KeepAlive bool // Force the command to be live. Aborted bool // Mutation of this command aborts. }
func (*CmdBehaviour) Modify ¶
func (b *CmdBehaviour) Modify(g *DependencyGraph, state StateKey)
func (*CmdBehaviour) Read ¶
func (b *CmdBehaviour) Read(g *DependencyGraph, state StateKey)
func (*CmdBehaviour) Write ¶
func (b *CmdBehaviour) Write(g *DependencyGraph, state StateKey)
type DeadCodeElimination ¶
type DeadCodeElimination struct { KeepAllAlive bool // contains filtered or unexported fields }
DeadCodeElimination is an implementation of Transformer that outputs live commands. That is, all commands which do not affect the requested output are omitted. It is named after the standard compiler optimization. (state is like memory and commands are instructions which read/write it). Construct with NewDeadCodeElimination, do not build directly.
func NewDeadCodeElimination ¶
func NewDeadCodeElimination(ctx context.Context, depGraph *DependencyGraph) *DeadCodeElimination
NewDeadCodeElimination constructs and returns a new DeadCodeElimination transform.
The transform generates commands from the given depGraph, it does not take inputs.
func (*DeadCodeElimination) BuffersCommands ¶
func (t *DeadCodeElimination) BuffersCommands() bool
func (*DeadCodeElimination) PostLoop ¶
func (t *DeadCodeElimination) PostLoop(ctx context.Context, out transform.Writer)
func (*DeadCodeElimination) PreLoop ¶
func (t *DeadCodeElimination) PreLoop(ctx context.Context, out transform.Writer)
func (*DeadCodeElimination) Request ¶
func (t *DeadCodeElimination) Request(id api.CmdID)
Request ensures that we keep alive all commands needed to render framebuffer at the given point.
type DependencyGraph ¶
type DependencyGraph struct { // Number of generated commands in 'Commands' which build the initial state. NumInitialCommands int Commands []api.Cmd // Command list which this graph was build for. Behaviours []CmdBehaviour // State reads/writes for each command (graph edges). Roots map[StateAddress]bool // State to mark live at requested commands. // contains filtered or unexported fields }
func GetDependencyGraph ¶
func (*DependencyGraph) GetCmdID ¶
func (g *DependencyGraph) GetCmdID(cmdIndex int) api.CmdID
GetCmdID returns the CmdID for given element in the Commands slice.
func (*DependencyGraph) GetHierarchyStateMap ¶
func (g *DependencyGraph) GetHierarchyStateMap() map[StateAddress]StateAddress
func (*DependencyGraph) GetStateAddressOf ¶
func (g *DependencyGraph) GetStateAddressOf(key StateKey) StateAddress
func (*DependencyGraph) Print ¶
func (g *DependencyGraph) Print(ctx context.Context, b *CmdBehaviour)
func (*DependencyGraph) SetRoot ¶
func (g *DependencyGraph) SetRoot(key StateKey)
type DependencyGraphBehaviourProvider ¶
type DependencyGraphBehaviourProvider interface {
GetDependencyGraphBehaviourProvider(ctx context.Context) BehaviourProvider
}
type LivenessTree ¶
type LivenessTree struct {
// contains filtered or unexported fields
}
LivenessTree assigns boolean value to each state (live or dead). Think of each node as memory range, with children being sub-ranges.
func NewLivenessTree ¶
func NewLivenessTree(parents map[StateAddress]StateAddress) LivenessTree
NewLivenessTree creates a new tree. The parent map defines parent for each node, and it must be continuous with no gaps.
func (*LivenessTree) IsLive ¶
func (l *LivenessTree) IsLive(address StateAddress) bool
IsLive returns true if the state, or any of its descendants, are live.
func (*LivenessTree) MarkDead ¶
func (l *LivenessTree) MarkDead(address StateAddress)
MarkDead makes the given state, and all of its descendants, dead.
func (*LivenessTree) MarkLive ¶
func (l *LivenessTree) MarkLive(address StateAddress)
MarkLive makes the given state, and all of its descendants, live.
type StateAddress ¶
type StateAddress uint32
type StateKey ¶
type StateKey interface { // Parent returns enclosing state (and this state is strict subset of it). // This allows efficient implementation of operations which access a lot state. Parent() StateKey }
StateKey uniquely represents part of the GL state. Think of it as memory range (which stores the state data).