gallium: add pack for A4R4G4B4

This commit is contained in:
Keith Whitwell 2008-04-29 21:05:48 +01:00
parent 7441f2e3ea
commit fbddc8097c

View file

@ -95,6 +95,12 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
*d = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 3) | (b >> 3);
}
return;
case PIPE_FORMAT_A4R4G4B4_UNORM:
{
ushort *d = (ushort *) dest;
*d = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4);
}
return;
/* XXX lots more cases to add */
default:
debug_print_format("gallium: unhandled format in util_pack_color_ub()", format);
@ -168,6 +174,12 @@ util_pack_color(const float rgba[4], enum pipe_format format, void *dest)
*d = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 3) | (b >> 3);
}
return;
case PIPE_FORMAT_A4R4G4B4_UNORM:
{
ushort *d = (ushort *) dest;
*d = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4);
}
return;
case PIPE_FORMAT_R32G32B32A32_FLOAT:
{
float *d = (float *) dest;