[Mesa-dev] confusions about new MESA_FORMAT_xxx convention

Chia-I Wu olvaffe at gmail.com
Mon Mar 3 07:32:01 PST 2014


Hi list,

>From formats.h, we have

/* Type P formats */          /* msb <------ TEXEL BITS -----------> lsb */
                              /* ---- ---- ---- ---- ---- ---- ---- ---- */
MESA_FORMAT_A8B8G8R8_UNORM,   /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */

But in format_unpack.c, MESA_FORMAT_A8B8G8R8_UNORM is unpacked with
unpack_RGBA8888, which has

dst[i][RCOMP] = UBYTE_TO_FLOAT( (s[i] >> 24)        );
dst[i][GCOMP] = UBYTE_TO_FLOAT( (s[i] >> 16) & 0xff );
dst[i][BCOMP] = UBYTE_TO_FLOAT( (s[i] >>  8) & 0xff );
dst[i][ACOMP] = UBYTE_TO_FLOAT( (s[i]      ) & 0xff );

I am confused whether R should be at MSB, as the code does, or A
should be at MSB, as the comment says.

The format is mapped to PIPE_FORMAT_ABGR8888_UNORM, which suggests we
have the right code but wrong comment.

-- 
olv at LunarG.com


More information about the mesa-dev mailing list