Merge "Revert "EmuGL: Deliver every frame to a callback""
This commit is contained in:
@@ -101,7 +101,7 @@ void FrameBuffer::finalize(){
|
||||
}
|
||||
}
|
||||
|
||||
bool FrameBuffer::initialize(int width, int height, OnPostFn onPost, void* onPostContext)
|
||||
bool FrameBuffer::initialize(int width, int height)
|
||||
{
|
||||
if (s_theFrameBuffer != NULL) {
|
||||
return true;
|
||||
@@ -110,7 +110,7 @@ bool FrameBuffer::initialize(int width, int height, OnPostFn onPost, void* onPos
|
||||
//
|
||||
// allocate space for the FrameBuffer object
|
||||
//
|
||||
FrameBuffer *fb = new FrameBuffer(width, height, onPost, onPostContext);
|
||||
FrameBuffer *fb = new FrameBuffer(width, height);
|
||||
if (!fb) {
|
||||
ERR("Failed to create fb\n");
|
||||
return false;
|
||||
@@ -334,17 +334,6 @@ bool FrameBuffer::initialize(int width, int height, OnPostFn onPost, void* onPos
|
||||
//
|
||||
fb->initGLState();
|
||||
|
||||
//
|
||||
// Allocate space for the onPost framebuffer image
|
||||
//
|
||||
if (onPost) {
|
||||
fb->m_fbImage = (unsigned char*)malloc(4 * width * height);
|
||||
if (!fb->m_fbImage) {
|
||||
delete fb;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// release the FB context
|
||||
fb->unbind_locked();
|
||||
|
||||
@@ -355,8 +344,7 @@ bool FrameBuffer::initialize(int width, int height, OnPostFn onPost, void* onPos
|
||||
return true;
|
||||
}
|
||||
|
||||
FrameBuffer::FrameBuffer(int p_width, int p_height,
|
||||
OnPostFn onPost, void* onPostContext) :
|
||||
FrameBuffer::FrameBuffer(int p_width, int p_height) :
|
||||
m_width(p_width),
|
||||
m_height(p_height),
|
||||
m_eglDisplay(EGL_NO_DISPLAY),
|
||||
@@ -372,17 +360,13 @@ FrameBuffer::FrameBuffer(int p_width, int p_height,
|
||||
m_zRot(0.0f),
|
||||
m_eglContextInitialized(false),
|
||||
m_statsNumFrames(0),
|
||||
m_statsStartTime(0LL),
|
||||
m_onPost(onPost),
|
||||
m_onPostContext(onPostContext),
|
||||
m_fbImage(NULL)
|
||||
m_statsStartTime(0LL)
|
||||
{
|
||||
m_fpsStats = getenv("SHOW_FPS_STATS") != NULL;
|
||||
}
|
||||
|
||||
FrameBuffer::~FrameBuffer()
|
||||
{
|
||||
free(m_fbImage);
|
||||
}
|
||||
|
||||
bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window,
|
||||
@@ -815,15 +799,6 @@ bool FrameBuffer::post(HandleType p_colorbuffer, bool needLock)
|
||||
s_gl.glPopMatrix();
|
||||
|
||||
if (ret) {
|
||||
//
|
||||
// Send framebuffer (without FPS overlay) to callback
|
||||
//
|
||||
if (m_onPost) {
|
||||
s_gl.glReadPixels(0, 0, m_width, m_height,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, m_fbImage);
|
||||
m_onPost(m_onPostContext, m_width, m_height, -1,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, m_fbImage);
|
||||
}
|
||||
|
||||
//
|
||||
// output FPS statistics
|
||||
|
||||
@@ -46,7 +46,7 @@ struct FrameBufferCaps
|
||||
class FrameBuffer
|
||||
{
|
||||
public:
|
||||
static bool initialize(int width, int height, OnPostFn onPost, void* onPostContext);
|
||||
static bool initialize(int width, int height);
|
||||
static bool setupSubWindow(FBNativeWindowType p_window,
|
||||
int x, int y,
|
||||
int width, int height, float zRot);
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
FrameBuffer(int p_width, int p_height, OnPostFn onPost, void* onPostContext);
|
||||
FrameBuffer(int p_width, int p_height);
|
||||
~FrameBuffer();
|
||||
HandleType genHandle();
|
||||
bool bindSubwin_locked();
|
||||
@@ -129,9 +129,5 @@ private:
|
||||
int m_statsNumFrames;
|
||||
long long m_statsStartTime;
|
||||
bool m_fpsStats;
|
||||
|
||||
OnPostFn m_onPost;
|
||||
void* m_onPostContext;
|
||||
unsigned char* m_fbImage;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -76,8 +76,7 @@ bool initLibrary(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool initOpenGLRenderer(int width, int height, int portNum,
|
||||
OnPostFn onPost, void* onPostContext)
|
||||
bool initOpenGLRenderer(int width, int height, int portNum)
|
||||
{
|
||||
|
||||
//
|
||||
@@ -94,7 +93,7 @@ bool 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;
|
||||
}
|
||||
@@ -107,17 +106,6 @@ bool initOpenGLRenderer(int width, int height, int portNum,
|
||||
s_renderThread->start();
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
//
|
||||
// Launch emulator_renderer
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user