glshim updated, added latest changes by ptitSeb
This commit is contained in:
@@ -30,7 +30,7 @@ GLuint readhack_seq = 0;
|
|||||||
GLuint gl_batch = 0;
|
GLuint gl_batch = 0;
|
||||||
GLuint gl_mergelist = 1;
|
GLuint gl_mergelist = 1;
|
||||||
int blendhack = 0;
|
int blendhack = 0;
|
||||||
char gl_version[50];
|
char glshim_version[50];
|
||||||
int initialized = 0;
|
int initialized = 0;
|
||||||
int noerror = 0;
|
int noerror = 0;
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ const GLubyte *glshim_glGetString(GLenum name) {
|
|||||||
printf("**warning** glGetString(%i) called with bad init\n", name);*/
|
printf("**warning** glGetString(%i) called with bad init\n", name);*/
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case GL_VERSION:
|
case GL_VERSION:
|
||||||
return (GLubyte *)gl_version;
|
return (GLubyte *)glshim_version;
|
||||||
case GL_EXTENSIONS:
|
case GL_EXTENSIONS:
|
||||||
return (const GLubyte *)(char *){
|
return (const GLubyte *)(char *){
|
||||||
"GL_EXT_abgr "
|
"GL_EXT_abgr "
|
||||||
@@ -1208,7 +1208,7 @@ void glBegin(GLenum mode) __attribute__((alias("glshim_glBegin")));
|
|||||||
|
|
||||||
void glshim_glEnd() {
|
void glshim_glEnd() {
|
||||||
if (!glstate.list.active) return;
|
if (!glstate.list.active) return;
|
||||||
// check if TEXTUREx is activate and no TexCoord (or texgen), in that cas, create a dummy one base on glstate...
|
// check if TEXTUREx is activate and no TexCoord (or texgen), in that case, create a dummy one base on glstate...
|
||||||
for (int a=0; a<MAX_TEX; a++)
|
for (int a=0; a<MAX_TEX; a++)
|
||||||
if (glstate.enable.texture_2d[a] && ((glstate.list.active->tex[a]==0) && (!glstate.enable.texgen_s[a])))
|
if (glstate.enable.texture_2d[a] && ((glstate.list.active->tex[a]==0) && (!glstate.enable.texgen_s[a])))
|
||||||
rlMultiTexCoord4f(glstate.list.active, GL_TEXTURE0+a, glstate.texcoord[a][0], glstate.texcoord[a][1], glstate.texcoord[a][2], glstate.texcoord[a][3]);
|
rlMultiTexCoord4f(glstate.list.active, GL_TEXTURE0+a, glstate.texcoord[a][0], glstate.texcoord[a][1], glstate.texcoord[a][2], glstate.texcoord[a][3]);
|
||||||
@@ -1227,7 +1227,6 @@ void glshim_glEnd() {
|
|||||||
void glEnd() __attribute__((alias("glshim_glEnd")));
|
void glEnd() __attribute__((alias("glshim_glEnd")));
|
||||||
|
|
||||||
void glshim_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) {
|
void glshim_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) {
|
||||||
glstate.normal[0] = nx; glstate.normal[1] = ny; glstate.normal[2] = nz;
|
|
||||||
if (glstate.list.active) {
|
if (glstate.list.active) {
|
||||||
if (glstate.list.active->stage != STAGE_DRAW) {
|
if (glstate.list.active->stage != STAGE_DRAW) {
|
||||||
if (glstate.list.active->stage != STAGE_DRAW) {
|
if (glstate.list.active->stage != STAGE_DRAW) {
|
||||||
@@ -1245,6 +1244,7 @@ void glshim_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) {
|
|||||||
errorGL();
|
errorGL();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
glstate.normal[0] = nx; glstate.normal[1] = ny; glstate.normal[2] = nz;
|
||||||
}
|
}
|
||||||
void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) __attribute__((alias("glshim_glNormal3f")));
|
void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) __attribute__((alias("glshim_glNormal3f")));
|
||||||
|
|
||||||
@@ -1257,9 +1257,6 @@ void glshim_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
|
|||||||
void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) __attribute__((alias("glshim_glVertex4f")));
|
void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) __attribute__((alias("glshim_glVertex4f")));
|
||||||
|
|
||||||
void glshim_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
|
void glshim_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
|
||||||
// change the state first thing
|
|
||||||
glstate.color[0] = red; glstate.color[1] = green;
|
|
||||||
glstate.color[2] = blue; glstate.color[3] = alpha;
|
|
||||||
if (glstate.list.active) {
|
if (glstate.list.active) {
|
||||||
if (glstate.list.active->stage != STAGE_DRAW) {
|
if (glstate.list.active->stage != STAGE_DRAW) {
|
||||||
PUSH_IF_COMPILING(glColor4f);
|
PUSH_IF_COMPILING(glColor4f);
|
||||||
@@ -1274,19 +1271,22 @@ void glshim_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
|
|||||||
errorGL();
|
errorGL();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
// change the state last thing
|
||||||
|
glstate.color[0] = red; glstate.color[1] = green;
|
||||||
|
glstate.color[2] = blue; glstate.color[3] = alpha;
|
||||||
}
|
}
|
||||||
void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) __attribute__((alias("glshim_glColor4f")));
|
void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) __attribute__((alias("glshim_glColor4f")));
|
||||||
|
|
||||||
void glshim_glSecondaryColor3f(GLfloat r, GLfloat g, GLfloat b) {
|
void glshim_glSecondaryColor3f(GLfloat r, GLfloat g, GLfloat b) {
|
||||||
// change the state first thing
|
|
||||||
glstate.secondary[0] = r; glstate.secondary[1] = g;
|
|
||||||
glstate.secondary[2] = b;
|
|
||||||
if (glstate.list.active) {
|
if (glstate.list.active) {
|
||||||
rlSecondary3f(glstate.list.active, r, g, b);
|
rlSecondary3f(glstate.list.active, r, g, b);
|
||||||
noerrorShim();
|
noerrorShim();
|
||||||
} else {
|
} else {
|
||||||
noerrorShim();
|
noerrorShim();
|
||||||
}
|
}
|
||||||
|
// change the state last thing
|
||||||
|
glstate.secondary[0] = r; glstate.secondary[1] = g;
|
||||||
|
glstate.secondary[2] = b;
|
||||||
}
|
}
|
||||||
void glSecondaryColor3f(GLfloat r, GLfloat g, GLfloat b) __attribute__((alias("glshim_glSecondaryColor3f")));
|
void glSecondaryColor3f(GLfloat r, GLfloat g, GLfloat b) __attribute__((alias("glshim_glSecondaryColor3f")));
|
||||||
|
|
||||||
@@ -1328,20 +1328,18 @@ void glMaterialf(GLenum face, GLenum pname, const GLfloat param) __attribute__((
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void glshim_glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
|
void glshim_glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
|
||||||
glstate.texcoord[0][0] = s; glstate.texcoord[0][1] = t;
|
|
||||||
glstate.texcoord[0][2] = r; glstate.texcoord[0][3] = q;
|
|
||||||
if (glstate.list.active) {
|
if (glstate.list.active) {
|
||||||
rlTexCoord4f(glstate.list.active, s, t, r, q);
|
rlTexCoord4f(glstate.list.active, s, t, r, q);
|
||||||
noerrorShim();
|
noerrorShim();
|
||||||
} else {
|
} else {
|
||||||
noerrorShim();
|
noerrorShim();
|
||||||
}
|
}
|
||||||
|
glstate.texcoord[0][0] = s; glstate.texcoord[0][1] = t;
|
||||||
|
glstate.texcoord[0][2] = r; glstate.texcoord[0][3] = q;
|
||||||
}
|
}
|
||||||
void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) __attribute__((alias("glshim_glTexCoord4f")));
|
void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) __attribute__((alias("glshim_glTexCoord4f")));
|
||||||
|
|
||||||
void glshim_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
|
void glshim_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
|
||||||
glstate.texcoord[target-GL_TEXTURE0][0] = s; glstate.texcoord[target-GL_TEXTURE0][1] = t;
|
|
||||||
glstate.texcoord[target-GL_TEXTURE0][2] = r; glstate.texcoord[target-GL_TEXTURE0][3] = q;
|
|
||||||
// TODO, error if target is unsuported texture....
|
// TODO, error if target is unsuported texture....
|
||||||
if (glstate.list.active) {
|
if (glstate.list.active) {
|
||||||
rlMultiTexCoord4f(glstate.list.active, target, s, t, r, q);
|
rlMultiTexCoord4f(glstate.list.active, target, s, t, r, q);
|
||||||
@@ -1349,6 +1347,8 @@ void glshim_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GL
|
|||||||
} else {
|
} else {
|
||||||
noerrorShim();
|
noerrorShim();
|
||||||
}
|
}
|
||||||
|
glstate.texcoord[target-GL_TEXTURE0][0] = s; glstate.texcoord[target-GL_TEXTURE0][1] = t;
|
||||||
|
glstate.texcoord[target-GL_TEXTURE0][2] = r; glstate.texcoord[target-GL_TEXTURE0][3] = q;
|
||||||
}
|
}
|
||||||
void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) __attribute__((alias("glshim_glMultiTexCoord4f")));
|
void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) __attribute__((alias("glshim_glMultiTexCoord4f")));
|
||||||
void glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) __attribute__((alias("glshim_glMultiTexCoord4f")));
|
void glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) __attribute__((alias("glshim_glMultiTexCoord4f")));
|
||||||
|
|||||||
@@ -1112,7 +1112,7 @@ void rlNormal3f(renderlist_t *list, GLfloat x, GLfloat y, GLfloat z) {
|
|||||||
list->normal = alloc_sublist(3, list->cap);
|
list->normal = alloc_sublist(3, list->cap);
|
||||||
// catch up
|
// catch up
|
||||||
int i;
|
int i;
|
||||||
if (list->len) for (i = 0; i < list->len-1; i++) {
|
if (list->len) for (i = 0; i < list->len; i++) {
|
||||||
GLfloat *normal = (list->normal + (i * 3));
|
GLfloat *normal = (list->normal + (i * 3));
|
||||||
memcpy(normal, list->lastNormal, sizeof(GLfloat) * 3);
|
memcpy(normal, list->lastNormal, sizeof(GLfloat) * 3);
|
||||||
}
|
}
|
||||||
@@ -1127,7 +1127,7 @@ void rlColor4f(renderlist_t *list, GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
|
|||||||
list->color = alloc_sublist(4, list->cap);
|
list->color = alloc_sublist(4, list->cap);
|
||||||
// catch up
|
// catch up
|
||||||
int i;
|
int i;
|
||||||
if (list->len) for (i = 0; i < list->len-1; i++) {
|
if (list->len) for (i = 0; i < list->len; i++) {
|
||||||
GLfloat *color = (list->color + (i * 4));
|
GLfloat *color = (list->color + (i * 4));
|
||||||
memcpy(color, glstate.color, sizeof(GLfloat) * 4);
|
memcpy(color, glstate.color, sizeof(GLfloat) * 4);
|
||||||
}/* else {
|
}/* else {
|
||||||
@@ -1145,7 +1145,7 @@ void rlSecondary3f(renderlist_t *list, GLfloat r, GLfloat g, GLfloat b) {
|
|||||||
list->secondary = alloc_sublist(4, list->cap);
|
list->secondary = alloc_sublist(4, list->cap);
|
||||||
// catch up
|
// catch up
|
||||||
int i;
|
int i;
|
||||||
if (list->len) for (i = 0; i < list->len-1; i++) {
|
if (list->len) for (i = 0; i < list->len; i++) {
|
||||||
GLfloat *secondary = (list->secondary + (i * 4));
|
GLfloat *secondary = (list->secondary + (i * 4));
|
||||||
memcpy(secondary, glstate.secondary, sizeof(GLfloat) * 4);
|
memcpy(secondary, glstate.secondary, sizeof(GLfloat) * 4);
|
||||||
}
|
}
|
||||||
@@ -1250,7 +1250,7 @@ void rlTexCoord4f(renderlist_t *list, GLfloat s, GLfloat t, GLfloat r, GLfloat q
|
|||||||
list->tex[0] = alloc_sublist(4, list->cap);
|
list->tex[0] = alloc_sublist(4, list->cap);
|
||||||
// catch up
|
// catch up
|
||||||
GLfloat *tex = list->tex[0];
|
GLfloat *tex = list->tex[0];
|
||||||
if (list->len) for (int i = 0; i < list->len-1; i++) {
|
if (list->len) for (int i = 0; i < list->len; i++) {
|
||||||
memcpy(tex, glstate.texcoord[0], sizeof(GLfloat) * 4);
|
memcpy(tex, glstate.texcoord[0], sizeof(GLfloat) * 4);
|
||||||
tex += 4;
|
tex += 4;
|
||||||
}
|
}
|
||||||
@@ -1267,7 +1267,7 @@ void rlMultiTexCoord4f(renderlist_t *list, GLenum target, GLfloat s, GLfloat t,
|
|||||||
list->tex[tmu] = alloc_sublist(4, list->cap);
|
list->tex[tmu] = alloc_sublist(4, list->cap);
|
||||||
// catch up
|
// catch up
|
||||||
GLfloat *tex = list->tex[tmu];
|
GLfloat *tex = list->tex[tmu];
|
||||||
if (list->len) for (int i = 0; i < list->len-1; i++) {
|
if (list->len) for (int i = 0; i < list->len; i++) {
|
||||||
memcpy(tex, glstate.texcoord[tmu], sizeof(GLfloat) * 4);
|
memcpy(tex, glstate.texcoord[tmu], sizeof(GLfloat) * 4);
|
||||||
tex += 4;
|
tex += 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -713,12 +713,13 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((src_format == GL_BGRA) && (dst_format == GL_LUMINANCE_ALPHA) && (dst_type == GL_UNSIGNED_BYTE) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
if (((src_format == GL_BGRA)||(src_format == GL_RGBA)) && (dst_format == GL_LUMINANCE_ALPHA) && (dst_type == GL_UNSIGNED_BYTE) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
||||||
GLuint tmp;
|
GLuint tmp;
|
||||||
for (int i = 0; i < height; i++) {
|
for (int i = 0; i < height; i++) {
|
||||||
for (int j = 0; j < width; j++) {
|
for (int j = 0; j < width; j++) {
|
||||||
tmp = *(const GLuint*)src_pos;
|
tmp = *(const GLuint*)src_pos;
|
||||||
*(GLushort*)dst_pos = (tmp&0x0000ff00) | (tmp&0x000000ff);
|
*(GLushort*)dst_pos = (((((char*)src_pos)[2] + ((char*)src_pos)[1] + ((char*)src_pos)[0])/3)&0xff)<<8 | ((char*)src_pos)[3];
|
||||||
|
// *(GLushort*)dst_pos = (tmp&0x0000ff00) | (tmp&0x000000ff);
|
||||||
src_pos += src_stride;
|
src_pos += src_stride;
|
||||||
dst_pos += dst_stride;
|
dst_pos += dst_stride;
|
||||||
}
|
}
|
||||||
@@ -727,8 +728,7 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((src_format == GL_BGR) && (dst_format == GL_RGB) && (dst_type == GL_UNSIGNED_BYTE) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
if (((src_format == GL_BGR)||(src_format == GL_BGRA)) && (dst_format == GL_RGB) && (dst_type == GL_UNSIGNED_BYTE) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
||||||
GLuint tmp;
|
|
||||||
for (int i = 0; i < height; i++) {
|
for (int i = 0; i < height; i++) {
|
||||||
for (int j = 0; j < width; j++) {
|
for (int j = 0; j < width; j++) {
|
||||||
((char*)dst_pos)[0] = ((char*)src_pos)[2];
|
((char*)dst_pos)[0] = ((char*)src_pos)[2];
|
||||||
@@ -742,8 +742,21 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((src_format == GL_RGB) && (dst_format == GL_RGB) && (dst_type = GL_UNSIGNED_SHORT_5_6_5) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
if ((src_format == GL_RGBA) && (dst_format == GL_RGB) && (dst_type == GL_UNSIGNED_BYTE) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
||||||
GLuint tmp;
|
for (int i = 0; i < height; i++) {
|
||||||
|
for (int j = 0; j < width; j++) {
|
||||||
|
((char*)dst_pos)[0] = ((char*)src_pos)[0];
|
||||||
|
((char*)dst_pos)[1] = ((char*)src_pos)[1];
|
||||||
|
((char*)dst_pos)[2] = ((char*)src_pos)[2];
|
||||||
|
src_pos += src_stride;
|
||||||
|
dst_pos += dst_stride;
|
||||||
|
}
|
||||||
|
if (stride)
|
||||||
|
dst_pos += dst_width;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (((src_format == GL_RGB)||(src_format == GL_RGBA)) && (dst_format == GL_RGB) && (dst_type = GL_UNSIGNED_SHORT_5_6_5) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
||||||
for (int i = 0; i < height; i++) {
|
for (int i = 0; i < height; i++) {
|
||||||
for (int j = 0; j < width; j++) {
|
for (int j = 0; j < width; j++) {
|
||||||
*(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[2]&0xf8)>>(3)) | ((GLushort)(((char*)src_pos)[1]&0xfc)<<(5-2)) | ((GLushort)(((char*)src_pos)[0]&0xf8)<<(11-3));
|
*(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[2]&0xf8)>>(3)) | ((GLushort)(((char*)src_pos)[1]&0xfc)<<(5-2)) | ((GLushort)(((char*)src_pos)[0]&0xf8)<<(11-3));
|
||||||
@@ -756,7 +769,6 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (((src_format == GL_BGR) || (src_format == GL_BGRA)) && (dst_format == GL_RGB) && (dst_type = GL_UNSIGNED_SHORT_5_6_5) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
if (((src_format == GL_BGR) || (src_format == GL_BGRA)) && (dst_format == GL_RGB) && (dst_type = GL_UNSIGNED_SHORT_5_6_5) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) {
|
||||||
GLuint tmp;
|
|
||||||
for (int i = 0; i < height; i++) {
|
for (int i = 0; i < height; i++) {
|
||||||
for (int j = 0; j < width; j++) {
|
for (int j = 0; j < width; j++) {
|
||||||
*(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[0]&0xf8)>>(3)) | ((GLushort)(((char*)src_pos)[1]&0xfc)<<(5-2)) | ((GLushort)(((char*)src_pos)[2]&0xf8)<<(11-3));
|
*(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[0]&0xf8)>>(3)) | ((GLushort)(((char*)src_pos)[1]&0xfc)<<(5-2)) | ((GLushort)(((char*)src_pos)[2]&0xf8)<<(11-3));
|
||||||
|
|||||||
@@ -384,8 +384,8 @@ void glshim_glTexImage2D(GLenum target, GLint level, GLint internalformat,
|
|||||||
//printf("glTexImage2D on target=%s with unpack_row_length(%i), size(%i,%i) and skip(%i,%i), format(internal)=%s(%s), type=%s, data=%08x, level=%i (mipmap_need=%i, mipmap_auto=%i) => texture=%u (streamed=%i), glstate.list.compiling=%d\n", PrintEnum(target), glstate.texture.unpack_row_length, width, height, glstate.texture.unpack_skip_pixels, glstate.texture.unpack_skip_rows, PrintEnum(format), PrintEnum(internalformat), PrintEnum(type), data, level, (glstate.texture.bound[glstate.texture.active])?glstate.texture.bound[glstate.texture.active]->mipmap_need:0, (glstate.texture.bound[glstate.texture.active])?glstate.texture.bound[glstate.texture.active]->mipmap_auto:0, (glstate.texture.bound[glstate.texture.active])?glstate.texture.bound[glstate.texture.active]->texture:0, (glstate.texture.bound[glstate.texture.active])?glstate.texture.bound[glstate.texture.active]->streamed:0, glstate.list.compiling);
|
//printf("glTexImage2D on target=%s with unpack_row_length(%i), size(%i,%i) and skip(%i,%i), format(internal)=%s(%s), type=%s, data=%08x, level=%i (mipmap_need=%i, mipmap_auto=%i) => texture=%u (streamed=%i), glstate.list.compiling=%d\n", PrintEnum(target), glstate.texture.unpack_row_length, width, height, glstate.texture.unpack_skip_pixels, glstate.texture.unpack_skip_rows, PrintEnum(format), PrintEnum(internalformat), PrintEnum(type), data, level, (glstate.texture.bound[glstate.texture.active])?glstate.texture.bound[glstate.texture.active]->mipmap_need:0, (glstate.texture.bound[glstate.texture.active])?glstate.texture.bound[glstate.texture.active]->mipmap_auto:0, (glstate.texture.bound[glstate.texture.active])?glstate.texture.bound[glstate.texture.active]->texture:0, (glstate.texture.bound[glstate.texture.active])?glstate.texture.bound[glstate.texture.active]->streamed:0, glstate.list.compiling);
|
||||||
// proxy case
|
// proxy case
|
||||||
if (target == GL_PROXY_TEXTURE_2D) {
|
if (target == GL_PROXY_TEXTURE_2D) {
|
||||||
proxy_width = ((width<<level)>(texshrink==8)?8192:2048)?0:width;
|
proxy_width = ((width<<level)>(texshrink>=8)?8192:2048)?0:width;
|
||||||
proxy_height = ((height<<level)>(texshrink==8)?8192:2048)?0:height;
|
proxy_height = ((height<<level)>(texshrink>=8)?8192:2048)?0:height;
|
||||||
proxy_intformat = swizzle_internalformat(&internalformat);
|
proxy_intformat = swizzle_internalformat(&internalformat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1779,7 +1779,7 @@ void glshim_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalfo
|
|||||||
errorShim(GL_INVALID_OPERATION);
|
errorShim(GL_INVALID_OPERATION);
|
||||||
return; // no texture bounded...
|
return; // no texture bounded...
|
||||||
}
|
}
|
||||||
//printf("glCompressedTexImage2D on target=%s with size(%i,%i), internalformat=s, imagesize=%i, upackbuffer=%p\n", PrintEnum(target), width, height, PrintEnum(internalformat), imageSize, glstate.buffers.unpack?glstate.buffers.unpack->data:0);
|
//printf("glCompressedTexImage2D on target=%s with size(%i,%i), internalformat=%s, imagesize=%i, upackbuffer=%p\n", PrintEnum(target), width, height, PrintEnum(internalformat), imageSize, glstate.vao->unpack?glstate.vao->unpack->data:0);
|
||||||
// hack...
|
// hack...
|
||||||
if (internalformat==GL_RGBA8)
|
if (internalformat==GL_RGBA8)
|
||||||
internalformat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
internalformat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||||
@@ -1802,6 +1802,9 @@ void glshim_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalfo
|
|||||||
GLvoid *datab = (GLvoid*)data;
|
GLvoid *datab = (GLvoid*)data;
|
||||||
if (unpack)
|
if (unpack)
|
||||||
datab += (uintptr_t)unpack->data;
|
datab += (uintptr_t)unpack->data;
|
||||||
|
|
||||||
|
GLenum format = GL_RGBA;
|
||||||
|
GLenum type = GL_UNSIGNED_BYTE;
|
||||||
|
|
||||||
if (isDXTc(internalformat)) {
|
if (isDXTc(internalformat)) {
|
||||||
GLvoid *pixels, *half;
|
GLvoid *pixels, *half;
|
||||||
@@ -1825,11 +1828,15 @@ void glshim_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalfo
|
|||||||
// automaticaly reduce the pixel size
|
// automaticaly reduce the pixel size
|
||||||
half=pixels;
|
half=pixels;
|
||||||
glstate.texture.bound[glstate.texture.active]->alpha = (internalformat==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)?false:true;
|
glstate.texture.bound[glstate.texture.active]->alpha = (internalformat==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)?false:true;
|
||||||
glstate.texture.bound[glstate.texture.active]->format = GL_RGBA; //internalformat;
|
format = (internalformat==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)?GL_RGB:GL_RGBA;
|
||||||
glstate.texture.bound[glstate.texture.active]->type = GL_UNSIGNED_SHORT_4_4_4_4;
|
glstate.texture.bound[glstate.texture.active]->format = format; //internalformat;
|
||||||
|
type = (internalformat==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)?GL_UNSIGNED_SHORT_5_6_5:GL_UNSIGNED_SHORT_4_4_4_4;
|
||||||
|
glstate.texture.bound[glstate.texture.active]->type = type;
|
||||||
glstate.texture.bound[glstate.texture.active]->compressed = true;
|
glstate.texture.bound[glstate.texture.active]->compressed = true;
|
||||||
if (pixel_thirdscale(pixels, &half, width, height, GL_RGBA, GL_UNSIGNED_BYTE))
|
if (pixel_convert(pixels, &half, width, height, GL_RGBA, GL_UNSIGNED_BYTE, format, type, 0))
|
||||||
fact = 1;
|
fact = 0;
|
||||||
|
// if (pixel_thirdscale(pixels, &half, width, height, GL_RGBA, GL_UNSIGNED_BYTE))
|
||||||
|
// fact = 1;
|
||||||
else
|
else
|
||||||
glstate.texture.bound[glstate.texture.active]->type = GL_UNSIGNED_BYTE;
|
glstate.texture.bound[glstate.texture.active]->type = GL_UNSIGNED_BYTE;
|
||||||
} else {
|
} else {
|
||||||
@@ -1840,7 +1847,7 @@ void glshim_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalfo
|
|||||||
glshim_glGetIntegerv(GL_UNPACK_ALIGNMENT, &oldalign);
|
glshim_glGetIntegerv(GL_UNPACK_ALIGNMENT, &oldalign);
|
||||||
if (oldalign!=1)
|
if (oldalign!=1)
|
||||||
glshim_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glshim_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glshim_glTexImage2D(target, level, GL_RGBA, width>>fact, height>>fact, border, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, half);
|
glshim_glTexImage2D(target, level, GL_RGBA, width>>fact, height>>fact, border, type, format, half);
|
||||||
if (oldalign!=1)
|
if (oldalign!=1)
|
||||||
glshim_glPixelStorei(GL_UNPACK_ALIGNMENT, oldalign);
|
glshim_glPixelStorei(GL_UNPACK_ALIGNMENT, oldalign);
|
||||||
if (half!=pixels)
|
if (half!=pixels)
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ extern int copytex;
|
|||||||
extern int nolumalpha;
|
extern int nolumalpha;
|
||||||
extern int blendhack;
|
extern int blendhack;
|
||||||
extern int noerror;
|
extern int noerror;
|
||||||
extern char gl_version[50];
|
extern char glshim_version[50];
|
||||||
|
|
||||||
bool g_recyclefbo = false;
|
bool g_recyclefbo = false;
|
||||||
static int g_width=0, g_height=0;
|
static int g_width=0, g_height=0;
|
||||||
@@ -434,9 +434,9 @@ static void scan_env() {
|
|||||||
|
|
||||||
char *env_version = getenv("LIBGL_VERSION");
|
char *env_version = getenv("LIBGL_VERSION");
|
||||||
if (env_version) {
|
if (env_version) {
|
||||||
printf("LIBGL: Overide version string with \"%s\" (should be in the form of \"1.x\")\n", gl_version);
|
printf("LIBGL: Overide version string with \"%s\" (should be in the form of \"1.x\")\n", env_version);
|
||||||
}
|
}
|
||||||
snprintf(gl_version, 49, "%s glshim wrapper", (env_version)?env_version:"1.5");
|
snprintf(glshim_version, 49, "%s glshim wrapper", (env_version)?env_version:"1.5");
|
||||||
|
|
||||||
char cwd[1024];
|
char cwd[1024];
|
||||||
if (getcwd(cwd, sizeof(cwd))!= NULL)
|
if (getcwd(cwd, sizeof(cwd))!= NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user