opengles emulator: support display rotation and resize

Changes the render_api to support re-creating the display
sub-window and the ability to rotate the displayed framebuffer
image.
That currently works only when the renderer runs as a thread
and not as seperate process. Therefore we setup the library
to run the renderer as thread(s) inside the calling process
on *all* platforms for now.

Change-Id: Ifd009db903759042a7edcf89866d3c3fe076cae9
This commit is contained in:
Guy Zadickario
2011-08-11 07:54:15 +03:00
parent 9dcac079ce
commit 617416e693
6 changed files with 356 additions and 67 deletions

View File

@@ -43,9 +43,11 @@ struct FrameBufferCaps
class FrameBuffer
{
public:
static bool initialize(FBNativeWindowType p_window,
int x, int y,
int width, int height);
static bool initialize(int width, int height);
static bool setupSubWindow(FBNativeWindowType p_window,
int x, int y,
int width, int height, float zRot);
static bool removeSubWindow();
static void finalize();
static FrameBuffer *getFB() { return s_theFrameBuffer; }
@@ -70,7 +72,8 @@ public:
int x, int y, int width, int height,
GLenum format, GLenum type, void *pixels);
bool post(HandleType p_colorbuffer);
bool post(HandleType p_colorbuffer, bool needLock = true);
bool repost();
EGLDisplay getDisplay() const { return m_eglDisplay; }
EGLContext getContext() const { return m_eglContext; }
@@ -78,10 +81,16 @@ public:
bool bind_locked();
bool unbind_locked();
void setDisplayRotation(float zRot) {
m_zRot = zRot;
repost();
}
private:
FrameBuffer(int p_x, int p_y, int p_width, int p_height);
FrameBuffer(int p_width, int p_height);
~FrameBuffer();
HandleType genHandle();
bool bindSubwin_locked();
private:
static FrameBuffer *s_theFrameBuffer;
@@ -100,12 +109,16 @@ private:
EGLSurface m_eglSurface;
EGLContext m_eglContext;
EGLSurface m_pbufSurface;
EGLContext m_prevContext;
EGLSurface m_prevReadSurf;
EGLSurface m_prevDrawSurf;
EGLNativeWindowType m_subWin;
EGLNativeDisplayType m_subWinDisplay;
EGLConfig m_eglConfig;
HandleType m_lastPostedColorBuffer;
float m_zRot;
int m_statsNumFrames;
long long m_statsStartTime;