aboutsummaryrefslogtreecommitdiff
path: root/replay/replayer.go
diff options
context:
space:
mode:
authorBen Clayton <bclayton@google.com>2015-03-19 15:36:52 +0000
committerBen Clayton <bclayton@google.com>2015-03-20 14:33:23 +0000
commitc49f04b45593a06076e85220b757df9739cd7b96 (patch)
tree6d84cfb2fb6fe5736366b1cf3092e74f2efd0d90 /replay/replayer.go
parent21068931cf661bbf18436ac982e75d1d9da00de7 (diff)
downloadgpu-c49f04b45593a06076e85220b757df9739cd7b96.tar.gz
Allow an API per context.
State a struct containing global state (for all contexts) and per-context state. State mutation is no longer performed by a dedicated state mutator object, but by each atom. The same is now true for replay. The RPC api has been simplified due to these structural changes. Java still need to be updated. All of this will allow things like EGL to be separated from the GLES contexts. Change-Id: Ie7555731afff3618dba60fa6685dd9d1adb55900
Diffstat (limited to 'replay/replayer.go')
-rw-r--r--replay/replayer.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/replay/replayer.go b/replay/replayer.go
new file mode 100644
index 000000000..030d93290
--- /dev/null
+++ b/replay/replayer.go
@@ -0,0 +1,37 @@
+package replay
+
+import (
+ "fmt"
+
+ "android.googlesource.com/platform/tools/gpu/atom"
+ "android.googlesource.com/platform/tools/gpu/gfxapi/state"
+ "android.googlesource.com/platform/tools/gpu/replay/builder"
+)
+
+// Replayer is the interface that wraps the basic Replay method.
+type Replayer interface {
+ // Replay issues replay operations to the replay builder b for the given atom
+ // with identifier id, and graphics API state s. If the replay action will
+ // have an effect on the graphics driver state, then the call to Replay should
+ // also apply the corresponding changes to the state s. If postback is true
+ // then the replay instructions should include postback of all outputs of the
+ // action.
+ Replay(id atom.ID, s *state.State, b *builder.Builder, postback bool)
+}
+
+// Replay issues replay operations to the replay builder b for the given atom a
+// with identifier id, and graphics API state s. If replaying the Atom will have
+// an effect on the graphics driver state, then the call to Replay will also
+// apply the corresponding changes to the state s. If postback is true then
+// the replay instructions should include postback of all outputs of the Atom.
+func Replay(id atom.ID, a atom.Atom, s *state.State, b *builder.Builder, postback bool) {
+ switch a := a.(type) {
+ case *atom.EOS:
+ case *atom.Observation:
+ b.Observation(a.Range, a.ResourceID)
+ case Replayer:
+ a.Replay(id, s, b, postback)
+ default:
+ panic(fmt.Errorf("Atom %d of type %T does not conform to the Replayer interface", id, a))
+ }
+}