glshim updated, added latest changes by ptitSeb
This commit is contained in:
@@ -178,3 +178,8 @@ Hack: Activate some Fast Math in processor/coprocessor
|
||||
* 1 : On OpenPandora, activate "RunFast" on Cortex-A8 (mode default NaN, flush-to-zero)
|
||||
: Not implemented on other platforms (will do nothing)
|
||||
|
||||
##### LIBGL_SILENTSTUB
|
||||
Debug: Hide or Show the Sub / Not found message
|
||||
* 0 : Default, the messages are shown
|
||||
* 1 : Silent, don't print the STUB or glXGetProcAddress glXXXXX not found message
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ void select_transform(GLfloat *a) {
|
||||
/*
|
||||
Transform a[3] using projection and modelview matrix (init with init_select)
|
||||
*/
|
||||
GLfloat tmp[3];
|
||||
GLfloat tmp[4];
|
||||
matrix_vector(modelview, a, tmp);
|
||||
matrix_vector(projection, tmp, a);
|
||||
//matrix_vector(model_proj, a, a);
|
||||
@@ -224,8 +224,7 @@ void select_glDrawArrays(const pointer_state_t* vtx, GLenum mode, GLuint first,
|
||||
if (glstate.selectbuf.buffer == NULL) return;
|
||||
GLfloat *vert = copy_gl_array(vtx->pointer, vtx->type,
|
||||
vtx->size, vtx->stride,
|
||||
GL_FLOAT, 3, 0, count+first);
|
||||
GLfloat tmp[3];
|
||||
GL_FLOAT, 4, 0, count+first);
|
||||
GLfloat zmin=1.0f, zmax=0.0f;
|
||||
init_select();
|
||||
|
||||
@@ -238,46 +237,46 @@ void select_glDrawArrays(const pointer_state_t* vtx, GLenum mode, GLuint first,
|
||||
}
|
||||
// transform the points
|
||||
for (int i=first; i<count+first; i++) {
|
||||
select_transform(vert+i*3);
|
||||
if (vert[i*3+2]<zmin) zmin=vert[i*3+2];
|
||||
if (vert[i*3+2]>zmax) zmax=vert[i*3+2];
|
||||
select_transform(vert+i*4);
|
||||
if (vert[i*4+2]<zmin) zmin=vert[i*4+2];
|
||||
if (vert[i*4+2]>zmax) zmax=vert[i*4+2];
|
||||
}
|
||||
// intersect with screen now
|
||||
GLfloat *vert2 = vert + first*3;
|
||||
GLfloat *vert2 = vert + first*4;
|
||||
for (int i=0; i<count; i++) {
|
||||
switch (mode) {
|
||||
case GL_POINTS:
|
||||
if (select_point_in_viewscreen(vert2+i*3))
|
||||
if (select_point_in_viewscreen(vert2+i*4))
|
||||
FOUND();
|
||||
break;
|
||||
case GL_LINES:
|
||||
if (i%2==1) {
|
||||
if (select_segment_in_viewscreen(vert2+(i-1)*3, vert2+i*3))
|
||||
if (select_segment_in_viewscreen(vert2+(i-1)*4, vert2+i*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
case GL_LINE_STRIP:
|
||||
case GL_LINE_LOOP: //FIXME: the last "loop" segment is missing here
|
||||
if (i>0) {
|
||||
if (select_segment_in_viewscreen(vert2+(i-1)*3, vert2+i*3))
|
||||
if (select_segment_in_viewscreen(vert2+(i-1)*4, vert2+i*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
case GL_TRIANGLES:
|
||||
if (i%3==2) {
|
||||
if (select_triangle_in_viewscreen(vert2+(i-2)*3, vert2+(i-1)*3, vert2+i*3))
|
||||
if (select_triangle_in_viewscreen(vert2+(i-2)*4, vert2+(i-1)*4, vert2+i*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
case GL_TRIANGLE_STRIP:
|
||||
if (i>1) {
|
||||
if (select_triangle_in_viewscreen(vert2+(i-2)*3, vert2+(i-1)*3, vert2+i*3))
|
||||
if (select_triangle_in_viewscreen(vert2+(i-2)*4, vert2+(i-1)*4, vert2+i*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
case GL_TRIANGLE_FAN:
|
||||
if (i>1) {
|
||||
if (select_triangle_in_viewscreen(vert2, vert2+(i-1)*3, vert2+i*3))
|
||||
if (select_triangle_in_viewscreen(vert2, vert2+(i-1)*4, vert2+i*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
@@ -300,14 +299,13 @@ void select_glDrawElements(const pointer_state_t* vtx, GLenum mode, GLuint count
|
||||
max++;
|
||||
GLfloat *vert = copy_gl_array(vtx->pointer, vtx->type,
|
||||
vtx->size, vtx->stride,
|
||||
GL_FLOAT, 3, 0, max);
|
||||
GLfloat tmp[3];
|
||||
GL_FLOAT, 4, 0, max);
|
||||
init_select();
|
||||
GLfloat zmin=1.0f, zmax=0.0f;
|
||||
for (int i=min; i<max; i++) {
|
||||
select_transform(vert+i*3);
|
||||
if (vert[i*3+2]<zmin) zmin=vert[i*3+2];
|
||||
if (vert[i*3+2]>zmax) zmax=vert[i*3+2];
|
||||
if (vert[i*4+2]<zmin) zmin=vert[i*4+2];
|
||||
if (vert[i*4+2]>zmax) zmax=vert[i*4+2];
|
||||
}
|
||||
if (zmin<0.0f) zmin = 0.0f;
|
||||
if (zmax>1.0f) zmax = 1.0f;
|
||||
@@ -323,37 +321,37 @@ void select_glDrawElements(const pointer_state_t* vtx, GLenum mode, GLuint count
|
||||
for (int i=0; i<count; i++) {
|
||||
switch (mode) {
|
||||
case GL_POINTS:
|
||||
if (select_point_in_viewscreen(vert+ind[i]*3))
|
||||
if (select_point_in_viewscreen(vert+ind[i]*4))
|
||||
FOUND();
|
||||
break;
|
||||
case GL_LINES:
|
||||
if (i%2==1) {
|
||||
if (select_segment_in_viewscreen(vert+ind[(i-1)]*3, vert+ind[i]*3))
|
||||
if (select_segment_in_viewscreen(vert+ind[(i-1)]*4, vert+ind[i]*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
case GL_LINE_STRIP:
|
||||
case GL_LINE_LOOP: //FIXME: the last "loop" segment is missing here
|
||||
if (i>0) {
|
||||
if (select_segment_in_viewscreen(vert+ind[(i-1)]*3, vert+ind[i]*3))
|
||||
if (select_segment_in_viewscreen(vert+ind[(i-1)]*4, vert+ind[i]*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
case GL_TRIANGLES:
|
||||
if (i%3==2) {
|
||||
if (select_triangle_in_viewscreen(vert+ind[(i-2)]*3, vert+ind[(i-1)]*3, vert+ind[i]*3))
|
||||
if (select_triangle_in_viewscreen(vert+ind[(i-2)]*4, vert+ind[(i-1)]*4, vert+ind[i]*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
case GL_TRIANGLE_STRIP:
|
||||
if (i>1) {
|
||||
if (select_triangle_in_viewscreen(vert+ind[(i-2)]*3, vert+ind[(i-1)]*3, vert+ind[i]*3))
|
||||
if (select_triangle_in_viewscreen(vert+ind[(i-2)]*4, vert+ind[(i-1)]*4, vert+ind[i]*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
case GL_TRIANGLE_FAN:
|
||||
if (i>1) {
|
||||
if (select_triangle_in_viewscreen(vert+ind[0]*3, vert+ind[(i-1)]*3, vert+ind[i]*3))
|
||||
if (select_triangle_in_viewscreen(vert+ind[0]*4, vert+ind[(i-1)]*4, vert+ind[i]*4))
|
||||
FOUND();
|
||||
}
|
||||
break;
|
||||
@@ -371,4 +369,4 @@ void glInitNames() __attribute__((alias("glshim_glInitNames")));
|
||||
void glPopName() __attribute__((alias("glshim_glPopName")));
|
||||
void glPushName(GLuint name) __attribute__((alias("glshim_glPushName")));
|
||||
void glLoadName(GLuint name) __attribute__((alias("glshim_glLoadName")));
|
||||
void glSelectBuffer(GLsizei size, GLuint *buffer) __attribute__((alias("glshim_glSelectBuffer")));
|
||||
void glSelectBuffer(GLsizei size, GLuint *buffer) __attribute__((alias("glshim_glSelectBuffer")));
|
||||
|
||||
@@ -187,6 +187,7 @@ extern int blendhack;
|
||||
extern int export_blendcolor;
|
||||
extern int glshim_noerror;
|
||||
extern char glshim_version[50];
|
||||
int export_silentstub = 0;
|
||||
|
||||
bool g_recyclefbo = false;
|
||||
static int g_width=0, g_height=0;
|
||||
@@ -480,6 +481,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, glshim_noerror, "glGetError() always return GL_NOERROR");
|
||||
env(LIBGL_SILENTSTUB, export_silentstub, "Stub/non present functions are not printed");
|
||||
|
||||
char *env_version = getenv("LIBGL_VERSION");
|
||||
if (env_version) {
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
//#define DEBUG_ADDRESS
|
||||
|
||||
extern int export_blendcolor;
|
||||
extern int export_silentstub;
|
||||
|
||||
#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;
|
||||
if (strcmp(name, func_name) == 0) return (void *)func;
|
||||
#else
|
||||
#define MAP(func_name, func) \
|
||||
if (strcmp(name, func_name) == 0) return (void *)func;
|
||||
@@ -33,7 +34,7 @@ extern int export_blendcolor;
|
||||
|
||||
#define STUB(func_name) \
|
||||
if (strcmp(name, #func_name) == 0) { \
|
||||
printf("glX stub: %s\n", #func_name); \
|
||||
if(!export_silentstub) printf("glX stub: %s\n", #func_name); \
|
||||
return (void *)glXStub; \
|
||||
}
|
||||
|
||||
@@ -602,7 +603,7 @@ void *glXGetProcAddressARB(const char *name) {
|
||||
_EX(glMatrixMultTransposef);
|
||||
_EX(glMatrixMultTransposed);
|
||||
|
||||
printf("glXGetProcAddress: %s not found.\n", name);
|
||||
if (!export_silentstub) printf("glXGetProcAddress: %s not found.\n", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user