From 26d62b4a958d73274f0014d1252fb4d9f803704f Mon Sep 17 00:00:00 2001 From: lubomyr Date: Fri, 25 Mar 2016 00:52:38 +0200 Subject: [PATCH] glshim updated, added latest changes by ptitSeb --- project/jni/glshim/src/gl/gl.c | 21 +++++++++++++++++++-- project/jni/glshim/src/gl/gl.h | 2 ++ project/jni/glshim/src/gl/list.c | 2 +- project/jni/glshim/src/gl/texture.c | 11 ++++++++++- project/jni/glshim/src/glx/glx.c | 2 ++ project/jni/glshim/src/glx/lookup.c | 11 +++++++++-- 6 files changed, 43 insertions(+), 6 deletions(-) diff --git a/project/jni/glshim/src/gl/gl.c b/project/jni/glshim/src/gl/gl.c index fa2eef754..6b0011cb2 100755 --- a/project/jni/glshim/src/gl/gl.c +++ b/project/jni/glshim/src/gl/gl.c @@ -30,6 +30,7 @@ GLuint readhack_seq = 0; GLuint gl_batch = 0; GLuint gl_mergelist = 1; int blendhack = 0; +int export_blendcolor = 0; char glshim_version[50]; int initialized = 0; int noerror = 0; @@ -1743,10 +1744,17 @@ void glshim_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf a LOAD_GLES_OES(glBlendColor); if (gles_glBlendColor) gles_glBlendColor(red, green, blue, alpha); - else - printf("stub glBlendColor(%f, %f, %f, %f)\n", red, green, blue, alpha); + else { + static int test = 1; + if (test) { + printf("stub glBlendColor(%f, %f, %f, %f)\n", red, green, blue, alpha); + test = 0; + } + } } void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) __attribute__((alias("glshim_glBlendColor"))); +void glBlendColorEXT(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) __attribute__((alias("glshim_glBlendColor"))); +void glBlendColorARB(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) __attribute__((alias("glshim_glBlendColor"))); void glshim_glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { @@ -1847,6 +1855,15 @@ void glshim_glBlendFunc(GLenum sfactor, GLenum dfactor) { } void glBlendFunc(GLenum sfactor, GLenum dfactor) __attribute__((alias("glshim_glBlendFunc"))); + +void glshim_glStencilMaskSeparate(GLenum face, GLuint mask) { + // fake function..., call it only for front or front_and_back, just ignore back (crappy, I know) + if ((face==GL_FRONT) || (face==GL_FRONT_AND_BACK)) + glshim_glStencilMask(mask); +} +void glStencilMaskSeparate(GLenum face, GLuint mask) __attribute__((alias("glshim_glStencilMaskSeparate"))); + + void init_statebatch() { memset(&glstate.statebatch, 0, sizeof(statebatch_t)); } diff --git a/project/jni/glshim/src/gl/gl.h b/project/jni/glshim/src/gl/gl.h index d258f7e5f..38c79653b 100755 --- a/project/jni/glshim/src/gl/gl.h +++ b/project/jni/glshim/src/gl/gl.h @@ -384,6 +384,8 @@ void glshim_glLoadMatrixf(const GLfloat * m); void glshim_glMultMatrixf(const GLfloat * m); void glshim_glFogfv(GLenum pname, const GLfloat* params); +void glshim_glStencilMaskSeparate(GLenum face, GLuint mask); + void flush(); void init_batch(); diff --git a/project/jni/glshim/src/gl/list.c b/project/jni/glshim/src/gl/list.c index 99a77ff4a..a2760350b 100755 --- a/project/jni/glshim/src/gl/list.c +++ b/project/jni/glshim/src/gl/list.c @@ -604,7 +604,7 @@ void adjust_renderlist(renderlist_t *list) { } void end_renderlist(renderlist_t *list) { - if (! list->open) + if (!list || ! list->open) return; adjust_renderlist(list); diff --git a/project/jni/glshim/src/gl/texture.c b/project/jni/glshim/src/gl/texture.c index 3e618c33b..83245eed1 100755 --- a/project/jni/glshim/src/gl/texture.c +++ b/project/jni/glshim/src/gl/texture.c @@ -1847,7 +1847,7 @@ void glshim_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalfo glshim_glGetIntegerv(GL_UNPACK_ALIGNMENT, &oldalign); if (oldalign!=1) glshim_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glshim_glTexImage2D(target, level, GL_RGBA, width>>fact, height>>fact, border, type, format, half); + glshim_glTexImage2D(target, level, GL_RGBA, width>>fact, height>>fact, border, format, type, half); if (oldalign!=1) glshim_glPixelStorei(GL_UNPACK_ALIGNMENT, oldalign); if (half!=pixels) @@ -2057,3 +2057,12 @@ void glCopyTexSubImage3DEXT(GLenum target, GLint level, GLint xoffset, GLint yof //ARB mapper void glActiveTextureARB(GLenum texture) __attribute__((alias("glshim_glActiveTexture"))); void glClientActiveTextureARB(GLenum texture) __attribute__((alias("glshim_glClientActiveTexture"))); +void glTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *data) __attribute__((alias("glshim_glTexSubImage3D"))); +void glCompressedTexImage2DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) __attribute__((alias("glshim_glCompressedTexImage2D"))); +void glCompressedTexImage1DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) __attribute__((alias("glshim_glCompressedTexImage1D"))); +void glCompressedTexImage3DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) __attribute__((alias("glshim_glCompressedTexImage3D"))); +void glCompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) __attribute__((alias("glshim_glCompressedTexSubImage2D"))); +void glCompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) __attribute__((alias("glshim_glCompressedTexSubImage1D"))); +void glCompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) __attribute__((alias("glshim_glCompressedTexSubImage3D"))); +void glGetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img) __attribute__((alias("glshim_glGetCompressedTexImage"))); +void glCopyTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) __attribute__((alias("glshim_glCopyTexSubImage3D"))); diff --git a/project/jni/glshim/src/glx/glx.c b/project/jni/glshim/src/glx/glx.c index beae5405f..eef7a1fee 100755 --- a/project/jni/glshim/src/glx/glx.c +++ b/project/jni/glshim/src/glx/glx.c @@ -167,6 +167,7 @@ extern int texstream; extern int copytex; extern int nolumalpha; extern int blendhack; +extern int export_blendcolor; extern int noerror; extern char glshim_version[50]; @@ -430,6 +431,7 @@ static void scan_env() { } env(LIBGL_BLENDHACK, blendhack, "Change Blend GL_SRC_ALPHA, GL_ONE to GL_ONE, GL_ONE"); + env(LIBGL_BLENDCOLOR, export_blendcolor, "Export a (faked) glBlendColor"); env(LIBGL_NOERROR, noerror, "glGetError() always return GL_NOERROR"); char *env_version = getenv("LIBGL_VERSION"); diff --git a/project/jni/glshim/src/glx/lookup.c b/project/jni/glshim/src/glx/lookup.c index 4baad17f3..be29d07f0 100755 --- a/project/jni/glshim/src/glx/lookup.c +++ b/project/jni/glshim/src/glx/lookup.c @@ -6,6 +6,8 @@ #include "../gl/directstate.h" //#define DEBUG_ADDRESS +extern int export_blendcolor; + #ifdef DEBUG_ADDRESS #define MAP(func_name, func) \ if(cnt==1) {if ((uint32_t)((void*)func) <0x4000000) printf("glxGetProcAddress %s = %p\n", func_name, (void*)func);} if (strcmp(name, func_name) == 0) return (void *)func; @@ -309,8 +311,11 @@ void *glXGetProcAddressARB(const char *name) { _EX(glArrayElement); _EX(glBegin); _EX(glBitmap); - /*EXT(glBlendColor); - ARB(glBlendColor);*/ + if(export_blendcolor) { + _EX(glBlendColor); + _EXT(glBlendColor); + _ARB(glBlendColor); + } _EXT(glBlendEquation); _ARB(glBlendEquation); _EXT(glBlendFunc); @@ -327,6 +332,8 @@ void *glXGetProcAddressARB(const char *name) { _EXT(glBlendFuncSeparatei); _ARB(glBlendFuncSeparatei); #endif + _EX(glStencilMaskSeparate); + _EXT(glStencilMaskSeparate); _EX(glCallList); _EX(glCallLists); _EX(glClearDepth);