From: Brian P. <br...@va...> - 2001-01-29 17:14:12
|
Gareth Hughes wrote: > > I'm in the process of moving the Radeon DRI driver over to Mesa's > single-copy texture mechanism. I'm using this opportunity to wrap up my > changes to texutil.c and friends, which includes full MMX assembly > optimizations for most of the interesting cases. > > I've noticed that this is special-cased: > > case MESA_R5_G6_B5: > if (srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5) { > ... > } > > However, later we see this: > > case MESA_A4_R4_G4_B4: > /* store as 16-bit texels (GR_TEXFMT_ARGB_4444) */ > if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV){ > ... > } > > And this: > > case MESA_A1_R5_G5_B5: > /* store as 16-bit texels (GR_TEXFMT_ARGB_1555) */ > if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV){ > ... > } > > In all cases, the data is memcpy'd to the final destination image. I'm > going to change the first case to this: > > case MESA_R5_G6_B5: > if (srcFormat == GL_BGR && srcType == GL_UNSIGNED_SHORT_5_6_5_REV) { > ... > } Don't remove the original case. GL_BGR / GL_UNSIGNED_SHORT_5_6_5_REV is equivalent to GL_RGB / GL_UNSIGNED_SHORT_5_6_5. In both cases, the component packing in the GLushort is RRRRRGGGGGGBBBBB. So, the condition should be: if ((srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5) || (srcFormat == GL_BGR && srcType == GL_UNSIGNED_SHORT_5_6_5_REV)) { > to fit with the rest of the cases and to make it actually useful to Mesa > drivers that use little-endian texture images. If you don't want this > to happen, scream now... -Brian |