api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2017 License: Apache-2.0 Imports: 38 Imported by: 158

Documentation

Overview

Package api exposes the shared behavior of all graphics api's.

Index

Constants

View Source
const (
	// ErrParameterNotFound is the error returned by GetParameter() and
	// SetParameter() when the command does not have the named parameter.
	ErrParameterNotFound = fault.Const("Parameter not found")
	// ErrResultNotFound is the error returned by GetResult() and SetResult()
	// when the command does not have a result value.
	ErrResultNotFound = fault.Const("Result not found")
)
View Source
const Break tyBreak = tyBreak(0)

Break can be returned from the callback passed to ForeachCmd to stop iteration of the loop.

View Source
const CmdNoID = CmdID(1<<63 - 1) // use max int64 for the benefit of java

CmdNoID is used when you have to pass an ID, but don't have one to use.

Variables

This section is empty.

Functions

func CmdCallFor added in v0.6.0

func CmdCallFor(cmd Cmd) proto.Message

CmdCallFor returns the proto message type for the call result of cmd.

func ForeachCmd added in v0.5.0

func ForeachCmd(ctx context.Context, cmds []Cmd, cb func(context.Context, CmdID, Cmd) error) error

ForeachCmd calls the callback cb for each command in cmds. If cb returns an error (excluding Break) then the iteration will stop and the error will be returned. If cb returns Break then the iteration will stop and nil will be returned. ForeachCmd creates a non-cancellable sub-context to reduce cancellation complexity in the callback function. If cb panics, the error will be annotated with the panicing command index and command.

func GetParameter

func GetParameter(ctx context.Context, c Cmd, name string) (interface{}, error)

GetParameter returns the parameter value with the specified name.

func GetResult

func GetResult(ctx context.Context, c Cmd) (interface{}, error)

GetResult returns the command's result value.

func IsErrCmdAborted

func IsErrCmdAborted(err error) bool

IsErrCmdAborted returns true if the cause of the error err was due to an abort() in the command.

func MutateCmds added in v0.5.0

func MutateCmds(ctx context.Context, state *GlobalState, builder *builder.Builder, cmds ...Cmd)

MutateCmds calls Mutate on each of cmds.

func Register

func Register(api API)

Register adds an api to the understood set. It is illegal to register the same name twice.

func SetParameter

func SetParameter(ctx context.Context, c Cmd, name string, val interface{}) error

SetParameter sets the parameter with the specified name with val.

func SetResult

func SetResult(ctx context.Context, c Cmd, val interface{}) error

SetResult sets the commands result value to val.

Types

type API

type API interface {
	// Name returns the official name of the api.
	Name() string

	// Index returns the API index.
	Index() uint8

	// ID returns the unique API identifier.
	ID() ID

	// ConstantSets returns the constant set pack for the API.
	ConstantSets() *constset.Pack

	// GetFramebufferAttachmentInfo returns the width, height, and format of the
	// specified framebuffer attachment.
	// It also returns an API specific index that maps the given attachment into
	// an API specific representation.
	GetFramebufferAttachmentInfo(
		ctx context.Context,
		after []uint64,
		state *GlobalState,
		thread uint64,
		attachment FramebufferAttachment) (width, height, index uint32, format *image.Format, err error)

	// Context returns the active context for the given state.
	Context(state *GlobalState, thread uint64) Context

	// CreateCmd constructs and returns a new command with the specified name.
	CreateCmd(name string) Cmd
}

API is the common interface to a graphics programming api.

func Find

func Find(id ID) API

Find looks up a graphics API by identifier. If the id has not been registered, it returns nil.

type APIObject

type APIObject interface {
	// API returns the API identifier that this type belongs to.
	API() API
}

APIObject is the interface implemented by types that belong to an API.

type AllocResult

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

AllocResult represents the result of allocating a range using a memory.Allocator, and potentially the database ID for data that's meant to be stored in the range.

func (AllocResult) Address

func (r AllocResult) Address() uint64

Address returns the beginning of the range.

func (AllocResult) Data

func (r AllocResult) Data() (memory.Range, id.ID)

Data can be used as a helper to Add(Read|Write) methods on commands.

func (AllocResult) Free

func (r AllocResult) Free()

Free frees the memory range through the originating allocator. This is not currently used.

func (AllocResult) Offset

func (r AllocResult) Offset(n uint64) memory.Pointer

Offset returns a pointer n bytes to the right of the associated range.

func (AllocResult) Ptr

func (r AllocResult) Ptr() memory.Pointer

Ptr returns the beginning of the range as an application pool pointer.

func (AllocResult) Range

func (r AllocResult) Range() memory.Range

Range returns the associated memory.Range.

type Cmd

type Cmd interface {
	// All commands belong to an API
	APIObject

	// Caller returns the identifier of the command that called this command,
	// or CmdNoID if the command has no caller.
	Caller() CmdID

	// SetCaller sets the identifier of the command that called this command.
	SetCaller(CmdID)

	// Thread returns the thread index this command was executed on.
	Thread() uint64

	// SetThread changes the thread index.
	SetThread(uint64)

	// CmdName returns the name of the command.
	CmdName() string

	// CmdFlags returns the flags of the command.
	CmdFlags(context.Context, CmdID, *GlobalState) CmdFlags

	// Extras returns all the Extras associated with the dynamic command.
	Extras() *CmdExtras

	// Mutate mutates the State using the command. If the builder argument is
	// not nil then it will call the replay function on the builder.
	Mutate(context.Context, CmdID, *GlobalState, *builder.Builder) error
}

Cmd is the interface implemented by all graphics API commands.

func ServiceToCmd

func ServiceToCmd(c *Command) (Cmd, error)

ServiceToCmd returns the command built from c.

func WithExtras

func WithExtras(a Cmd, extras ...CmdExtra) Cmd

WithExtras adds the given extras to a command and returns it.

type CmdExtra

type CmdExtra interface{}

CmdExtra is the interface implemented by command 'extras' - additional information that can be placed inside a command.

type CmdExtras

type CmdExtras []CmdExtra

CmdExtras is a list of CmdExtra objects.

func (*CmdExtras) Aborted

func (e *CmdExtras) Aborted() *ErrCmdAborted

Aborted returns a pointer to the ErrCmdAborted structure in the CmdExtras, or nil if not found.

func (*CmdExtras) Add

func (e *CmdExtras) Add(es ...CmdExtra)

Add appends one or more CmdExtras to the list of CmdExtras.

func (*CmdExtras) All

func (e *CmdExtras) All() CmdExtras

func (*CmdExtras) GetOrAppendObservations

func (e *CmdExtras) GetOrAppendObservations() *CmdObservations

GetOrAppendObservations returns a pointer to the existing Observations structure in the CmdExtras, or appends and returns a pointer to a new observations structure if the CmdExtras does not already contain one.

func (*CmdExtras) MustClone added in v0.5.0

func (e *CmdExtras) MustClone(es ...CmdExtra)

MustClone clones all of es, adding them to e. if there was an error, a panic is raised

func (*CmdExtras) Observations

func (e *CmdExtras) Observations() *CmdObservations

Observations returns a pointer to the CmdObservations structure in the CmdExtras, or nil if there are no observations in the CmdExtras.

type CmdFlags

type CmdFlags uint32

CmdFlags is a bitfield describing characteristics of a command.

const (
	DrawCall CmdFlags = 1 << iota
	TransformFeedback
	Clear
	StartOfFrame
	EndOfFrame
	PushUserMarker
	PopUserMarker
	UserMarker
)

func (CmdFlags) IsClear

func (f CmdFlags) IsClear() bool

IsClear returns true if the command is a clear call.

func (CmdFlags) IsDrawCall

func (f CmdFlags) IsDrawCall() bool

IsDrawCall returns true if the command is a draw call.

func (CmdFlags) IsEndOfFrame

func (f CmdFlags) IsEndOfFrame() bool

IsEndOfFrame returns true if the command represents the end of a frame.

func (CmdFlags) IsPopUserMarker

func (f CmdFlags) IsPopUserMarker() bool

IsPopUserMarker returns true if the command represents the end of the last pushed user marker.

func (CmdFlags) IsPushUserMarker

func (f CmdFlags) IsPushUserMarker() bool

IsPushUserMarker returns true if the command represents the start of a user marker group. The command may implement the Labeled interface to expose the marker name.

func (CmdFlags) IsStartOfFrame

func (f CmdFlags) IsStartOfFrame() bool

IsStartOfFrame returns true if the command represents the begin of a frame.

func (CmdFlags) IsTransformFeedback added in v0.6.0

func (f CmdFlags) IsTransformFeedback() bool

IsTransformFeedback returns true if the command is a transform-feedback call.

func (CmdFlags) IsUserMarker

func (f CmdFlags) IsUserMarker() bool

IsUserMarker returns true if the command represents a non-grouping user marker. The command may implement the Labeled interface to expose the marker name.

type CmdGroupOrRoot added in v0.5.0

type CmdGroupOrRoot interface {
	SpanItem
	// Index returns the child at the given index. This can either be another
	// group, CmdId or root.
	Index(index uint64) SpanItem
}

CmdGroupOrRoot represents either a named group of commands, or a new SubCmdRoot under which new commands live.

type CmdID

type CmdID uint64

CmdID is the index of a command in a command stream.

func (CmdID) Derived

func (id CmdID) Derived() CmdID

Derived is used to create an ID which is used for generated extra commands. It is used purely for debugging (to print the related original command ID).

func (CmdID) IsReal added in v0.5.1

func (id CmdID) IsReal() bool

IsReal returns true if the id is not derived nor CmdNoID.

func (CmdID) String

func (id CmdID) String() string

type CmdIDGroup

type CmdIDGroup struct {
	Name     string     // Name of this group.
	Range    CmdIDRange // The range of commands this group (and items) represents.
	Spans    Spans      // All sub-groups and sub-ranges of this group.
	UserData interface{}
}

CmdIDGroup represents a named group of commands with support for sparse sub-groups and sub-command-ranges. Groups are ideal for expressing nested hierarchies of commands.

Groups have the concept of items. An item is either an immediate sub-group, or a command range that is within this group's span but outside of any sub-group.

func (*CmdIDGroup) AddCommand added in v0.6.0

func (g *CmdIDGroup) AddCommand(id CmdID) bool

AddCommand adds the command to the groups.

func (*CmdIDGroup) AddGroup

func (g *CmdIDGroup) AddGroup(start, end CmdID, name string) (*CmdIDGroup, error)

If the new group does not overlap any existing groups in the list then it is inserted into the list, keeping ascending command-identifier order. If the new group sits completely within an existing group then this new group will be added to the existing group's sub-groups. If the new group completely wraps one or more existing groups in the list then these existing groups are added as sub-groups to the new group and then the new group is added to the list, keeping ascending command-identifier order. If the new group partially overlaps any existing group then the function will return an error.

*** Warning *** All groups must be added before commands. Attemping to call this function after commands have been added may result in panics!

func (*CmdIDGroup) AddRoot added in v0.5.0

func (g *CmdIDGroup) AddRoot(rootidx []uint64) *SubCmdRoot

AddRoot adds a new Subcommand Root for the given index. It returns the span for this SubcommandGroup

func (*CmdIDGroup) Bounds

func (g *CmdIDGroup) Bounds() CmdIDRange

func (*CmdIDGroup) Cluster added in v0.6.0

func (g *CmdIDGroup) Cluster(maxChildren, maxNeighbours uint64)

Cluster groups together chains of command using the limits maxChildren and maxNeighbours.

If maxChildren is positive, the group, and any of it's decendent groups, which have more than maxChildren child elements, will have their children grouped into new synthetic groups of at most maxChildren children.

If maxNeighbours is positive, we will group long list of ungrouped commands, which are next to a group. This ensures the group is not lost in noise.

func (CmdIDGroup) Count

func (g CmdIDGroup) Count() uint64

Count returns the number of immediate items this group contains.

func (CmdIDGroup) DeepCount

func (g CmdIDGroup) DeepCount(pred func(g CmdIDGroup) bool) uint64

DeepCount returns the total (recursive) number of items this group contains. The given predicate determines wheter the tested group is counted as 1 or is recursed into.

func (CmdIDGroup) FindSubCommandRoot added in v0.5.0

func (g CmdIDGroup) FindSubCommandRoot(id CmdID) *SubCmdRoot

FindSubCommandRoot returns the SubCmdRoot that represents the given CmdID.

func (CmdIDGroup) Format

func (g CmdIDGroup) Format(f fmt.State, r rune)

Format writes a string representing the group's name, range and sub-groups.

func (CmdIDGroup) Index

func (g CmdIDGroup) Index(index uint64) SpanItem

Index returns the item at the specified index.

func (CmdIDGroup) IndexOf

func (g CmdIDGroup) IndexOf(id CmdID) uint64

IndexOf returns the item index that id refers directly to, or contains id.

func (CmdIDGroup) IterateBackwards

func (g CmdIDGroup) IterateBackwards(index uint64, cb func(childIdx uint64, item SpanItem) error) error

IterateBackwards calls cb with each contained command index or group starting with the item at index. If cb returns an error then traversal is stopped and the error is returned.

func (CmdIDGroup) IterateForwards

func (g CmdIDGroup) IterateForwards(index uint64, cb func(childIdx uint64, item SpanItem) error) error

IterateForwards calls cb with each contained command index or group starting with the item at index. If cb returns an error then traversal is stopped and the error is returned.

func (CmdIDGroup) Traverse

func (g CmdIDGroup) Traverse(backwards bool, start []uint64, cb TraverseCallback) error

Traverse traverses the command group starting with the specified index, calling cb for each encountered node.

type CmdIDRange

type CmdIDRange struct {
	Start CmdID // The first command within the range.
	End   CmdID // One past the last command within the range.
}

CmdIDRange describes an interval of commands.

func (*CmdIDRange) Bounds

func (r *CmdIDRange) Bounds() CmdIDRange

func (CmdIDRange) Clamp

func (i CmdIDRange) Clamp(id CmdID) CmdID

Clamp returns the nearest index in the range to id.

func (CmdIDRange) CmdIDRange

func (i CmdIDRange) CmdIDRange() (start, end CmdID)

CmdIDRange returns the start and end of the range.

func (CmdIDRange) Contains

func (i CmdIDRange) Contains(id CmdID) bool

Contains returns true if id is within the range, otherwise false.

func (CmdIDRange) First

func (i CmdIDRange) First() CmdID

First returns the first command index within the range.

func (CmdIDRange) Last

func (i CmdIDRange) Last() CmdID

Last returns the last command index within the range.

func (CmdIDRange) Length

func (i CmdIDRange) Length() uint64

Length returns the number of commands in the range.

func (*CmdIDRange) SetSpan

func (i *CmdIDRange) SetSpan(span interval.U64Span)

SetSpan sets the start and end range using a U64Span.

func (CmdIDRange) Span

func (i CmdIDRange) Span() interval.U64Span

Span returns the start and end of the range as a U64Span.

func (CmdIDRange) Split

func (r CmdIDRange) Split(i uint64) (*CmdIDRange, *CmdIDRange)

Split splits this range into two subranges where the first range will have a length no larger than the given value.

func (CmdIDRange) String

func (i CmdIDRange) String() string

String returns a string representing the range.

type CmdIDSet

type CmdIDSet map[CmdID]struct{}

CmdIDSet is a set of CmdIDs.

func (*CmdIDSet) Add

func (s *CmdIDSet) Add(id CmdID)

Add adds id to the set. If the id was already in the set then the call does nothing.

func (CmdIDSet) Contains

func (s CmdIDSet) Contains(id CmdID) bool

Contains returns true if id is in the set, otherwise false.

func (*CmdIDSet) Remove

func (s *CmdIDSet) Remove(id CmdID)

Remove removes id from the set. If the id was not in the set then the call does nothing.

type CmdObservation

type CmdObservation struct {
	Pool  memory.PoolID // The pool in which the memory was observed.
	Range memory.Range  // Memory range that was observed.
	ID    id.ID         // The resource identifier of the observed data.
}

CmdObservation represents a single read or write observation made by an command.

func (CmdObservation) String

func (o CmdObservation) String() string

type CmdObservations

type CmdObservations struct {
	Reads  []CmdObservation
	Writes []CmdObservation
}

CmdObservations is a collection of reads and write observations performed by an command.

func (*CmdObservations) AddRead

func (o *CmdObservations) AddRead(rng memory.Range, id id.ID)

AddRead appends the read to the list of observations.

func (*CmdObservations) AddWrite

func (o *CmdObservations) AddWrite(rng memory.Range, id id.ID)

AddWrite appends the write to the list of observations.

func (*CmdObservations) ApplyReads

func (o *CmdObservations) ApplyReads(p *memory.Pool)

ApplyReads applies all the observed reads to memory pool p. This is a no-op when called when o is nil.

func (*CmdObservations) ApplyWrites

func (o *CmdObservations) ApplyWrites(p *memory.Pool)

ApplyWrites applies all the observed writes to the memory pool p. This is a no-op when called when o is nil.

func (*CmdObservations) DataString

func (o *CmdObservations) DataString(ctx context.Context) string

DataString returns a string describing all reads/writes and their raw data.

func (*CmdObservations) String

func (o *CmdObservations) String() string

type CmdWithResult added in v0.6.0

type CmdWithResult interface {
	Cmd

	// GetResult returns the result value for this command.
	GetResult() proto.Message

	// SetResult changes the result value. Returns an error if the result proto
	// type does not match this command.
	SetResult(proto.Message) error
}

CmdWithResult is the optional interface implemented by commands that have a result value.

type Context

type Context interface {
	APIObject

	// ID returns the context's unique identifier
	ID() ContextID
}

Context represents a graphics API's unique context of execution.

type ContextID

type ContextID id.ID

ContextID is the unique identifier for a context.

type ContextInfo added in v0.6.1

type ContextInfo struct {
	Path              *path.Context
	ID                ContextID
	API               ID
	NumCommandsByType map[reflect.Type]int
	Name              string
	Priority          int
	UserData          map[interface{}]interface{}
}

ContextInfo is describes a Context. Unlike Context, ContextInfo describes the context at no particular point in the trace.

type GlobalState added in v0.6.1

type GlobalState struct {
	// MemoryLayout holds information about the device memory layout that was
	// used to create the capture.
	MemoryLayout *device.MemoryLayout

	// Memory holds the memory state of the application.
	Memory memory.Pools

	// APIs holds the per-API context states.
	APIs map[ID]State

	// Allocator keeps track of and reserves memory areas not used in the trace.
	Allocator memory.Allocator

	// OnResourceCreated is called when a new resource is created.
	OnResourceCreated func(Resource)

	// OnResourceAccessed is called when a resource is used.
	OnResourceAccessed func(Resource)

	// OnError is called when the command does not conform to the API.
	OnError func(err interface{})

	// NewMessage is called when there is a message to be passed to a report.
	NewMessage func(level log.Severity, msg *stringtable.Msg) uint32

	// AddTag is called when we want to tag report item.
	AddTag func(msgID uint32, msg *stringtable.Msg)
}

GlobalState represents the graphics state across all contexts.

func NewStateWithAllocator

func NewStateWithAllocator(allocator memory.Allocator, memoryLayout *device.MemoryLayout) *GlobalState

NewStateWithAllocator returns a new, default-initialized State object, that uses the given memory.Allocator instance.

func NewStateWithEmptyAllocator

func NewStateWithEmptyAllocator(memoryLayout *device.MemoryLayout) *GlobalState

NewStateWithEmptyAllocator returns a new, default-initialized State object, that uses an allocator with no allocations.

func (*GlobalState) Alloc added in v0.6.1

func (s *GlobalState) Alloc(ctx context.Context, size uint64) (AllocResult, error)

Alloc allocates a memory range using the Allocator associated with the given State, and returns a AllocResult that can be used to access the pointer, and range.

func (*GlobalState) AllocData added in v0.6.1

func (s *GlobalState) AllocData(ctx context.Context, v ...interface{}) (AllocResult, error)

AllocData encodes and stores the value v to the database d, allocates a memory range big enough to store it using the Allocator associated with the given State, and returns a AllocResult that can be used to access the database ID, pointer, and range.

func (*GlobalState) AllocDataOrPanic added in v0.6.1

func (s *GlobalState) AllocDataOrPanic(ctx context.Context, v ...interface{}) AllocResult

AllocDataOrPanic is like AllocData, but panics if there's an error.

func (*GlobalState) AllocOrPanic added in v0.6.1

func (s *GlobalState) AllocOrPanic(ctx context.Context, size uint64) AllocResult

AllocOrPanic is like Alloc, but panics if there's an error.

func (GlobalState) MemoryDecoder added in v0.6.1

func (s GlobalState) MemoryDecoder(ctx context.Context, d memory.Data) *memory.Decoder

MemoryDecoder returns a memory decoder using the state's memory layout to decode data from d.

func (GlobalState) MemoryEncoder added in v0.6.1

func (s GlobalState) MemoryEncoder(p memory.PoolID, rng memory.Range) *memory.Encoder

MemoryEncoder returns a memory encoder using the state's memory layout to encode to the pool p, for the range rng.

func (GlobalState) MemoryReader added in v0.6.1

func (s GlobalState) MemoryReader(ctx context.Context, d memory.Data) binary.Reader

MemoryReader returns a binary reader using the state's memory endianness to read data from d.

func (GlobalState) MemoryWriter added in v0.6.1

func (s GlobalState) MemoryWriter(p memory.PoolID, rng memory.Range) binary.Writer

MemoryWriter returns a binary writer using the state's memory endianness to write data to the pool p, for the range rng.

func (GlobalState) String added in v0.6.1

func (s GlobalState) String() string

type ID

type ID id.ID

ID is an API identifier

func (ID) IsValid

func (i ID) IsValid() bool

IsValid returns true if the id is not the default zero value.

func (ID) String added in v0.6.1

func (i ID) String() string

type Labeled

type Labeled interface {
	// Label returns the commands's label.
	Label(ctx context.Context, s *GlobalState) string
}

Labeled is the interface implemented commands that have a label.

type MeshProvider

type MeshProvider interface {
	// Mesh returns the mesh representation of the object o.
	// If nil, nil then the object cannot be represented as a mesh.
	Mesh(ctx context.Context, o interface{}, p *path.Mesh) (*Mesh, error)
}

MeshProvider is the interface implemented by types that provide meshes.

type ReplaceCallback

type ReplaceCallback func(where uint64, with interface{})

ReplaceCallback is called from SetResourceData to propagate changes to current command stream.

type Resource

type Resource interface {
	// ResourceHandle returns the UI identity for the resource.
	// For GL this is the GLuint object name, for Vulkan the pointer.
	ResourceHandle() string

	// ResourceLabel returns the UI name for the resource.
	ResourceLabel() string

	// Order returns an integer used to sort the resources for presentation.
	Order() uint64

	// ResourceType returns the type of this resource.
	ResourceType(ctx context.Context) ResourceType

	// ResourceData returns the resource data given the current state.
	ResourceData(ctx context.Context, s *GlobalState) (*ResourceData, error)

	// SetResourceData sets resource data in a new capture.
	SetResourceData(ctx context.Context, at *path.Command, data *ResourceData, resources ResourceMap, edits ReplaceCallback) error
}

Resource represents an asset in a capture.

type ResourceMap

type ResourceMap map[Resource]id.ID

ResourceMap is a map from Resource to its id in a database.

type ResourceMeta

type ResourceMeta struct {
	Resource Resource    // Resolved resource.
	IDMap    ResourceMap // Map for resolved resources to ids.
}

ResourceMeta represents resource with a state information obtained during building.

type Span

type Span interface {
	// Bounds returns the absolute range of command indices for the span.
	Bounds() CmdIDRange
	// contains filtered or unexported methods
}

Span is a child of a CmdIDGroup. It is implemented by CmdIDGroup and CmdIDRange and SubCmdRoot

type SpanItem added in v0.5.0

type SpanItem interface {
	// contains filtered or unexported methods
}

SpanItem is a dummy interface exclusively implemented by CmdIDGroup, SubCmdIdx and SubCmdRoot

type Spans

type Spans []Span

Spans is a list of Span elements. Functions in this package expect the list to be in ascending command index order, and maintain that order on mutation.

func (Spans) GetSpan

func (l Spans) GetSpan(index int) interval.U64Span

GetSpan returns the command index span for the group at index in the list.

func (*Spans) IndexOf

func (l *Spans) IndexOf(id CmdID) int

IndexOf returns the index of the group that contains the command id or -1 if not found.

func (Spans) Length

func (l Spans) Length() int

Length returns the number of groups in the list.

type State

type State interface {
	// All states belong to an API
	APIObject

	// Root returns the path to the root of the state to display. It can vary
	// based on filtering mode. Returning nil, nil indicates there is no state
	// to show at this point in the capture.
	Root(ctx context.Context, p *path.State) (path.Node, error)

	// SetupInitialState sanitizes deserialized state to make it valid.
	// It can fill in any derived data which we choose not to serialize,
	// or it can apply backward-compatibility fixes for older traces.
	SetupInitialState(ctx context.Context)

	// RebuildState returns a set of commands which, if executed
	// on a clean new state, will reproduce the current state.
	RebuildState(ctx context.Context, s *GlobalState) []Cmd
}

State represents the graphics state for a single context.

type SubCmdIdx added in v0.5.0

type SubCmdIdx []uint64

SubCmdIdx is a qualified path from a particular index to a given subcommand.

func (SubCmdIdx) Contains added in v0.6.0

func (s SubCmdIdx) Contains(s2 SubCmdIdx) bool

Contains returns true if s is one of the parent nodes of s2 or equals to s2.

func (*SubCmdIdx) Decrement added in v0.5.0

func (s *SubCmdIdx) Decrement()

Decrement returns the subcommand that preceded this subcommand. Decrement will decrement its way UP subcommand chains. Eg: {0, 1}.Decrement() == {0, 0}

{1, 0}.Decrement() == {0}
{0}.Decrement() == {}

func (SubCmdIdx) Equals added in v0.5.0

func (s SubCmdIdx) Equals(s2 SubCmdIdx) bool

Equals returns true if both sets of subcommand indices are the same.

func (SubCmdIdx) LEQ added in v0.5.0

func (s SubCmdIdx) LEQ(s2 SubCmdIdx) bool

LEQ returns true if s comes before s2.

func (SubCmdIdx) LessThan added in v0.5.0

func (s SubCmdIdx) LessThan(s2 SubCmdIdx) bool

LessThan returns true if s comes before s2.

type SubCmdIdxTrie added in v0.6.0

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

SubCmdIdxTrie is a map-based trie using SubCmdIdx for indexing the data stored inside.

func (*SubCmdIdxTrie) PostOrderSortedKeys added in v0.9.0

func (t *SubCmdIdxTrie) PostOrderSortedKeys() []SubCmdIdx

PostOrderSortedKeys returns the keys of the value stored in the trie, the keys will be sorted in the post traversal order and lesser to greater. e.g.: [0, 1, 2], [0, 2], [1], [1, 2, 3], [0, 1] will be sorted as: [0, 1, 2], [0, 1], [0, 2], [1, 2, 3], [1]

func (*SubCmdIdxTrie) RemoveValue added in v0.6.0

func (t *SubCmdIdxTrie) RemoveValue(indices SubCmdIdx) bool

RemoveValue tries to remove a value indexed by the given SubCmdIdx in the trie. If a value is found, removes it and returns true. If a value with that SubCmdIdx is not found, returns false.

func (*SubCmdIdxTrie) SetValue added in v0.6.0

func (t *SubCmdIdxTrie) SetValue(indices SubCmdIdx, v interface{})

SetValue sets a value to the trie with the given SubCmdIdx as index.

func (*SubCmdIdxTrie) Value added in v0.6.0

func (t *SubCmdIdxTrie) Value(indices SubCmdIdx) interface{}

Value returnes the value stored in the trie indexed by the given SubCmdIdx. if no value is found by the given SubCmdIdx, returns nil.

type SubCmdRoot added in v0.5.0

type SubCmdRoot struct {
	Id       SubCmdIdx  // The fully qualified index of the node
	SubGroup CmdIDGroup // The range of subcommands in this range
}

SubCmdRoot is a new namespace under which subcommands live.

func NewRoot added in v0.5.0

func NewRoot(idx []uint64) *SubCmdRoot

NewRoot sets up a new root object.

func (*SubCmdRoot) AddSubCmdMarkerGroups added in v0.6.1

func (c *SubCmdRoot) AddSubCmdMarkerGroups(r []uint64, groups []*CmdIDGroup) error

AddSubCmdMarkerGroups adds the given groups to the target SubCmdRoot with the relative hierarchy specified in r. If the groups are not added as immediate children of the target SubCmdRoot (r is not empty), child SubCmdRoots will be created under the target SubCmdRoot recursively until the immediate parent SubCmdRoot is created.

func (*SubCmdRoot) Bounds added in v0.5.0

func (c *SubCmdRoot) Bounds() CmdIDRange

func (SubCmdRoot) Index added in v0.5.0

func (c SubCmdRoot) Index(index uint64) SpanItem

func (*SubCmdRoot) Insert added in v0.5.0

func (c *SubCmdRoot) Insert(r []uint64)

Insert adds a new subcommand into the SubCmdRoot. The subcommand is specified with its relative hierarchy to the target SubCmdRoot. If the subcommand is not an immediate child of the target SubCmdRoot (i.e. len(r) > 1) , new child SubCmdRoots will be created under the target SubCmdRoot, until the immediate parent of the subcommand is created.

type TraverseCallback

type TraverseCallback func(indices []uint64, item SpanItem) error

TraverseCallback is the function that's called for each traversed item in a group.

Directories

Path Synopsis
Package all is used to import all known api APIs for their side effects.
Package all is used to import all known api APIs for their side effects.
Package gles implementes the API interface for the OpenGL ES graphics library.
Package gles implementes the API interface for the OpenGL ES graphics library.
gles_pb
Package gles_pb describes the serialization format for the gles api.
Package gles_pb describes the serialization format for the gles api.
Package gvr implementes the API interface for the Google VR library.
Package gvr implementes the API interface for the Google VR library.
Package sync provides interfaces for managing externally synchronized APIs.
Package sync provides interfaces for managing externally synchronized APIs.
Package test is the integration test suite for the api compiler and templates.
Package test is the integration test suite for the api compiler and templates.
test_pb
Package test_pb describes the serialization format for the test api.
Package test_pb describes the serialization format for the test api.
Package testcmd provides fake commands used for testing.
Package testcmd provides fake commands used for testing.
test_pb
Package test_pb describes the serialization format for the test api.
Package test_pb describes the serialization format for the test api.
Package transform provides transforms on commands.
Package transform provides transforms on commands.
Package vulkan implementes the API interface for the Vulkan graphics library.
Package vulkan implementes the API interface for the Vulkan graphics library.
vulkan_pb
Package vulkan_pb describes the serialization format for the vulkan api.
Package vulkan_pb describes the serialization format for the vulkan api.

Jump to

Keyboard shortcuts

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