From a6882bf79d6b0f3d122215c0819b0cce0ecfd195 Mon Sep 17 00:00:00 2001 From: Stas Gurtovoy Date: Sun, 8 May 2011 10:45:58 +0300 Subject: [PATCH] emulator opengl: Added glFinishRoundTrip implementation. This is to allow glFinish to wait for the host render to finish. Change-Id: I43e23aee19700b79bc70c89e791df180c6c1fb91 --- tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp | 8 ++++++++ tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h | 2 ++ tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp | 7 +++++++ tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h | 2 ++ tools/emulator/opengl/system/GLESv1_enc/gl.attrib | 3 +++ tools/emulator/opengl/system/GLESv1_enc/gl.in | 2 +- 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp b/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp index 1bd5de3a7..facb3dbdf 100644 --- a/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp +++ b/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp @@ -74,10 +74,18 @@ int GLDecoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData) set_glDrawElementsOffset(s_glDrawElementsOffset); set_glDrawElementsData(s_glDrawElementsData); + set_glFinishRoundTrip(s_glFinishRoundTrip); return 0; } +int GLDecoder::s_glFinishRoundTrip(void *self) +{ + GLDecoder *ctx = (GLDecoder *)self; + ctx->glFinish(); + return 0; +} + void GLDecoder::s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; diff --git a/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h b/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h index 5ef946dad..7df3d1926 100644 --- a/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h +++ b/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h @@ -59,6 +59,8 @@ private: static void s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen); static void s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset); + static int s_glFinishRoundTrip(void *self); + static void * s_getProc(const char *name, void *userData); GLDecoderContextData *m_contextData; diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp index 6ca73f0f0..63fa1b396 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp +++ b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp @@ -467,6 +467,7 @@ GLEncoder::GLEncoder(IOStream *stream) : gl_encoder_context_t(stream) m_glDrawArrays_enc = set_glDrawArrays(s_glDrawArrays); m_glDrawElements_enc = set_glDrawElements(s_glDrawElements); set_glGetString(s_glGetString); + set_glFinish(s_glFinish); } @@ -480,3 +481,9 @@ size_t GLEncoder::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GL assert(m_state != NULL); return m_state->pixelDataSize(width, height, format, type, pack); } + +void GLEncoder::s_glFinish(void *self) +{ + GLEncoder *ctx = (GLEncoder *)self; + ctx->glFinishRoundTrip(self); +} diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h index d2a156a7e..cdf365776 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h +++ b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h @@ -87,6 +87,8 @@ private: static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count); static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices); static void s_glPixelStorei(void *self, GLenum param, GLint value); + + static void s_glFinish(void *self); void sendVertexData(unsigned first, unsigned count); }; #endif diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl.attrib b/tools/emulator/opengl/system/GLESv1_enc/gl.attrib index 13da28b94..5b54ef1b2 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/gl.attrib +++ b/tools/emulator/opengl/system/GLESv1_enc/gl.attrib @@ -349,6 +349,9 @@ glGetCompressedTextureFormats flag custom_decoder flag not_api +glFinishRoundTrip + flag custom_decoder + flag not_api #gles1 extensions diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl.in b/tools/emulator/opengl/system/GLESv1_enc/gl.in index 84cf3c519..434060893 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/gl.in +++ b/tools/emulator/opengl/system/GLESv1_enc/gl.in @@ -163,7 +163,7 @@ GL_ENTRY(void, glDrawElementsOffset, GLenum mode, GLsizei count, GLenum type, GL GL_ENTRY(void, glDrawElementsData, GLenum mode, GLsizei count, GLenum type, void *data, GLuint datalen) GL_ENTRY(void, glGetCompressedTextureFormats, int count, GLint *formats); - +GL_ENTRY(int, glFinishRoundTrip, void) #opengl extensions