Documentation ¶
Overview ¶
Package api exposes the shared behavior of all graphics api's.
Index ¶
- Constants
- func CmdCallFor(cmd Cmd) proto.Message
- func ForeachCmd(ctx context.Context, cmds []Cmd, onlyTerminated bool, ...) error
- func GetParameter(c Cmd, name string) (interface{}, error)
- func GetResult(c Cmd) (interface{}, error)
- func IsErrCmdAborted(err error) bool
- func MutateCmds(ctx context.Context, state *GlobalState, builder *builder.Builder, ...) error
- func Register(api API)
- func SetParameter(c Cmd, name string, val interface{}) error
- func SetResult(c Cmd, val interface{}) error
- type API
- type APIObject
- type AllocResult
- type ArrayIndexFragment
- type CloneContext
- type Cmd
- type CmdExtra
- type CmdExtras
- func (e *CmdExtras) Aborted() *ErrCmdAborted
- func (e *CmdExtras) Add(es ...CmdExtra)
- func (e *CmdExtras) All() CmdExtras
- func (e *CmdExtras) GetOrAppendObservations() *CmdObservations
- func (e *CmdExtras) MustClone(es ...CmdExtra)
- func (e *CmdExtras) Observations() *CmdObservations
- func (e *CmdExtras) Replace(old, new CmdExtra)
- type CmdFlags
- func (f CmdFlags) IsClear() bool
- func (f CmdFlags) IsDrawCall() bool
- func (f CmdFlags) IsEndOfFrame() bool
- func (f CmdFlags) IsExecutedDraw() bool
- func (f CmdFlags) IsPopUserMarker() bool
- func (f CmdFlags) IsPushUserMarker() bool
- func (f CmdFlags) IsStartOfFrame() bool
- func (f CmdFlags) IsSubmission() bool
- func (f CmdFlags) IsTransformFeedback() bool
- func (f CmdFlags) IsUserMarker() bool
- type CmdGroupOrRoot
- type CmdID
- type CmdIDGroup
- func (g *CmdIDGroup) AddCommand(id CmdID) bool
- func (g *CmdIDGroup) AddGroup(start, end CmdID, name string) (*CmdIDGroup, error)
- func (g *CmdIDGroup) AddRoot(rootidx []uint64) *SubCmdRoot
- func (g *CmdIDGroup) Bounds() CmdIDRange
- func (g *CmdIDGroup) Cluster(maxChildren, maxNeighbours uint64)
- func (g CmdIDGroup) Count() uint64
- func (g CmdIDGroup) DeepCount(pred func(g CmdIDGroup) bool) uint64
- func (g CmdIDGroup) FindSubCommandRoot(id CmdID) *SubCmdRoot
- func (g CmdIDGroup) Format(f fmt.State, r rune)
- func (g CmdIDGroup) Index(index uint64) SpanItem
- func (g CmdIDGroup) IndexOf(id CmdID) uint64
- func (g CmdIDGroup) IterateBackwards(index uint64, cb func(childIdx uint64, item SpanItem) error) error
- func (g CmdIDGroup) IterateForwards(index uint64, cb func(childIdx uint64, item SpanItem) error) error
- func (g CmdIDGroup) Traverse(backwards bool, start []uint64, cb TraverseCallback) error
- type CmdIDRange
- func (r *CmdIDRange) Bounds() CmdIDRange
- func (i CmdIDRange) Clamp(id CmdID) CmdID
- func (i CmdIDRange) CmdIDRange() (start, end CmdID)
- func (i CmdIDRange) Contains(id CmdID) bool
- func (i CmdIDRange) First() CmdID
- func (i CmdIDRange) Last() CmdID
- func (i CmdIDRange) Length() uint64
- func (i *CmdIDRange) SetSpan(span interval.U64Span)
- func (i CmdIDRange) Span() interval.U64Span
- func (r CmdIDRange) Split(i uint64) (*CmdIDRange, *CmdIDRange)
- func (i CmdIDRange) String() string
- type CmdIDSet
- type CmdObservation
- type CmdObservations
- func (o *CmdObservations) AddRead(rng memory.Range, id id.ID)
- func (o *CmdObservations) AddWrite(rng memory.Range, id id.ID)
- func (o *CmdObservations) ApplyReads(p *memory.Pool)
- func (o *CmdObservations) ApplyWrites(p *memory.Pool)
- func (o *CmdObservations) DataString(ctx context.Context) string
- func (o *CmdObservations) String() string
- type CmdWithResult
- type CompleteFragment
- type Context
- type ContextID
- type ContextInfo
- type DenseFragment
- type DenseFragmentMap
- func (m DenseFragmentMap) Clear()
- func (m DenseFragmentMap) Delete(f Fragment)
- func (m DenseFragmentMap) EmptyClone() FragmentMap
- func (m DenseFragmentMap) ForeachFrag(f func(Fragment, interface{}) error) error
- func (m DenseFragmentMap) Get(f Fragment) (interface{}, bool)
- func (m *DenseFragmentMap) Set(f Fragment, v interface{})
- type Field
- type FieldFragment
- type Fragment
- type FragmentMap
- type FramebufferAttachmentInfo
- type GlobalState
- func (s *GlobalState) Alloc(ctx context.Context, size uint64) (AllocResult, error)
- func (s *GlobalState) AllocData(ctx context.Context, v ...interface{}) (AllocResult, error)
- func (s *GlobalState) AllocDataOrPanic(ctx context.Context, v ...interface{}) AllocResult
- func (s *GlobalState) AllocOrPanic(ctx context.Context, size uint64) AllocResult
- func (s GlobalState) MemoryDecoder(ctx context.Context, d memory.Data) *memory.Decoder
- func (s GlobalState) MemoryEncoder(p memory.PoolID, rng memory.Range) *memory.Encoder
- func (s GlobalState) MemoryReader(ctx context.Context, d memory.Data) binary.Reader
- func (s GlobalState) MemoryWriter(p memory.PoolID, rng memory.Range) binary.Writer
- func (s *GlobalState) ReserveMemory(rngs interval.U64RangeList) *GlobalState
- func (s GlobalState) String() string
- type GraphVisualizationAPI
- type GraphVisualizationBuilder
- type Hierarchy
- type HierarchyNames
- type ID
- type Label
- func (label *Label) GetCommandId() int
- func (label *Label) GetCommandName() string
- func (label *Label) GetLabelAsAString() string
- func (label *Label) GetSize() int
- func (label *Label) GetTopLevelID() int
- func (label *Label) GetTopLevelName() string
- func (label *Label) Insert(level int, name string, id int)
- func (label *Label) PushBack(name string, id int)
- func (label *Label) PushBackLabel(labelToPush *Label)
- func (label *Label) PushFront(name string, id int)
- type Labeled
- type MapIndexFragment
- type MemoryBreakdownProvider
- type MeshProvider
- type MutateInitialState
- type NilReference
- type Properties
- type Property
- type PropertyProvider
- type RecordIdx
- type RefID
- type RefObject
- type Reference
- type ReplaceCallback
- type Resource
- type ResourceMap
- type ResourceMeta
- type Slice
- type Span
- type SpanItem
- type Spans
- type SparseFragmentMap
- func (m SparseFragmentMap) Clear()
- func (m SparseFragmentMap) Delete(f Fragment)
- func (m SparseFragmentMap) EmptyClone() FragmentMap
- func (m SparseFragmentMap) ForeachFrag(f func(Fragment, interface{}) error) error
- func (m SparseFragmentMap) Get(f Fragment) (interface{}, bool)
- func (m *SparseFragmentMap) Set(f Fragment, v interface{})
- type State
- type StateWatcher
- type SubCmdIdx
- type SubCmdIdxTrie
- func (t *SubCmdIdxTrie) PostOrderSortedKeys() []SubCmdIdx
- func (t *SubCmdIdxTrie) RemoveValue(indices SubCmdIdx) bool
- func (t *SubCmdIdxTrie) SetValue(indices SubCmdIdx, v interface{})
- func (t *SubCmdIdxTrie) Value(indices SubCmdIdx) interface{}
- func (t *SubCmdIdxTrie) Values(indices SubCmdIdx) []interface{}
- type SubCmdRoot
- type TraverseCallback
Constants ¶
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") )
const Break tyBreak = tyBreak(0)
Break can be returned from the callback passed to ForeachCmd to stop iteration of the loop.
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.
const NilRefID = RefID(0)
NilRefID identifies a nil reference in the API models.
Variables ¶
This section is empty.
Functions ¶
func CmdCallFor ¶
CmdCallFor returns the proto message type for the call result of cmd.
func ForeachCmd ¶
func ForeachCmd(ctx context.Context, cmds []Cmd, onlyTerminated bool, 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. onlyTerminated: skip commands that were not terminated as capture time
func GetParameter ¶
GetParameter returns the parameter value with the specified name.
func IsErrCmdAborted ¶
IsErrCmdAborted returns true if the cause of the error err was due to an abort() in the command.
func MutateCmds ¶
func MutateCmds(ctx context.Context, state *GlobalState, builder *builder.Builder, watcher StateWatcher, cmds ...Cmd) error
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 ¶
SetParameter sets the parameter with the specified name with 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) (info FramebufferAttachmentInfo, err error) // Context returns the active context for the given state. Context(ctx context.Context, state *GlobalState, thread uint64) Context // CreateCmd constructs and returns a new command with the specified name. CreateCmd(a arena.Arena, name string) Cmd // RebuildState returns a set of commands which, if executed on a new clean // state, will reproduce the API's state in s. // The segments of memory that were used to create these commands are // returned in the rangeList. RebuildState(ctx context.Context, s *GlobalState) ([]Cmd, interval.U64RangeList) }
API is the common interface to a graphics programming api.
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 a pointer to the beginning of the range.
func (AllocResult) Range ¶
func (r AllocResult) Range() memory.Range
Range returns the associated memory.Range.
type ArrayIndexFragment ¶
type ArrayIndexFragment struct {
ArrayIndex int
}
ArrayIndexFragment is a Fragment identifying an array index. This corresponds to syntax such as `myArray[3]`.
func (ArrayIndexFragment) DenseIndex ¶
func (f ArrayIndexFragment) DenseIndex() int
type CloneContext ¶
type CloneContext map[interface{}]interface{}
CloneContext is used to keep track of references when cloning API objects.
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 // CmdParams returns the command's parameters. CmdParams() Properties // CmdResult returns the command's result value, or nil if there is no // result value. CmdResult() *Property // CmdFlags returns the flags of the command. CmdFlags(context.Context, CmdID, *GlobalState) CmdFlags // Extras returns all the Extras associated with the 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, StateWatcher) error // Clone makes a shallow copy of this command. Clone(arena.Arena) Cmd // Alive returns true if this command should be marked alive for DCE Alive() bool // Terminated returns true if this command did terminate during capture Terminated() bool // SetTerminated sets whether this command has terminated or not SetTerminated(terminated bool) }
Cmd is the interface implemented by all graphics API commands.
func ServiceToCmd ¶
ServiceToCmd returns the command built from c.
func WithExtras ¶
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) 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 ¶
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.
func (CmdFlags) IsDrawCall ¶
IsDrawCall returns true if the command is a draw call.
func (CmdFlags) IsEndOfFrame ¶
IsEndOfFrame returns true if the command represents the end of a frame.
func (CmdFlags) IsExecutedDraw ¶
IsExecutedDraw returns true if the command is a draw call that gets executed as a subcommand.
func (CmdFlags) IsPopUserMarker ¶
IsPopUserMarker returns true if the command represents the end of the last pushed user marker.
func (CmdFlags) IsPushUserMarker ¶
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 ¶
IsStartOfFrame returns true if the command represents the begin of a frame.
func (CmdFlags) IsSubmission ¶
IsSubmission returns true if the command is a submission
func (CmdFlags) IsTransformFeedback ¶
IsTransformFeedback returns true if the command is a transform-feedback call.
func (CmdFlags) IsUserMarker ¶
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 ¶
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 ¶
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).
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Add adds id to the set. If the id was already 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 ¶
type CmdWithResult interface { Cmd // CallResult returns the result value for this command. CallResult() proto.Message // SetCallResult changes the result value. Returns an error if the result // proto type does not match this command. SetCallResult(context.Context, proto.Message) error }
CmdWithResult is the optional interface implemented by commands that have a result value.
type CompleteFragment ¶
type CompleteFragment struct{}
CompleteFragment is a Fragment identifying the entire object (all fields), map (all key/value pairs) or array (all values).
func (CompleteFragment) DenseIndex ¶
func (CompleteFragment) DenseIndex() int
type ContextInfo ¶
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 DenseFragment ¶
type DenseFragment interface {
DenseIndex() int
}
type DenseFragmentMap ¶
type DenseFragmentMap struct {
Values []denseFragmentMapEntry
}
func NewDenseFragmentMap ¶
func NewDenseFragmentMap(cap int) *DenseFragmentMap
func (DenseFragmentMap) Clear ¶
func (m DenseFragmentMap) Clear()
func (DenseFragmentMap) Delete ¶
func (m DenseFragmentMap) Delete(f Fragment)
func (DenseFragmentMap) EmptyClone ¶
func (m DenseFragmentMap) EmptyClone() FragmentMap
func (DenseFragmentMap) ForeachFrag ¶
func (m DenseFragmentMap) ForeachFrag(f func(Fragment, interface{}) error) error
func (DenseFragmentMap) Get ¶
func (m DenseFragmentMap) Get(f Fragment) (interface{}, bool)
func (*DenseFragmentMap) Set ¶
func (m *DenseFragmentMap) Set(f Fragment, v interface{})
type FieldFragment ¶
type FieldFragment struct {
Field
}
FieldFragment is a Fragment identifying a field member of an API object. This corresponds to API syntax such as `myObj.fieldName`.
func (FieldFragment) DenseIndex ¶
func (f FieldFragment) DenseIndex() int
type Fragment ¶
type Fragment interface {
// contains filtered or unexported methods
}
Fragment is an interface which marks types which identify pieces of API objects. All of the implementations appear below.
type FragmentMap ¶
type FramebufferAttachmentInfo ¶
type FramebufferAttachmentInfo struct { // Width in texels of the framebuffer Width uint32 // Height in texels of the framebuffer Height uint32 // Framebuffer index Index uint32 // Format of the image Format *image.Format // CanResize is true if this can be efficiently resized during replay. CanResize bool }
FramebufferAttachmentInfo describes a framebuffer at a given point in the trace
type GlobalState ¶
type GlobalState struct { // MemoryLayout holds information about the device memory layout that was // used to create the capture. MemoryLayout *device.MemoryLayout // Arena is the memory arena used for state allocations. Arena arena.Arena // 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) // OnResourceDestroyed is called when a resource is destroyed. OnResourceDestroyed 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 ¶
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 ¶
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 ¶
func (s *GlobalState) AllocDataOrPanic(ctx context.Context, v ...interface{}) AllocResult
AllocDataOrPanic is like AllocData, but panics if there's an error.
func (*GlobalState) AllocOrPanic ¶
func (s *GlobalState) AllocOrPanic(ctx context.Context, size uint64) AllocResult
AllocOrPanic is like Alloc, but panics if there's an error.
func (GlobalState) MemoryDecoder ¶
MemoryDecoder returns a memory decoder using the state's memory layout to decode data from d.
func (GlobalState) MemoryEncoder ¶
MemoryEncoder returns a memory encoder using the state's memory layout to encode to the pool p, for the range rng.
func (GlobalState) MemoryReader ¶
MemoryReader returns a binary reader using the state's memory endianness to read data from d.
func (GlobalState) MemoryWriter ¶
MemoryWriter returns a binary writer using the state's memory endianness to write data to the pool p, for the range rng.
func (*GlobalState) ReserveMemory ¶
func (s *GlobalState) ReserveMemory(rngs interval.U64RangeList) *GlobalState
ReserveMemory reserves the specifed memory ranges from the state's allocator, preventing them from being allocated. ReserveMemory is a fluent helper function for calling s.Allocator.ReserveMemory(rngs).
func (GlobalState) String ¶
func (s GlobalState) String() string
type GraphVisualizationAPI ¶
type GraphVisualizationAPI interface { // GetGraphVisualizationBuilder returns a interface to GraphVisualizationBuilder GetGraphVisualizationBuilder() GraphVisualizationBuilder }
GraphVisualizationAPI is the common interface for graph visualization.
type GraphVisualizationBuilder ¶
type GraphVisualizationBuilder interface { // GetCommandLabel returns the Label for the command GetCommandLabel(command Cmd, cmdId uint64) *Label // GetSubCommandLabel returns the Label for the subcommand GetSubCommandLabel(index SubCmdIdx, commandName string, cmdId uint64, subCommandName string) *Label }
GraphVisualizationBuilder is the common interface used to process commands from graphics API in order to get the Label for nodes in the graph visualization.
type Hierarchy ¶
type Hierarchy struct {
LevelsID []int
}
Hierarchy describes the levels ID of hierarchy for vulkan commands and vulkan subcommands.
func (*Hierarchy) IncreaseIDByOne ¶
IncreaseIDByOne increases in one a level ID, indexed from 1.
func (*Hierarchy) PopBack ¶
func (h *Hierarchy) PopBack()
PopBack removes the last level in Hierarchy.
func (*Hierarchy) PopBackToResize ¶
PopBackToResize keeps removing the back level until to get newSize levels in Hierarchy.
func (*Hierarchy) PushBackToResize ¶
PushBackToResize keeps adding a new level in the back until to get newSize levels in Hierarchy.
type HierarchyNames ¶
type HierarchyNames struct { // BeginNameToLevel are the vulkan commands name that begin a new level. BeginNameToLevel map[string]int // EndNameToLevel are the vulkan commands name that end a new level. EndNameToLevel map[string]int // NameOfLevels are the names assigned to new levels. NameOfLevels []string }
HierarchyNames describes the levels name of Hierarchy for vulkan commands and vulkan subcommands.
func (*HierarchyNames) GetName ¶
func (hierarchyNames *HierarchyNames) GetName(level int) string
GetName returns name for a specific level, indexed from 1.
func (*HierarchyNames) PushBack ¶
func (hierarchyNames *HierarchyNames) PushBack(beginName, endName, name string)
PushBack adds in the back a new level with beginName, endName and the name for this level.
type ID ¶
ID is an API identifier
type Label ¶
type Label struct { // LevelsName is the name for each level that node belongs // from top level to down level. LevelsName []string // LevelsID is the ID for each level that node belongs // from top level to down level. LevelsID []int }
Label describes the levels of hierarchy for nodes in the graph visualization using TensorBoard which reads pbtxt format.
func (*Label) GetCommandId ¶
GetCommandId returns the ID of the last level corresponding to the node ID.
func (*Label) GetCommandName ¶
GetCommandName returns the name of the last level corresponding to the node name.
func (*Label) GetLabelAsAString ¶
GetLabelAsAString returns the Label as a string concatenating names and ID for each level delimited by '/'.
func (*Label) GetTopLevelID ¶
GetTopLevelID returns the ID of the first level corresponding to the top level in hierarchy.
func (*Label) GetTopLevelName ¶
GetTopLevelName returns the name of the first level corresponding to the top level in hierarchy.
func (*Label) PushBackLabel ¶
PushBackLabel adds a Label in the back of the current Label.
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 MapIndexFragment ¶
type MapIndexFragment struct {
MapIndex interface{}
}
MapIndexFragment is a Fragment identifying a map index. This corresponds to syntax such as `myMap["foo"]`
type MemoryBreakdownProvider ¶
type MemoryBreakdownProvider interface { // MemoryBreakdown stores an overview of the state's memory layout into // a MemoryBreakdown object. The layout includes data on memory types, // allocations, and which resources are bound to which locations in // memory. MemoryBreakdown(*GlobalState) (*MemoryBreakdown, error) }
MemoryBreakdown is the type implemented by APIs that can report the memory layout of their state.
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, r *path.ResolveConfig) (*Mesh, error) }
MeshProvider is the interface implemented by types that provide meshes.
type MutateInitialState ¶
MutateInitialState is called from SetResourceData to get a mutable instance of the initial state.
type NilReference ¶
type NilReference struct{}
NilReference is a type representing a nil reference where an implementation of the `Reference` interface is expected.
func (NilReference) NewFragmentMap ¶
func (NilReference) NewFragmentMap() FragmentMap
func (NilReference) RefID ¶
func (NilReference) RefID() RefID
type Properties ¶
type Properties []*Property
Properties is a list of property pointers.
func (Properties) Find ¶
func (l Properties) Find(name string) *Property
Find returns the property with the given name, or nil if no matching property is found.
type Property ¶
type Property struct { // Name of the property. Name string // Type of the value. Type reflect.Type // Get gets the property value from the given object. Get func() interface{} // Set assigns the value to the property on the given object. // For read-only properties Set may be nil. Set func(value interface{}) // Constants is the optional index of the constant set used by the value. // -1 represents no constant set. Constants int }
Property represents a single field on an object. A Property has a getter for reading the field value, and an optional setter for assigning to the field.
func NewProperty ¶
NewProperty returns a new Property using the given getter and setter functions. set may be nil in the case of a read-only property.
func (*Property) SetConstants ¶
SetConstants is a helper method for setting the Constants field in a fluent expression.
type PropertyProvider ¶
type PropertyProvider interface {
Properties() Properties
}
PropertyProvider is the interface implemented by types that provide properties.
type RefID ¶
type RefID uint64
RefID is a type used to identify instances of the reference types used in the API models.
type RefObject ¶
type RefObject interface { Reference NewFragmentMap() FragmentMap }
type Reference ¶
type Reference interface {
RefID() RefID
}
Reference is an interface which exposes a unique identifier. Reference types in the API models should implement this interface.
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, cmd *path.Command) (*ResourceData, error) // SetResourceData sets resource data in a new capture. SetResourceData( ctx context.Context, at *path.Command, data *ResourceData, resources ResourceMap, edits ReplaceCallback, mutate MutateInitialState, r *path.ResolveConfig) error }
Resource represents an asset in a capture.
type ResourceMap ¶
ResourceMap is a map from Resource to its id in a database.
type ResourceMeta ¶
type ResourceMeta struct { Resources []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 ¶
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.
type SparseFragmentMap ¶
type SparseFragmentMap struct {
Map map[Fragment]interface{}
}
func NewSparseFragmentMap ¶
func NewSparseFragmentMap() *SparseFragmentMap
func (SparseFragmentMap) Clear ¶
func (m SparseFragmentMap) Clear()
func (SparseFragmentMap) Delete ¶
func (m SparseFragmentMap) Delete(f Fragment)
func (SparseFragmentMap) EmptyClone ¶
func (m SparseFragmentMap) EmptyClone() FragmentMap
func (SparseFragmentMap) ForeachFrag ¶
func (m SparseFragmentMap) ForeachFrag(f func(Fragment, interface{}) error) error
func (SparseFragmentMap) Get ¶
func (m SparseFragmentMap) Get(f Fragment) (interface{}, bool)
func (*SparseFragmentMap) Set ¶
func (m *SparseFragmentMap) Set(f Fragment, v interface{})
type State ¶
type State interface { // All states belong to an API APIObject // Clone returns a deep copy of the state object. Clone(arena.Arena) State // 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, r *path.ResolveConfig) (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) }
State represents the graphics state for a single API.
type StateWatcher ¶
type StateWatcher interface { // OnBeginCmd is called at the beginning of each API call OnBeginCmd(ctx context.Context, cmdID CmdID, cmd Cmd) // OnEndCmd is called at the end of each API call OnEndCmd(ctx context.Context, cmdID CmdID, cmd Cmd) OnBeginSubCmd(ctx context.Context, subCmdIdx SubCmdIdx, recordIdx RecordIdx) OnEndSubCmd(ctx context.Context) // OnGet is called when a fragment of state (field, map key, array index) is read OnReadFrag(ctx context.Context, owner RefObject, f Fragment, v RefObject, track bool) // OnSet is called when a fragment of state (field, map key, array index) is written OnWriteFrag(ctx context.Context, owner RefObject, f Fragment, old RefObject, new RefObject, tracke bool) // OnWriteSlice is called when writing to a slice OnWriteSlice(ctx context.Context, s memory.Slice) // OnReadSlice is called when reading from a slice OnReadSlice(ctx context.Context, s memory.Slice) // OnWriteObs is called when a memory write observations become visible OnWriteObs(ctx context.Context, obs []CmdObservation) // OnReadObs is called when a memory read observations become visible OnReadObs(ctx context.Context, obs []CmdObservation) // OpenForwardDependency is called to begin a forward dependency. // When `CloseForwardDependency` is called later with the same `dependencyID`, // a dependency is added from the current command node during the // `OpenForwardDependency` to the current command node during the // `CloseForwardDependency` call. // Each `OpenForwardDependency` call should have at most one matching // `CloseForwardDependency` call; additional `CloseForwardDependency` // calls with the same `dependencyID` will **not** result in additional // forward dependencies. OpenForwardDependency(ctx context.Context, dependencyID interface{}) // CloseForwardDependency is called to end a forward dependency. // See `OpenForwardDependency` for an explanation of forward dependencies. CloseForwardDependency(ctx context.Context, dependencyID interface{}) // DropForwardDependency is called to abandon a previously opened // forward dependency, without actually adding the forward dependency. // See `OpenForwardDependency` for an explanation of forward dependencies. DropForwardDependency(ctx context.Context, dependencyID interface{}) OnRecordSubCmd(ctx context.Context, recordIdx RecordIdx) }
StateWatcher provides callbacks to track state effects
type SubCmdIdx ¶
type SubCmdIdx []uint64
SubCmdIdx is a qualified path from a particular index to a given subcommand.
func (SubCmdIdx) Contains ¶
Contains returns true if s is one of the parent nodes of s2 or equals to s2.
func (*SubCmdIdx) Decrement ¶
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() == {}
type SubCmdIdxTrie ¶
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 ¶
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 ¶
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 ¶
func (t *SubCmdIdxTrie) SetValue(indices SubCmdIdx, v interface{})
SetValue sets a value to the trie with the given SubCmdIdx as index.
func (*SubCmdIdxTrie) Value ¶
func (t *SubCmdIdxTrie) Value(indices SubCmdIdx) interface{}
Value returns the value stored in the trie indexed by the given SubCmdIdx. if no value is found by the given SubCmdIdx, returns nil.
func (*SubCmdIdxTrie) Values ¶
func (t *SubCmdIdxTrie) Values(indices SubCmdIdx) []interface{}
Values returns the values stored in the trie indexed by all prefixes of the SubCmdIdx, in increasing order of length; if no value is found for a prefix, the result contains `nil` for that prefix.
type SubCmdRoot ¶
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 (*SubCmdRoot) AddSubCmdMarkerGroups ¶
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 ¶
func (c *SubCmdRoot) Bounds() CmdIDRange
func (SubCmdRoot) Index ¶
func (c SubCmdRoot) Index(index uint64) SpanItem
func (*SubCmdRoot) Insert ¶
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 ¶
TraverseCallback is the function that's called for each traversed item in a group.
Source Files ¶
- api.go
- cmd.go
- cmd_convert.go
- cmd_errors.go
- cmd_extras.go
- cmd_flags.go
- cmd_foreach.go
- cmd_id.go
- cmd_id_group.go
- cmd_id_range.go
- cmd_id_set.go
- cmd_observations.go
- cmd_service.go
- context.go
- data_group.go
- doc.go
- graph_visualization.go
- labeled.go
- memory_breakdown.go
- mesh.go
- property.go
- reference.go
- resource.go
- service.go
- state.go
- subcmd_idx.go
- subcmd_idx_trie.go
- texture.go
- watcher.go
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. |
gvr_pb
Package gvr_pb describes the serialization format for the gvr api.
|
Package gvr_pb describes the serialization format for the gvr api. |
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 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. |