am dda2e51a: am 6ba16ba7: Merge "emulator: opengl: add initLibrary function to render library"

* commit 'dda2e51a15ddfc44b34ec3c35e68f3bc1cfb5786':
  emulator: opengl: add initLibrary function to render library
This commit is contained in:
David 'Digit' Turner
2011-08-29 18:01:01 -07:00
committed by Android Git Automerger
5 changed files with 45 additions and 20 deletions

View File

@@ -22,6 +22,16 @@ extern "C" {
#include "render_api_platform_types.h"
// initLibrary - initialize the library and tries to load the corresponding
// GLES translator libraries. This function must be called before anything
// else to ensure that everything works. If it returns an error, then
// you cannot use the library at all (this can happen under certain
// environments where the desktop GL libraries are not available)
//
// returns true if the library could be initialized successfully;
//
bool initLibrary(void);
//
// initOpenGLRenderer - initialize the OpenGL renderer process.
// portNum is the tcp port number the renderer is listening to.
@@ -31,7 +41,7 @@ extern "C" {
// returns true if renderer has been started successfully;
//
// This function is *NOT* thread safe and should be called first
// to initialize the renderer.
// to initialize the renderer after initLibrary().
//
bool initOpenGLRenderer(int width, int height, int portNum);

View File

@@ -107,24 +107,6 @@ bool FrameBuffer::initialize(int width, int height)
return true;
}
//
// Load EGL Plugin
//
if (!init_egl_dispatch()) {
// Failed to load EGL
printf("Failed to init_egl_dispatch\n");
return false;
}
//
// Load GLES Plugin
//
if (!init_gl_dispatch()) {
// Failed to load GLES
ERR("Failed to init_gl_dispatch\n");
return false;
}
//
// allocate space for the FrameBuffer object
//
@@ -142,7 +124,7 @@ bool FrameBuffer::initialize(int width, int height)
fb->m_caps.hasGL2 = false;
}
else {
fb->m_caps.hasGL2 = init_gl2_dispatch();
fb->m_caps.hasGL2 = s_gl2_enabled;
}
#else
fb->m_caps.hasGL2 = false;

View File

@@ -20,6 +20,7 @@
#include "osDynLibrary.h"
gl2_decoder_context_t s_gl2;
int s_gl2_enabled;
static osUtils::dynLibrary *s_gles2_lib = NULL;
@@ -50,6 +51,7 @@ bool init_gl2_dispatch()
// init the GLES dispatch table
//
s_gl2.initDispatchByName( gl2_dispatch_get_proc_func, NULL );
s_gl2_enabled = true;
return true;
}

View File

@@ -24,6 +24,7 @@ bool init_gl2_dispatch();
void *gl2_dispatch_get_proc_func(const char *name, void *userData);
extern gl2_decoder_context_t s_gl2;
extern int s_gl2_enabled;
#endif
#endif

View File

@@ -20,6 +20,10 @@
#include "osProcess.h"
#include "TimeUtils.h"
#include "EGLDispatch.h"
#include "GLDispatch.h"
#include "GL2Dispatch.h"
static osUtils::childProcess *s_renderProc = NULL;
static RenderServer *s_renderThread = NULL;
static int s_renderPort = 0;
@@ -39,6 +43,32 @@ static IOStream *createRenderThread(int p_stream_buffer_size,
#define RENDER_API_USE_THREAD
//#endif
bool initLibrary(void)
{
//
// Load EGL Plugin
//
if (!init_egl_dispatch()) {
// Failed to load EGL
printf("Failed to init_egl_dispatch\n");
return false;
}
//
// Load GLES Plugin
//
if (!init_gl_dispatch()) {
// Failed to load GLES
ERR("Failed to init_gl_dispatch\n");
return false;
}
/* failure to init the GLES2 dispatch table is not fatal */
init_gl2_dispatch();
return true;
}
bool initOpenGLRenderer(int width, int height, int portNum)
{