aboutsummaryrefslogtreecommitdiff
path: root/gfxapi/README.md
blob: 7bd2ad5a32bd0f895859ec2e08cd69bc9fa0bca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# gfxapi
--
    import "android.googlesource.com/platform/tools/gpu/gfxapi"

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

## Usage

#### func  Register

```go
func Register(api API)
```
Register adds an api to the understood set. It is illegal to register the same
name twice.

#### type API

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

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

	// GetFramebufferAttachmentSize returns the width and height of the framebuffer at the given attachment.
	GetFramebufferAttachmentSize(state *State, attachment FramebufferAttachment) (width uint32, height uint32, err error)
}
```

API is the common interface to a graphics programming api.

#### func  Find

```go
func Find(id ID) API
```
Find looks up a graphics API by identifier. If the id has not been registered,
it returns nil.

#### type FramebufferAttachment

```go
type FramebufferAttachment uint32
```

FramebufferAttachment values indicate the type of frame buffer attachment.

```go
const (
	FramebufferAttachmentColor FramebufferAttachment = iota
	FramebufferAttachmentDepth
	FramebufferAttachmentStencil
)
```

#### func (*FramebufferAttachment) Parse

```go
func (v *FramebufferAttachment) Parse(s string) error
```

#### func (FramebufferAttachment) String

```go
func (v FramebufferAttachment) String() string
```

#### type ID

```go
type ID binary.ID
```

ID is an API identifier

#### func (ID) Valid

```go
func (i ID) Valid() bool
```
Valid returns true if the id is not the default zero value.

#### type State

```go
type State struct {
	binary.Object

	// Architecture holds information about the device architecture that was used
	// to create the capture.
	Architecture device.Architecture

	// Memory holds the memory state of the application.
	Memory map[memory.PoolID]*memory.Pool

	// NextPoolID hold the identifier of the next Pool to be created.
	NextPoolID memory.PoolID

	// APIs holds the per-API context states.
	APIs map[API]interface{}
}
```

State represents the graphics state across all contexts.

#### func  NewState

```go
func NewState() *State
```

#### func (State) MemoryDecoder

```go
func (st State) MemoryDecoder(s memory.Slice, d database.Database, l log.Logger) binary.Decoder
```
MemoryDecoder returns a flat decoder backed by an endian reader that uses the
byte-order of the capture device to decode from the slice s.

#### func (State) MemoryEncoder

```go
func (st State) MemoryEncoder(p *memory.Pool, rng memory.Range) binary.Encoder
```
MemoryEncoder returns a flat encoder backed by an endian reader that uses the
byte-order of the capture device to encode to the pool p, for the range rng.

#### func (State) String

```go
func (s State) String() string
```