gallium: add pack for A1R5B5G5

This commit is contained in:
Keith Whitwell 2008-04-29 20:42:35 +01:00
parent 9bfe1a3d50
commit 7441f2e3ea

View file

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