diff --git a/project/jni/glshim/src/gl/array.c b/project/jni/glshim/src/gl/array.c index 7e7c52fd1..06ce7bd63 100755 --- a/project/jni/glshim/src/gl/array.c +++ b/project/jni/glshim/src/gl/array.c @@ -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); diff --git a/project/jni/glshim/src/gl/gl.h b/project/jni/glshim/src/gl/gl.h index 3011c6c5d..d258f7e5f 100755 --- a/project/jni/glshim/src/gl/gl.h +++ b/project/jni/glshim/src/gl/gl.h @@ -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; } diff --git a/project/jni/glshim/src/gl/pixel.c b/project/jni/glshim/src/gl/pixel.c index 000cf653a..659b2e549 100755 --- a/project/jni/glshim/src/gl/pixel.c +++ b/project/jni/glshim/src/gl/pixel.c @@ -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; } diff --git a/project/jni/glshim/src/gl/texgen.c b/project/jni/glshim/src/gl/texgen.c index 968431acd..f86e5ba61 100755 --- a/project/jni/glshim/src/gl/texgen.c +++ b/project/jni/glshim/src/gl/texgen.c @@ -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; iorig_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; }