aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cottrell <iancottrell@google.com>2015-06-26 16:12:20 +0100
committerIan Cottrell <iancottrell@google.com>2015-06-29 13:28:15 +0100
commit507f7b1e477bf280f45b2fafa29a8f2ae8618970 (patch)
tree1b3d54fc64bb8395f43d16ecfaa483f5272b023b
parentbafe1fa8d26758a86e2055836807bb71ef9327f0 (diff)
downloadgpu-507f7b1e477bf280f45b2fafa29a8f2ae8618970.tar.gz
Use the individual gfxapi namespaces to build a common one, then use that to satisfy the GetSchema rpc call.
This reduces the schema to just the ones needed, and avoids exposing internal details. Change-Id: Idee86cb3709408f6c4cd4c3b198ed99cf3f11dd7
-rw-r--r--gfxapi/all/README.md4
-rw-r--r--gfxapi/all/all.go11
-rw-r--r--server/gapis/main.go3
-rw-r--r--server/rpc_server.go3
4 files changed, 16 insertions, 5 deletions
diff --git a/gfxapi/all/README.md b/gfxapi/all/README.md
index 5d79679ab..c2bac4591 100644
--- a/gfxapi/all/README.md
+++ b/gfxapi/all/README.md
@@ -5,3 +5,7 @@
Package all is used to import all known gfxapi APIs for their side effects.
## Usage
+
+```go
+var GraphicsNamespace = registry.NewNamespace()
+```
diff --git a/gfxapi/all/all.go b/gfxapi/all/all.go
index c42430349..b90238751 100644
--- a/gfxapi/all/all.go
+++ b/gfxapi/all/all.go
@@ -15,4 +15,13 @@
// Package all is used to import all known gfxapi APIs for their side effects.
package all
-import _ "android.googlesource.com/platform/tools/gpu/gfxapi/gles"
+import (
+ "android.googlesource.com/platform/tools/gpu/binary/registry"
+ "android.googlesource.com/platform/tools/gpu/gfxapi/gles"
+)
+
+var GraphicsNamespace = registry.NewNamespace()
+
+func init() {
+ GraphicsNamespace.AddFallbacks(gles.Namespace)
+}
diff --git a/server/gapis/main.go b/server/gapis/main.go
index 6685eb905..695984687 100644
--- a/server/gapis/main.go
+++ b/server/gapis/main.go
@@ -24,9 +24,6 @@ import (
"android.googlesource.com/platform/tools/gpu/server"
)
-// Register known graphics APIs.
-import _ "android.googlesource.com/platform/tools/gpu/gfxapi/all"
-
var (
http = flag.String("http", "localhost:8080", "TCP host:port of the server's HTTP listener")
rpc = flag.String("rpc", "localhost:6700", "TCP host:port of the server's RPC listener")
diff --git a/server/rpc_server.go b/server/rpc_server.go
index febcdef66..3f347efe3 100644
--- a/server/rpc_server.go
+++ b/server/rpc_server.go
@@ -26,6 +26,7 @@ import (
"android.googlesource.com/platform/tools/gpu/binary/vle"
"android.googlesource.com/platform/tools/gpu/builder"
"android.googlesource.com/platform/tools/gpu/database"
+ "android.googlesource.com/platform/tools/gpu/gfxapi/all"
"android.googlesource.com/platform/tools/gpu/log"
"android.googlesource.com/platform/tools/gpu/memory"
"android.googlesource.com/platform/tools/gpu/replay"
@@ -59,7 +60,7 @@ func (s rpcServer) ListenAndServe(addr string, mtu int, logger log.Logger) error
// This includes all the types included in or referenced from the atom stream.
func (s rpcServer) GetSchema(l log.Logger) (service.ClassPtrArray, error) {
classes := make(service.ClassPtrArray, 0, registry.Global.Count())
- registry.Global.Visit(func(c binary.Class) {
+ all.GraphicsNamespace.Visit(func(c binary.Class) {
class := schema.Lookup(c.ID())
if class != nil {
classes = append(classes, class)