emulator opengl : unit-test renderer GLESv2

Make the unit test renderer (ut_renderer) encode GLESv2 commands.
A rendering thread has both V1 & V2 decoder object, and tryies to decode
commands of the two protocols from the stream.
Context creating is taking into account the API version and creates context
accordingly.
Decoder data is shared between the V1 & V2 decoders and applied to both of
them on makeCurrent (regardless to the requested context version)

Change-Id: If78e84310e5dcd22108c19656051b138b22e3c9f
This commit is contained in:
Jacky Romano
2011-04-25 12:59:37 +03:00
committed by David 'Digit' Turner
parent 25af30c464
commit 0c01f32aa2
4 changed files with 25 additions and 4 deletions

View File

@@ -22,7 +22,8 @@ LOCAL_MODULE_TAGS := debug
# is generated
LOCAL_ADDITIONAL_DEPENDENCIES := \
$(HOST_OUT_SHARED_LIBRARIES)/libut_rendercontrol_dec$(HOST_SHLIB_SUFFIX) \
$(HOST_OUT_SHARED_LIBRARIES)/libGLESv1_dec$(HOST_SHLIB_SUFFIX)
$(HOST_OUT_SHARED_LIBRARIES)/libGLESv1_dec$(HOST_SHLIB_SUFFIX) \
$(HOST_OUT_SHARED_LIBRARIES)/libGLESv2_dec$(HOST_SHLIB_SUFFIX)
LOCAL_SRC_FILES := ut_renderer.cpp \
RenderingThread.cpp \
@@ -43,14 +44,18 @@ LOCAL_CFLAGS := -DPVR_WAR
#LOCAL_CFLAGS += -g -O0
LOCAL_C_INCLUDES := $(emulatorOpengl)/shared/OpenglCodecCommon \
$(emulatorOpengl)/shared \
$(emulatorOpengl)/host/include/libOpenglRender \
$(call intermediates-dir-for, SHARED_LIBRARIES, libut_rendercontrol_dec, HOST) \
$(call intermediates-dir-for, SHARED_LIBRARIES, libGLESv1_dec, HOST) \
$(call intermediates-dir-for, SHARED_LIBRARIES, libGLESv2_dec, HOST) \
$(emulatorOpengl)/host/libs/GLESv1_dec \
$(emulatorOpengl)/host/libs/GLESv2_dec \
$(emulatorOpengl)/system/GLESv1_enc \
$(emulatorOpengl)/system/GLESv2_enc \
$(emulatorOpengl)/tests/ut_rendercontrol_enc
LOCAL_SHARED_LIBRARIES := libut_rendercontrol_dec libGLESv1_dec libEGL_host_wrapper
LOCAL_SHARED_LIBRARIES := libut_rendercontrol_dec libGLESv1_dec libGLESv2_dec libEGL_host_wrapper
LOCAL_STATIC_LIBRARIES := \
libOpenglCodecCommon \
libcutils

View File

@@ -147,6 +147,7 @@ int Renderer::makeCurrent(RenderingThread *thread,
eglContext = c->second->eglContext();
thread->setCurrentContext(c->second);
thread->glDecoder().setContextData(&c->second->decoderContextData());
thread->gl2Decoder().setContextData(&c->second->decoderContextData());
} else {
// same context is already set
eglContext = c->second->eglContext();
@@ -156,6 +157,7 @@ int Renderer::makeCurrent(RenderingThread *thread,
if (currentContext != NULL) currentContext->unref();
thread->setCurrentContext(NULL);
thread->glDecoder().setContextData(NULL);
thread->gl2Decoder().setContextData(NULL);
}
EGLSurface draw = EGL_NO_SURFACE;

View File

@@ -312,6 +312,8 @@ void *RenderingThread::thread()
m_glDisableClientState = m_glDec.set_glDisableClientState(s_glDisableClientState);
#endif
m_gl2Dec.initGL();
m_utDec.set_swapBuffers(s_swapBuffers);
m_utDec.set_createContext(s_createContext);
m_utDec.set_destroyContext(s_destroyContext);
@@ -359,6 +361,14 @@ void *RenderingThread::thread()
}
}
if (readBuf.validData() >= 8) {
size_t last = m_gl2Dec.decode(readBuf.buf(), readBuf.validData(), m_stream);
if (last > 0) {
readBuf.consume(last);
progress = true;
}
}
if (readBuf.validData() >= 8) {
size_t last = m_utDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
if (last > 0) {

View File

@@ -18,6 +18,7 @@
#include "TcpStream.h"
#include "GLDecoder.h"
#include "GL2Decoder.h"
#include "ut_rendercontrol_dec.h"
#include <pthread.h>
@@ -43,12 +44,15 @@ public:
RendererContext *currentContext() { return m_currentContext; }
void setCurrentContext(RendererContext *ctx) { m_currentContext = ctx; }
GLDecoder & glDecoder() { return m_glDec; }
GL2Decoder & gl2Decoder() { return m_gl2Dec; }
private:
void initBackendCaps();
private:
GLDecoder m_glDec;
ut_rendercontrol_decoder_context_t m_utDec;
GL2Decoder m_gl2Dec;
TcpStream *m_stream;
pthread_t m_thread;