Fix twiddled mipmap generation

This commit is contained in:
Luke Benstead 2019-09-25 13:45:08 +01:00
parent 2e1e28ce51
commit 08ba39f6d1
3 changed files with 4 additions and 5 deletions

View File

@ -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);

View File

@ -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__);}

View File

@ -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);