diff options
| author | Jesse Hall <jessehall@google.com> | 2012-04-18 15:02:09 -0700 |
|---|---|---|
| committer | Jesse Hall <jessehall@google.com> | 2012-04-18 15:24:17 -0700 |
| commit | 7a712acc02282985dcd32feb81284e1f2b19ec7e (patch) | |
| tree | aedf935e93ec0fa0069fe004111f1394bbc61030 /emulator/opengl/host/libs | |
| parent | 7dbe1f1d1ff1e956e11c5db01ae164360ee2280a (diff) | |
| download | sdk-7a712acc02282985dcd32feb81284e1f2b19ec7e.zip sdk-7a712acc02282985dcd32feb81284e1f2b19ec7e.tar.gz sdk-7a712acc02282985dcd32feb81284e1f2b19ec7e.tar.bz2 | |
Publish and use libOpenglRender interface header
The emulator opengles.c file duplicated the function declarations from
libOpenglRenderer's render_api.h instead of including it directly.
This led to multiple bugs since the declarations didn't actually
match, but there was no way for the compiler or dynamic loader to
check this.
This change makes opengles.c include render_api.h to get function
pointer prototypes, and changes the prototypes/implementation as
necessary to make both sides actually match. It should be much more
difficult to introduce interface mismatch bugs now.
Two bugs this change would have prevented:
(a) The interface mismatch caused by inconsistent branching which led
to GPU acceleration crashing on Windows. With this change, we
would have caught the problem at compile time.
(b) The emulator verbose log has always been printing "Can't start
OpenGLES renderer?" even when the renderer started fine. This is
because the renderer was returning a bool (true == success) but
the emulator's declaration said it returned int, and the emulator
assumed 0 meant success. This difference in return type should now
be caught at compile time.
Change-Id: Iab3b6960e221edd135b515a166cf991b62bb60c9
Diffstat (limited to 'emulator/opengl/host/libs')
| -rw-r--r-- | emulator/opengl/host/libs/libOpenglRender/render_api.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp index c8d3e06..00dcd75 100644 --- a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp @@ -50,7 +50,7 @@ static IOStream *createRenderThread(int p_stream_buffer_size, #define RENDER_API_USE_THREAD //#endif -bool initLibrary(void) +int initLibrary(void) { // // Load EGL Plugin @@ -76,7 +76,7 @@ bool initLibrary(void) return true; } -bool initOpenGLRenderer(int width, int height, int portNum, +int initOpenGLRenderer(int width, int height, int portNum, OnPostFn onPost, void* onPostContext) { @@ -191,7 +191,7 @@ bool initOpenGLRenderer(int width, int height, int portNum, return true; } -bool stopOpenGLRenderer() +int stopOpenGLRenderer(void) { bool ret = false; @@ -224,7 +224,7 @@ bool stopOpenGLRenderer() return ret; } -bool createOpenGLSubwindow(FBNativeWindowType window, +int createOpenGLSubwindow(FBNativeWindowType window, int x, int y, int width, int height, float zRot) { if (s_renderThread) { @@ -240,7 +240,7 @@ bool createOpenGLSubwindow(FBNativeWindowType window, return false; } -bool destroyOpenGLSubwindow() +int destroyOpenGLSubwindow(void) { if (s_renderThread) { return FrameBuffer::removeSubWindow(); @@ -272,7 +272,7 @@ void setOpenGLDisplayRotation(float zRot) } } -void repaintOpenGLDisplay() +void repaintOpenGLDisplay(void) { if (s_renderThread) { FrameBuffer *fb = FrameBuffer::getFB(); @@ -352,8 +352,8 @@ setStreamMode(int mode) #endif /* _WIN32 */ default: // Invalid stream mode - return -1; + return false; } gRendererStreamMode = mode; - return 0; + return true; } |
