aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-05-09 15:45:23 -0700
committerJesse Hall <jessehall@google.com>2012-05-10 10:06:56 -0700
commitab800d7b0188e840407a61fa931f678d2ef46de6 (patch)
tree7fd509cfa7f2e005f9b162f9200677c14fbd0fff /emulator/opengl/host/libs/libOpenglRender/render_api.cpp
parent347fec44f5ebd8e037a47f66256eb739ade9aa6c (diff)
downloadsdk-ab800d7b0188e840407a61fa931f678d2ef46de6.zip
sdk-ab800d7b0188e840407a61fa931f678d2ef46de6.tar.gz
sdk-ab800d7b0188e840407a61fa931f678d2ef46de6.tar.bz2
Allow frame callback to be enabled/disabled
Since per-frame readback is slow and clients don't need it on all the time, this change allows the callback to be registered after initialization, and allows it to be disabled later. Change-Id: Ic73d4515d302a0981ee0c80b9e6f9ba5c84b82ae
Diffstat (limited to 'emulator/opengl/host/libs/libOpenglRender/render_api.cpp')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/render_api.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
index 7d7a981..72cd9ba 100644
--- a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
@@ -76,8 +76,7 @@ int initLibrary(void)
return true;
}
-int initOpenGLRenderer(int width, int height, int portNum,
- OnPostFn onPost, void* onPostContext)
+int initOpenGLRenderer(int width, int height, int portNum)
{
//
@@ -94,7 +93,7 @@ int initOpenGLRenderer(int width, int height, int portNum,
// initialize the renderer and listen to connections
// on a thread in the current process.
//
- bool inited = FrameBuffer::initialize(width, height, onPost, onPostContext);
+ bool inited = FrameBuffer::initialize(width, height);
if (!inited) {
return false;
}
@@ -191,6 +190,27 @@ int initOpenGLRenderer(int width, int height, int portNum,
return true;
}
+void setPostCallback(OnPostFn onPost, void* onPostContext)
+{
+#ifdef RENDER_API_USE_THREAD // should be defined for mac
+ FrameBuffer* fb = FrameBuffer::getFB();
+ if (fb) {
+ fb->setPostCallback(onPost, onPostContext);
+ }
+#else
+ if (onPost) {
+ // onPost callback not supported with separate renderer process.
+ //
+ // If we ever revive separate process support, we could make the choice
+ // between thread and process at runtime instead of compile time, and
+ // choose the thread path if an onPost callback is requested. Or, the
+ // callback could be supported with a separate process using shmem or
+ // other IPC mechanism.
+ return false;
+ }
+#endif
+}
+
void getHardwareStrings(const char** vendor, const char** renderer, const char** version)
{
FrameBuffer* fb = FrameBuffer::getFB();