diff --git a/GL/framebuffer.c b/GL/framebuffer.c index f96fdd7..0f802a5 100644 --- a/GL/framebuffer.c +++ b/GL/framebuffer.c @@ -137,13 +137,13 @@ static inline GLubyte R565(GLshort v) { } static inline GLubyte G565(GLushort v) { - const GLuint MASK = (31 << 5); + const GLuint MASK = (63 << 5); return (v & MASK) >> 3; } static inline GLubyte B565(GLushort v) { const GLuint MASK = (31 << 0); - return (v & MASK); + return (v & MASK) << 3; } GLboolean _glCalculateAverageTexel(GLuint pvrFormat, const GLubyte* src1, const GLubyte* src2, const GLubyte* src3, const GLubyte* src4, GLubyte* t) { @@ -288,7 +288,6 @@ void APIENTRY glGenerateMipmapEXT(GLenum target) { GLuint thisHeight = (prevHeight > 1) ? prevHeight / 2 : 1; if((tex->color & PVR_TXRFMT_TWIDDLED) == PVR_TXRFMT_TWIDDLED) { - fprintf(stderr, "Format: %d\n", tex->color); _glGenerateMipmapTwiddled(tex->color, prevData, thisWidth, thisHeight, thisData); } else { _glGenerateMipmap(tex->color, prevData, thisWidth, thisHeight, thisData); diff --git a/GL/private.h b/GL/private.h index 581e1d8..7fb68b8 100644 --- a/GL/private.h +++ b/GL/private.h @@ -22,7 +22,7 @@ (((GLushort)(a > 0) << 15) | (((GLushort) r >> 3) << 10) | (((GLushort)g >> 3) << 5) | ((GLushort)b >> 3)) #define PACK_RGB565(r,g,b) \ - (((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3)) + ((((GLushort)r & 0xf8) << 8) | (((GLushort) g & 0xfc) << 3) | ((GLushort) b >> 3)) #define TRACE_ENABLED 0 #define TRACE() if(TRACE_ENABLED) {fprintf(stderr, "%s\n", __func__);} diff --git a/GL/texture.c b/GL/texture.c index cfa0d05..eb79898 100644 --- a/GL/texture.c +++ b/GL/texture.c @@ -1109,7 +1109,7 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat, /* We make sure we remove nontwiddled and add twiddled. We could always * make it twiddled when determining the format but I worry that would make the * code less flexible to change in the future */ - active->color &= ~PVR_TXRFMT_NONTWIDDLED; + active->color &= ~(1 << 26); } else { /* We should only get here if we converted twiddled data... which is never currently */ assert(conversionBuffer);