glshim updated, added latest changes by ptitSeb
This commit is contained in:
@@ -273,7 +273,7 @@ GLvoid *copy_gl_pointer_tex(pointer_state_t *ptr, GLsizei width, GLsizei skip, G
|
||||
GLfloat *gl_pointer_index(pointer_state_t *p, GLint index) {
|
||||
static GLfloat buf[4];
|
||||
GLsizei size = gl_sizeof(p->type);
|
||||
GLsizei stride = (p->stride ? p->stride : size) * p->size;
|
||||
GLsizei stride = p->stride ? p->stride : (size * p->size);
|
||||
uintptr_t ptr = (uintptr_t)(p->pointer) + (stride * index)
|
||||
+ (uintptr_t)((glstate.vao->vertex)?glstate.vao->vertex->data:0);
|
||||
|
||||
|
||||
@@ -169,6 +169,8 @@ typedef EGLSurface (*eglCreateStreamProducerSurfaceKHR_PTR)(EGLDisplay dpy, EGLC
|
||||
}
|
||||
|
||||
//printf("list:%i, " #nam "\n", state.list.name);
|
||||
// cannot include "debug.h" as it include "gl.h"...
|
||||
const char* PrintEnum(GLenum what);
|
||||
|
||||
#define PUSH_IF_COMPILING(name) PUSH_IF_COMPILING_EXT(name, name##_ARG_NAMES)
|
||||
|
||||
@@ -208,7 +210,7 @@ static const GLsizei gl_sizeof(GLenum type) {
|
||||
return 1;
|
||||
}
|
||||
// formats
|
||||
printf("libGL: Unsupported pixel data type: 0x%x\n", type);
|
||||
printf("libGL: Unsupported pixel data type: %s\n", PrintEnum(type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -226,7 +228,7 @@ static const GLuint gl_max_value(GLenum type) {
|
||||
case GL_INT: return 2147483647;
|
||||
case GL_UNSIGNED_INT: return 4294967295;
|
||||
}
|
||||
printf("libGL: unknown gl max value type: 0x%x\n", type);
|
||||
printf("libGL: unknown gl max value type: %s\n", PrintEnum(type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -275,7 +277,7 @@ static const GLsizei pixel_sizeof(GLenum format, GLenum type) {
|
||||
width = 4;
|
||||
break;
|
||||
default:
|
||||
printf("libGL: unsupported pixel format %x\n", format);
|
||||
printf("libGL: unsupported pixel format %s\n", PrintEnum(format));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ static const colorlayout_t *get_color_map(GLenum format) {
|
||||
map(GL_LUMINANCE, 0, 0, 0, -1);
|
||||
map(GL_ALPHA,-1, -1, -1, 0);
|
||||
default:
|
||||
printf("libGL: unknown pixel format %i\n", format);
|
||||
printf("libGL: unknown pixel format %s\n", PrintEnum(format));
|
||||
break;
|
||||
}
|
||||
static colorlayout_t null = {0};
|
||||
@@ -126,7 +126,7 @@ bool remap_pixel(const GLvoid *src, GLvoid *dst,
|
||||
)
|
||||
default:
|
||||
// TODO: add glSetError?
|
||||
printf("libGL: Unsupported source data type: %04X\n", src_type);
|
||||
printf("libGL: Unsupported source data type: %s\n", PrintEnum(src_type));
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ bool remap_pixel(const GLvoid *src, GLvoid *dst,
|
||||
(((GLushort)(color[3] * 15.0) & 0x0f));
|
||||
)
|
||||
default:
|
||||
printf("libGL: Unsupported target data type: %04X\n", dst_type);
|
||||
printf("libGL: Unsupported target data type: %s\n", PrintEnum(dst_type));
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -279,7 +279,7 @@ bool transform_pixel(const GLvoid *src, GLvoid *dst,
|
||||
)
|
||||
default:
|
||||
// TODO: add glSetError?
|
||||
printf("libGL: transform_pixel: Unsupported source data type: %04X\n", src_type);
|
||||
printf("libGL: transform_pixel: Unsupported source data type: %s\n", PrintEnum(src_type));
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -327,7 +327,7 @@ bool transform_pixel(const GLvoid *src, GLvoid *dst,
|
||||
((GLushort)(color[0] * 15.0f) & 0x0f);
|
||||
)
|
||||
default:
|
||||
printf("libGL: Unsupported target data type: %04X\n", src_type);
|
||||
printf("libGL: Unsupported target data type: %s\n", PrintEnum(src_type));
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -505,7 +505,7 @@ bool half_pixel(const GLvoid *src0, const GLvoid *src1,
|
||||
((GLushort)(color[3] * 15.0f) & 0x0f);
|
||||
)
|
||||
default:
|
||||
printf("libGL: half_pixel: Unsupported target data type: %04X\n", src_type);
|
||||
printf("libGL: half_pixel: Unsupported target data type: %s\n", PrintEnum(src_type));
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -611,7 +611,7 @@ bool quarter_pixel(const GLvoid *src[16],
|
||||
)
|
||||
default:
|
||||
// TODO: add glSetError?
|
||||
printf("libGL: quarter_pixel: Unsupported source data type: %04X\n", src_type);
|
||||
printf("libGL: quarter_pixel: Unsupported source data type: %s\n", PrintEnum(src_type));
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -647,7 +647,7 @@ bool quarter_pixel(const GLvoid *src[16],
|
||||
((GLushort)(color[3] * 15.0) & 0x0f);
|
||||
)
|
||||
default:
|
||||
printf("libGL: quarter_pixel Unsupported target data type: %04X\n", src_type);
|
||||
printf("libGL: quarter_pixel Unsupported target data type: %s\n", PrintEnum(src_type));
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ void gen_tex_coords(GLfloat *verts, GLfloat *norm, GLfloat **coords, GLint count
|
||||
tex_coord_loop(verts, norm, *coords, (indices)?ilen:count, glstate.texgen[texture].S, glstate.texgen[texture].S_O, glstate.texgen[texture].S_E, indices);
|
||||
if (glstate.enable.texgen_t[texture])
|
||||
tex_coord_loop(verts, norm, *coords+1, (indices)?ilen:count, glstate.texgen[texture].T, glstate.texgen[texture].T_O, glstate.texgen[texture].T_E, indices);
|
||||
for (int i=0; i<count; i++) {
|
||||
for (int i=0; i<((indices)?ilen:count); i++) {
|
||||
GLushort k = indices?indices[i]:i;
|
||||
(*coords)[k*4+2] = 0.0f;
|
||||
(*coords)[k*4+3] = 1.0f;
|
||||
@@ -447,4 +447,4 @@ void glGetTexGenfv(GLenum coord,GLenum pname,GLfloat *params) __attribute__((ali
|
||||
void glLoadTransposeMatrixf(const GLfloat *m) __attribute__((alias("glshim_glLoadTransposeMatrixf")));
|
||||
void glLoadTransposeMatrixd(const GLdouble *m) __attribute__((alias("glshim_glLoadTransposeMatrixd")));
|
||||
void glMultTransposeMatrixd(const GLdouble *m) __attribute__((alias("glshim_glMultTransposeMatrixd")));
|
||||
void glMultTransposeMatrixf(const GLfloat *m) __attribute__((alias("glshim_glMultTransposeMatrixf")));
|
||||
void glMultTransposeMatrixf(const GLfloat *m) __attribute__((alias("glshim_glMultTransposeMatrixf")));
|
||||
|
||||
@@ -189,6 +189,12 @@ static void *swizzle_texture(GLsizei width, GLsizei height,
|
||||
convert = true;
|
||||
break;
|
||||
}
|
||||
// compressed format are not handled here, so mask them....
|
||||
if (intermediaryformat==GL_COMPRESSED_RGB) intermediaryformat=GL_RGB;
|
||||
if (intermediaryformat==GL_COMPRESSED_RGBA) intermediaryformat=GL_RGBA;
|
||||
if (internalformat==GL_COMPRESSED_RGB) internalformat=GL_RGB;
|
||||
if (internalformat==GL_COMPRESSED_RGBA) internalformat=GL_RGBA;
|
||||
|
||||
if(*format != intermediaryformat || intermediaryformat!=internalformat) {
|
||||
dest_format = intermediaryformat;
|
||||
dest_type = GL_UNSIGNED_BYTE;
|
||||
@@ -302,12 +308,15 @@ GLenum swizzle_internalformat(GLenum *internalformat) {
|
||||
break;
|
||||
// compressed format...
|
||||
case GL_COMPRESSED_ALPHA:
|
||||
ret = GL_ALPHA;
|
||||
sret = GL_ALPHA;
|
||||
break;
|
||||
case GL_COMPRESSED_LUMINANCE:
|
||||
ret = GL_LUMINANCE;
|
||||
sret = GL_LUMINANCE;
|
||||
break;
|
||||
case GL_COMPRESSED_LUMINANCE_ALPHA:
|
||||
ret = GL_LUMINANCE_ALPHA;
|
||||
if (nolumalpha)
|
||||
sret = GL_RGBA;
|
||||
else
|
||||
@@ -810,6 +819,15 @@ void glshim_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yof
|
||||
dst += width * pixelSize;
|
||||
}
|
||||
}
|
||||
|
||||
// compressed format are not handled here, so mask them....
|
||||
GLenum orig_internal = bound->orig_internal;
|
||||
GLenum internalformat = bound->internalformat;
|
||||
if (orig_internal==GL_COMPRESSED_RGB) orig_internal=GL_RGB;
|
||||
if (orig_internal==GL_COMPRESSED_RGBA) orig_internal=GL_RGBA;
|
||||
if (internalformat==GL_COMPRESSED_RGB) internalformat=GL_RGB;
|
||||
if (internalformat==GL_COMPRESSED_RGBA) internalformat=GL_RGBA;
|
||||
|
||||
|
||||
GLvoid *old = pixels;
|
||||
#ifdef TEXSTREAM
|
||||
@@ -828,19 +846,19 @@ void glshim_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yof
|
||||
#endif
|
||||
{
|
||||
//pixels = (GLvoid *)swizzle_texture(width, height, &format, &type, old);
|
||||
if (!pixel_convert(old, &pixels, width, height, format, type, bound->orig_internal, bound->type, 0)) {
|
||||
if (!pixel_convert(old, &pixels, width, height, format, type, orig_internal, bound->type, 0)) {
|
||||
printf("LIBGL: Error in pixel_convert while glTexSubImage2D\n");
|
||||
} else {
|
||||
if(bound->orig_internal!=bound->internalformat) {
|
||||
if(orig_internal!=internalformat) {
|
||||
GLvoid* pix2 = pixels;
|
||||
if (!pixel_convert(pixels, &pix2, width, height, bound->orig_internal, bound->type, bound->internalformat, bound->type, 0)) {
|
||||
if (!pixel_convert(pixels, &pix2, width, height, orig_internal, bound->type, internalformat, bound->type, 0)) {
|
||||
printf("LIBGL: Error in pixel_convert while glTexSubImage2D\n");
|
||||
}
|
||||
if (pixels != pix2 && pixels != old)
|
||||
free(pixels);
|
||||
pixels = pix2;
|
||||
}
|
||||
format = bound->internalformat;
|
||||
format = internalformat;
|
||||
type = bound->type;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user