As with B5G6R5, these have been left broken with comments saying they are.
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
pack_ubyte_B5G5R5A1_UNORM(v, dst);
}
-
-/* MESA_FORMAT_A1R5G5B5_UNORM
- * Warning: these functions do not match the current Mesa definition
- * of MESA_FORMAT_A1R5G5B5_UNORM.
- */
-
static void
pack_ubyte_A1R5G5B5_UNORM(const GLubyte src[4], void *dst)
{
GLushort *d = ((GLushort *) dst), tmp;
- tmp = PACK_COLOR_1555(src[ACOMP], src[RCOMP], src[GCOMP], src[BCOMP]);
+ tmp = PACK_COLOR_5551(src[BCOMP], src[GCOMP], src[RCOMP], src[ACOMP]);
*d = (tmp >> 8) | (tmp << 8);
}
static void
unpack_ubyte_A1R5G5B5_UNORM(const void *src, GLubyte dst[][4], GLuint n)
{
- /* Warning: this function does not match the current Mesa definition
- * of MESA_FORMAT_A1R5G5B5_UNORM.
- */
const GLushort *s = ((const GLushort *) src);
GLuint i;
for (i = 0; i < n; i++) {
GLushort tmp = (s[i] << 8) | (s[i] >> 8); /* byteswap */
- dst[i][RCOMP] = EXPAND_5_8((tmp >> 10) & 0x1f);
- dst[i][GCOMP] = EXPAND_5_8((tmp >> 5) & 0x1f);
- dst[i][BCOMP] = EXPAND_5_8((tmp >> 0) & 0x1f);
- dst[i][ACOMP] = EXPAND_1_8((tmp >> 15) & 0x01);
+ dst[i][RCOMP] = EXPAND_5_8((tmp >> 1) & 0x1f);
+ dst[i][GCOMP] = EXPAND_5_8((tmp >> 6) & 0x1f);
+ dst[i][BCOMP] = EXPAND_5_8((tmp >> 11) & 0x1f);
+ dst[i][ACOMP] = EXPAND_1_8((tmp ) & 0x01);
}
}
!swapBytes;
case MESA_FORMAT_A1R5G5B5_UNORM:
- return GL_FALSE;
+ return format == GL_BGRA && type == GL_UNSIGNED_SHORT_5_5_5_1 &&
+ !swapBytes;
case MESA_FORMAT_L4A4_UNORM:
return GL_FALSE;
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) );
- texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 );
+ texel[RCOMP] = ((s >> 1) & 0x1f) * (1.0F / 31.0F);
+ texel[GCOMP] = ((s >> 6) & 0x1f) * (1.0F / 31.0F);
+ texel[BCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
+ texel[ACOMP] = ((s ) & 0x01) * 1.0F;
}