glshim updated, added latest changes by ptitSeb

This commit is contained in:
lubomyr
2016-03-25 00:52:38 +02:00
parent 040ecaa128
commit 26d62b4a95
6 changed files with 43 additions and 6 deletions

View File

@@ -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));
}

View File

@@ -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();

View File

@@ -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);

View File

@@ -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")));

View File

@@ -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");

View File

@@ -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);