diff --git a/tools/emulator/opengl/host/tools/emugen/ApiGen.cpp b/tools/emulator/opengl/host/tools/emugen/ApiGen.cpp index f019994e3..101628ada 100644 --- a/tools/emulator/opengl/host/tools/emugen/ApiGen.cpp +++ b/tools/emulator/opengl/host/tools/emugen/ApiGen.cpp @@ -155,27 +155,32 @@ int ApiGen::genEntryPoints(const std::string & filename, SideType side) fprintf(fp, "#include \"%s_%s_context.h\"\n", m_basename.c_str(), sideString(side)); fprintf(fp, "\n"); + fprintf(fp, "#ifndef GL_TRUE\n"); fprintf(fp, "extern \"C\" {\n"); for (size_t i = 0; i < size(); i++) { fprintf(fp, "\t"); at(i).print(fp, false); fprintf(fp, ";\n"); } fprintf(fp, "};\n\n"); + fprintf(fp, "#endif\n"); + fprintf(fp, "#ifndef GET_CONTEXT\n"); fprintf(fp, "static %s_%s_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL;\n", m_basename.c_str(), sideString(side)); fprintf(fp, - "void %s_%s_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; }\n\n", + "void %s_%s_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; }\n", m_basename.c_str(), sideString(side)); + fprintf(fp, "#define GET_CONTEXT %s_%s_context_t * ctx = getCurrentContext() \n", + m_basename.c_str(), sideString(side)); + fprintf(fp, "#endif\n\n"); for (size_t i = 0; i < size(); i++) { EntryPoint *e = &at(i); e->print(fp); fprintf(fp, "{\n"); - fprintf(fp, "\t %s_%s_context_t * ctx = getCurrentContext(); \n", - m_basename.c_str(), sideString(side)); + fprintf(fp, "\tGET_CONTEXT; \n"); bool shouldReturn = !e->retval().isVoid(); bool shouldCallWithContext = (side == CLIENT_SIDE); diff --git a/tools/emulator/opengl/host/tools/emugen/EntryPoint.cpp b/tools/emulator/opengl/host/tools/emugen/EntryPoint.cpp index f766dd930..ac3a3c470 100644 --- a/tools/emulator/opengl/host/tools/emugen/EntryPoint.cpp +++ b/tools/emulator/opengl/host/tools/emugen/EntryPoint.cpp @@ -57,9 +57,10 @@ bool parseTypeField(const std::string & f, std::string *vartype, std::string *va case ST_TYPE: if (str == "const") { pos = last; + *vartype = "const "; } else { // must be a type name; - *vartype = str; + *vartype += str; state = ST_NAME; pos = last; } diff --git a/tools/emulator/opengl/host/tools/emugen/TypeFactory.cpp b/tools/emulator/opengl/host/tools/emugen/TypeFactory.cpp index 166b21aa9..88842250a 100644 --- a/tools/emulator/opengl/host/tools/emugen/TypeFactory.cpp +++ b/tools/emulator/opengl/host/tools/emugen/TypeFactory.cpp @@ -134,6 +134,8 @@ int TypeFactory::initFromFile(const std::string &filename) lc, name.c_str(), lc); } g_varMap.insert(std::pair(name, VarType(g_typeId++, name, v ,printString,isPointer))); + std::string constName = "const " + name; + g_varMap.insert(std::pair(constName, VarType(g_typeId++, constName, v ,printString,isPointer))); //add a const type } g_initialized = true; return 0; diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp index a7e2ea008..dcfe9feed 100644 --- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp +++ b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp @@ -70,7 +70,7 @@ void GLClientState::enable(int location, int state) m_states[location].enabled = state; } -void GLClientState::setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, void *data) +void GLClientState::setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, const void *data) { if (!validLocation(location)) { return; @@ -78,7 +78,7 @@ void GLClientState::setState(int location, int size, GLenum type, GLboolean norm m_states[location].size = size; m_states[location].type = type; m_states[location].stride = stride; - m_states[location].data = data; + m_states[location].data = (void*)data; m_states[location].bufferObject = m_currentArrayVbo; m_states[location].elementSize = glSizeof(type) * size; m_states[location].normalized = normalized; diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h index 9e4c9160c..b7fcff565 100644 --- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h +++ b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h @@ -79,7 +79,7 @@ public: GLuint currentArrayVbo() { return m_currentArrayVbo; } GLuint currentIndexVbo() { return m_currentIndexVbo; } void enable(int location, int state); - void setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, void *data); + void setState(int location, int size, GLenum type, GLboolean normalized, GLsizei stride, const void *data); void setBufferObject(int location, GLuint id); const VertexAttribState *getState(int location); const VertexAttribState *getStateAndEnableDirty(int location, bool *enableChanged); diff --git a/tools/emulator/opengl/system/GLESv1/Android.mk b/tools/emulator/opengl/system/GLESv1/Android.mk new file mode 100644 index 000000000..46e618e9f --- /dev/null +++ b/tools/emulator/opengl/system/GLESv1/Android.mk @@ -0,0 +1,46 @@ +LOCAL_PATH := $(call my-dir) +emulatorOpengl := $(LOCAL_PATH)/../.. + +### EGL implementation ########################################### +include $(CLEAR_VARS) + +# add additional depencies to ensure that the generated code that we depend on +# is generated +LOCAL_ADDITIONAL_DEPENDENCIES := \ + $(TARGET_OUT_SHARED_LIBRARIES)/lib_renderControl_enc$(TARGET_SHLIB_SUFFIX) \ + $(TARGET_OUT_SHARED_LIBRARIES)/libGLESv1_enc$(TARGET_SHLIB_SUFFIX) + +LOCAL_SRC_FILES := \ + gl.cpp + + +LOCAL_PRELINK_MODULE := false +LOCAL_CFLAGS += -DLOG_TAG=\"GLES_emulation\" +LOCAL_C_INCLUDES += \ + $(emulatorOpengl)/host/include/libOpenglRender \ + $(emulatorOpengl)/shared/OpenglCodecCommon \ + $(emulatorOpengl)/system/OpenglSystemCommon \ + $(emulatorOpengl)/system/GLESv1_enc \ + $(emulatorOpengl)/system/renderControl_enc \ + $(call intermediates-dir-for, SHARED_LIBRARIES, lib_renderControl_enc) \ + $(call intermediates-dir-for, SHARED_LIBRARIES, libGLESv1_enc) + +LOCAL_MODULE_TAGS := debug +LOCAL_MODULE := libGL_emulation +LOCAL_MODULE_CLASS := SHARED_LIBRARIES + + +LOCAL_STATIC_LIBRARIES := \ + libOpenglSystemCommon \ + libOpenglCodecCommon \ + libqemu + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ + libdl \ + libGLESv1_enc \ + lib_renderControl_enc + + +include $(BUILD_SHARED_LIBRARY) diff --git a/tools/emulator/opengl/system/GLESv1/gl.cpp b/tools/emulator/opengl/system/GLESv1/gl.cpp new file mode 100644 index 000000000..abd0f5424 --- /dev/null +++ b/tools/emulator/opengl/system/GLESv1/gl.cpp @@ -0,0 +1,31 @@ +#include "EGLClientIface.h" +#include "HostConnection.h" +#include "GLEncoder.h" + + +//XXX: fix this macro to get the context from fast tls path +#define GET_CONTEXT gl_client_context_t * ctx = HostConnection::get()->glEncoder(); + +#include "gl_entry.cpp" + +static EGLClient_eglInterface * s_egl = NULL; +static EGLClient_glesInterface * s_gl = NULL; + +void finish() +{ + +} + +EGLClient_glesInterface * init_emul_gles(EGLClient_eglInterface *eglIface) +{ + s_egl = eglIface; + + if (!s_gl) { + s_gl = new EGLClient_glesInterface(); + s_gl->getProcAddress = NULL; //TODO: what goes here? + s_gl->finish = finish; + } + + return s_gl; +} + diff --git a/tools/emulator/opengl/system/GLESv1_enc/Android.mk b/tools/emulator/opengl/system/GLESv1_enc/Android.mk index c8fd18b01..1d28673ab 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/Android.mk +++ b/tools/emulator/opengl/system/GLESv1_enc/Android.mk @@ -19,6 +19,7 @@ LOCAL_PRELINK_MODULE := false LOCAL_CFLAGS += -DLOG_TAG=\"egl_GLESv1_enc\" LOCAL_C_INCLUDES += \ $(emulatorOpengl)/shared/OpenglCodecCommon \ + $(emulatorOpengl)/system/OpenglSystemCommon \ $(emulatorOpengl)/host/include/libOpenglRender \ $(glesv1_intermediates) diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp index 2095af50e..6ca73f0f0 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp +++ b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp @@ -115,7 +115,7 @@ void GLEncoder::s_glFlush(void *self) ctx->m_stream->flush(); } -GLubyte *GLEncoder::s_glGetString(void *self, GLenum name) +const GLubyte *GLEncoder::s_glGetString(void *self, GLenum name) { GLubyte *retval = (GLubyte *) ""; switch(name) { @@ -143,28 +143,28 @@ void GLEncoder::s_glPixelStorei(void *self, GLenum param, GLint value) ctx->m_state->setPixelStore(param, value); } -void GLEncoder::s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, void *data) +void GLEncoder::s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, const void *data) { GLEncoder *ctx = (GLEncoder *)self; assert(ctx->m_state != NULL); ctx->m_state->setState(GLClientState::VERTEX_LOCATION, size, type, false, stride, data); } -void GLEncoder::s_glNormalPointer(void *self, GLenum type, GLsizei stride, void *data) +void GLEncoder::s_glNormalPointer(void *self, GLenum type, GLsizei stride, const void *data) { GLEncoder *ctx = (GLEncoder *)self; assert(ctx->m_state != NULL); ctx->m_state->setState(GLClientState::NORMAL_LOCATION, 3, type, false, stride, data); } -void GLEncoder::s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, void *data) +void GLEncoder::s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, const void *data) { GLEncoder *ctx = (GLEncoder *)self; assert(ctx->m_state != NULL); ctx->m_state->setState(GLClientState::COLOR_LOCATION, size, type, false, stride, data); } -void GLEncoder::s_glPointsizePointer(void *self, GLenum type, GLsizei stride, void *data) +void GLEncoder::s_glPointsizePointer(void *self, GLenum type, GLsizei stride, const void *data) { GLEncoder *ctx = (GLEncoder *)self; assert(ctx->m_state != NULL); @@ -178,7 +178,7 @@ void GLEncoder::s_glClientActiveTexture(void *self, GLenum texture) ctx->m_state->setActiveTexture(texture - GL_TEXTURE0); } -void GLEncoder::s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, void *data) +void GLEncoder::s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, const void *data) { GLEncoder *ctx = (GLEncoder *)self; assert(ctx->m_state != NULL); @@ -186,7 +186,7 @@ void GLEncoder::s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei s ctx->m_state->setState(loc, size, type, false, stride, data); } -void GLEncoder::s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, void * data) +void GLEncoder::s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data) { GLEncoder *ctx = (GLEncoder *)self; assert(ctx->m_state != NULL); @@ -194,7 +194,7 @@ void GLEncoder::s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLs ctx->m_state->setState(loc, size, type, false, stride, data); } -void GLEncoder::s_glWeightPointerOES(void * self, int size, GLenum type, GLsizei stride, void * data) +void GLEncoder::s_glWeightPointerOES(void * self, int size, GLenum type, GLsizei stride, const void * data) { GLEncoder *ctx = (GLEncoder *)self; assert(ctx->m_state != NULL); @@ -362,7 +362,7 @@ void GLEncoder::s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei cou ctx->m_glDrawArrays_enc(ctx, mode, /*first*/ 0, count); } -void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, void *indices) +void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices) { GLEncoder *ctx = (GLEncoder *)self; @@ -395,7 +395,7 @@ void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum LOGE("glDrawElements: indirect index arrays, with immidate-mode data array is not supported\n"); } } else { - void *adjustedIndices = indices; + void *adjustedIndices = (void*)indices; int minIndex = 0, maxIndex = 0; switch(type) { diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h index 3223ae954..d2a156a7e 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h +++ b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h @@ -71,21 +71,21 @@ private: static void s_glGetPointerv(void *self, GLenum pname, GLvoid **params); static void s_glFlush(void * self); - static GLubyte * s_glGetString(void *self, GLenum name); - static void s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, void *data); - static void s_glNormalPointer(void *self, GLenum type, GLsizei stride, void *data); - static void s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, void *data); - static void s_glPointsizePointer(void *self, GLenum type, GLsizei stride, void *data); + static const GLubyte * s_glGetString(void *self, GLenum name); + static void s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, const void *data); + static void s_glNormalPointer(void *self, GLenum type, GLsizei stride, const void *data); + static void s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, const void *data); + static void s_glPointsizePointer(void *self, GLenum type, GLsizei stride, const void *data); static void s_glClientActiveTexture(void *self, GLenum texture); - static void s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, void *data); - static void s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, void * data); - static void s_glWeightPointerOES(void *self, int size, GLenum type, GLsizei stride, void * data); + static void s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, const void *data); + static void s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data); + static void s_glWeightPointerOES(void *self, int size, GLenum type, GLsizei stride, const void * data); static void s_glDisableClientState(void *self, GLenum state); static void s_glEnableClientState(void *self, GLenum state); static GLboolean s_glIsEnabled(void *self, GLenum cap); static void s_glBindBuffer(void *self, GLenum target, GLuint id); static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count); - static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, void *indices); + 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); void sendVertexData(unsigned first, unsigned count); }; diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl.attrib b/tools/emulator/opengl/system/GLESv1_enc/gl.attrib index 374009cd6..f23c2a545 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/gl.attrib +++ b/tools/emulator/opengl/system/GLESv1_enc/gl.attrib @@ -295,15 +295,17 @@ glTexCoordPointerData #void glWeightPointerData(GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen) glWeightPointerData - len data datalen - custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen) - flag custom_decoder + len data datalen + custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen) + flag custom_decoder + flag not_api #void glMatrixIndexPointerData(GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen) glMatrixIndexPointerData - len data datalen - custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen) - flag custom_decoder + len data datalen + custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen) + flag custom_decoder + flag not_api glVertexPointerOffset flag custom_decoder @@ -513,32 +515,26 @@ glGetClipPlanefOES #void glTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params) glTexGenfvOES - dir params out len params (glUtilsParamSize(pname) * sizeof(GLfloat)) #void glTexGenivOES(GLenum coord, GLenum pname, GLint *params) glTexGenivOES - dir params out len params (glUtilsParamSize(pname) * sizeof(GLint)) #void glTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) glTexGenxvOES - dir params out len params (glUtilsParamSize(pname) * sizeof(GLfixed)) #void glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params) glGetTexGenfvOES - dir params out len params (glUtilsParamSize(pname) * sizeof(GLfloat)) #void glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params) glGetTexGenivOES - dir params out len params (glUtilsParamSize(pname) * sizeof(GLint)) #void glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) glGetTexGenxvOES - dir params out len params (glUtilsParamSize(pname) * sizeof(GLfixed)) #void glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays) diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl.in b/tools/emulator/opengl/system/GLESv1_enc/gl.in index 0b0e2d289..c317c8653 100644 --- a/tools/emulator/opengl/system/GLESv1_enc/gl.in +++ b/tools/emulator/opengl/system/GLESv1_enc/gl.in @@ -68,7 +68,7 @@ GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count) GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) GL_ENTRY(void, glEnable, GLenum cap) GL_ENTRY(void, glEnableClientState, GLenum array) -GL_ENTRY(GLint, glFinish, void) +GL_ENTRY(void, glFinish, void) GL_ENTRY(void, glFlush, void) GL_ENTRY(void, glFogx, GLenum pname, GLfixed param) GL_ENTRY(void, glFogxv, GLenum pname, const GLfixed *params) diff --git a/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp b/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp index 8c982ce2f..b0a2e722c 100644 --- a/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp +++ b/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.cpp @@ -40,7 +40,7 @@ void GL2Encoder::s_glFlush(void *self) ctx->m_stream->flush(); } -GLubyte *GL2Encoder::s_glGetString(void *self, GLenum name) +const GLubyte *GL2Encoder::s_glGetString(void *self, GLenum name) { GLubyte *retval = (GLubyte *) ""; switch(name) { @@ -78,7 +78,7 @@ void GL2Encoder::s_glBindBuffer(void *self, GLenum target, GLuint id) ctx->m_glBindBuffer_enc(self, target, id); } -void GL2Encoder::s_glVertexAtrribPointer(void *self, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLvoid * ptr) +void GL2Encoder::s_glVertexAtrribPointer(void *self, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * ptr) { GL2Encoder *ctx = (GL2Encoder *)self; assert(ctx->m_state != NULL); @@ -232,7 +232,7 @@ void GL2Encoder::s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei co } -void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, void *indices) +void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices) { GL2Encoder *ctx = (GL2Encoder *)self; @@ -266,7 +266,7 @@ void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum LOGE("glDrawElements: indirect index arrays, with immidate-mode data array is not supported\n"); } } else { - void *adjustedIndices = indices; + void *adjustedIndices = (void*)indices; int minIndex = 0, maxIndex = 0; switch(type) { @@ -324,12 +324,12 @@ GLint * GL2Encoder::getCompressedTextureFormats() return m_compressedTextureFormats; } -void GL2Encoder::s_glShaderSource(void *self, GLuint shader, GLsizei count, GLstr *string, GLint *length) +void GL2Encoder::s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLstr *string, const GLint *length) { - int len = glUtilsCalcShaderSourceLen(string, length, count); + int len = glUtilsCalcShaderSourceLen((char**)string, (GLint*)length, count); char *str = new char[len + 1]; - glUtilsPackStrings(str, string, length, count); + glUtilsPackStrings(str, (char**)string, (GLint*)length, count); GL2Encoder *ctx = (GL2Encoder *)self; ctx->glShaderString(ctx, shader, str, len + 1); diff --git a/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.h b/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.h index f628aca90..47a9ab314 100644 --- a/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.h +++ b/tools/emulator/opengl/system/GLESv2_enc/GL2Encoder.h @@ -51,7 +51,7 @@ private: static void s_glPixelStorei(void *self, GLenum param, GLint value); glGetString_client_proc_t m_glGetString_enc; - static GLubyte * s_glGetString(void *self, GLenum name); + static const GLubyte * s_glGetString(void *self, GLenum name); glBindBuffer_client_proc_t m_glBindBuffer_enc; static void s_glBindBuffer(void *self, GLenum target, GLuint id); @@ -60,7 +60,7 @@ private: static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count); glDrawElements_client_proc_t m_glDrawElements_enc; - static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, void *indices); + static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices); glGetIntegerv_client_proc_t m_glGetIntegerv_enc; @@ -74,7 +74,7 @@ private: glVertexAttribPointer_client_proc_t m_glVertexAttribPointer_enc; static void s_glVertexAtrribPointer(void *self, GLuint indx, GLint size, GLenum type, - GLboolean normalized, GLsizei stride, GLvoid * ptr); + GLboolean normalized, GLsizei stride, const GLvoid * ptr); glEnableVertexAttribArray_client_proc_t m_glEnableVertexAttribArray_enc; static void s_glEnableVertexAttribArray(void *self, GLuint index); @@ -91,6 +91,6 @@ private: glGetVertexAttribPointerv_client_proc_t m_glGetVertexAttribPointerv; static void s_glGetVertexAttribPointerv(void *self, GLuint index, GLenum pname, GLvoid **pointer); - static void s_glShaderSource(void *self, GLuint shader, GLsizei count, GLstr *string, GLint *length); + static void s_glShaderSource(void *self, GLuint shader, GLsizei count, const GLstr *string, const GLint *length); }; #endif diff --git a/tools/emulator/opengl/system/GLESv2_enc/gl2.in b/tools/emulator/opengl/system/GLESv2_enc/gl2.in index ad236632c..af18cf0b9 100644 --- a/tools/emulator/opengl/system/GLESv2_enc/gl2.in +++ b/tools/emulator/opengl/system/GLESv2_enc/gl2.in @@ -42,8 +42,7 @@ GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count) GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) GL_ENTRY(void, glEnable, GLenum cap) GL_ENTRY(void, glEnableVertexAttribArray, GLuint index) -# divert from the Opengl definition. Make glFinish retrun a value to ensure round trip. -GL_ENTRY(GLint, glFinish, void) +GL_ENTRY(void, glFinish, void) GL_ENTRY(void, glFlush, void) GL_ENTRY(void, glFramebufferRenderbuffer, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) GL_ENTRY(void, glFramebufferTexture2D, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) diff --git a/tools/emulator/opengl/tests/ut_renderer/RendererContext.cpp b/tools/emulator/opengl/tests/ut_renderer/RendererContext.cpp index 26f2e3574..0f93acd4c 100644 --- a/tools/emulator/opengl/tests/ut_renderer/RendererContext.cpp +++ b/tools/emulator/opengl/tests/ut_renderer/RendererContext.cpp @@ -56,7 +56,7 @@ GLuint RendererContext::getTex2DBind() return m_tex2DBind[m_activeTexture]; } -void RendererContext::addPendingCropRect(int *rect) +void RendererContext::addPendingCropRect(const int *rect) { PendingCropRect *r = new PendingCropRect; r->texture = m_tex2DBind[m_activeTexture]; diff --git a/tools/emulator/opengl/tests/ut_renderer/RendererContext.h b/tools/emulator/opengl/tests/ut_renderer/RendererContext.h index 6daf91813..bb24a2e86 100644 --- a/tools/emulator/opengl/tests/ut_renderer/RendererContext.h +++ b/tools/emulator/opengl/tests/ut_renderer/RendererContext.h @@ -51,7 +51,7 @@ public: } bool isTex2DEnable(int texunit) { return m_tex2DEnable[texunit]; } GLuint getTex2DBind(); - void addPendingCropRect(int *rect); + void addPendingCropRect(const int *rect); PendingCropRectSet &getPendingCropRects() { return m_pendingCropRects; } void setClientActiveTexture(GLenum texture) { m_clientActiveTexture = texture - GL_TEXTURE0; } diff --git a/tools/emulator/opengl/tests/ut_renderer/RenderingThread.cpp b/tools/emulator/opengl/tests/ut_renderer/RenderingThread.cpp index 546c62d56..ddd840591 100644 --- a/tools/emulator/opengl/tests/ut_renderer/RenderingThread.cpp +++ b/tools/emulator/opengl/tests/ut_renderer/RenderingThread.cpp @@ -27,7 +27,7 @@ __thread RenderingThread * RenderingThread::m_tls; #ifdef PVR_WAR -void RenderingThread::s_glTexParameteriv(GLenum target, GLenum param, int *p) +void RenderingThread::s_glTexParameteriv(GLenum target, GLenum param, const int *p) { if (target == GL_TEXTURE_2D && param == GL_TEXTURE_CROP_RECT_OES) { m_tls->m_currentContext->addPendingCropRect(p); @@ -64,28 +64,28 @@ void RenderingThread::s_glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w m_tls->fixTextureEnable(); } -void RenderingThread::s_glDrawTexfvOES(GLfloat *coords) +void RenderingThread::s_glDrawTexfvOES(const GLfloat *coords) { m_tls->applyPendingCropRects(); m_tls->m_glDrawTexfvOES(coords); m_tls->fixTextureEnable(); } -void RenderingThread::s_glDrawTexsvOES(GLshort *coords) +void RenderingThread::s_glDrawTexsvOES(const GLshort *coords) { m_tls->applyPendingCropRects(); m_tls->m_glDrawTexsvOES(coords); m_tls->fixTextureEnable(); } -void RenderingThread::s_glDrawTexivOES(GLint *coords) +void RenderingThread::s_glDrawTexivOES(const GLint *coords) { m_tls->applyPendingCropRects(); m_tls->m_glDrawTexivOES(coords); m_tls->fixTextureEnable(); } -void RenderingThread::s_glDrawTexxvOES(GLfixed *coords) +void RenderingThread::s_glDrawTexxvOES(const GLfixed *coords) { m_tls->applyPendingCropRects(); m_tls->m_glDrawTexxvOES(coords); diff --git a/tools/emulator/opengl/tests/ut_renderer/RenderingThread.h b/tools/emulator/opengl/tests/ut_renderer/RenderingThread.h index ca8f6f494..549d4af2f 100644 --- a/tools/emulator/opengl/tests/ut_renderer/RenderingThread.h +++ b/tools/emulator/opengl/tests/ut_renderer/RenderingThread.h @@ -73,15 +73,15 @@ private: static int s_makeCurrent(uint32_t pid, uint32_t drawSurface, uint32_t readSurface, uint32_t ctx); static void s_swapBuffers(uint32_t pid, uint32_t surface); #ifdef PVR_WAR - static void s_glTexParameteriv(GLenum target, GLenum param, int *p); + static void s_glTexParameteriv(GLenum target, GLenum param, const int *p); static void s_glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h); static void s_glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort w, GLshort h); static void s_glDrawTexiOES(GLint x, GLint y, GLint z, GLint w, GLint h); static void s_glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h); - static void s_glDrawTexfvOES(GLfloat *coords); - static void s_glDrawTexsvOES(GLshort *coords); - static void s_glDrawTexivOES(GLint *coords); - static void s_glDrawTexxvOES(GLfixed *coords); + static void s_glDrawTexfvOES(const GLfloat *coords); + static void s_glDrawTexsvOES(const GLshort *coords); + static void s_glDrawTexivOES(const GLint *coords); + static void s_glDrawTexxvOES(const GLfixed *coords); static void s_glActiveTexture(GLenum texture); static void s_glBindTexture(GLenum target, GLuint texture);