+/*
+ * MESA_FORMAT_B4G4R4X4_UNORM
+ */
+
+static void
+pack_ubyte_XRGB4444_UNORM(const GLubyte src[4], void *dst)
+{
+ GLushort *d = ((GLushort *) dst);
+ *d = PACK_COLOR_4444(255, src[RCOMP], src[GCOMP], src[BCOMP]);
+}
+
+static void
+pack_float_XRGB4444_UNORM(const GLfloat src[4], void *dst)
+{
+ GLubyte v[4];
+ _mesa_unclamped_float_rgba_to_ubyte(v, src);
+ pack_ubyte_XRGB4444_UNORM(v, dst);
+}
+
+
+/*
+ * MESA_FORMAT_B5G5R5X1_UNORM
+ */
+
+static void
+pack_ubyte_XRGB1555_UNORM(const GLubyte src[4], void *dst)
+{
+ GLushort *d = ((GLushort *) dst);
+ *d = PACK_COLOR_1555(255, src[RCOMP], src[GCOMP], src[BCOMP]);
+}
+
+static void
+pack_float_XRGB1555_UNORM(const GLfloat src[4], void *dst)
+{
+ GLubyte v[4];
+ _mesa_unclamped_float_rgba_to_ubyte(v, src);
+ pack_ubyte_XRGB1555_UNORM(v, dst);
+}
+
+
+/*
+ * MESA_FORMAT_R8G8B8X8_SNORM
+ */
+
+static void
+pack_float_XBGR8888_SNORM(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
+ GLbyte g = FLOAT_TO_BYTE(CLAMP(src[GCOMP], -1.0f, 1.0f));
+ GLbyte b = FLOAT_TO_BYTE(CLAMP(src[BCOMP], -1.0f, 1.0f));
+ *d = PACK_COLOR_8888(127, b, g, r);
+}
+
+
+/*
+ * MESA_FORMAT_R8G8B8X8_SRGB
+ */
+
+static void
+pack_float_R8G8B8X8_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+ GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+ GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+ *d = PACK_COLOR_8888(255, b, g, r);
+}
+
+
+/*
+ * MESA_FORMAT_X8B8G8R8_SRGB
+ */
+
+static void
+pack_float_X8B8G8R8_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+ GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+ GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+ *d = PACK_COLOR_8888(r, g, b, 255);
+}
+
+
+/* MESA_FORMAT_B10G10R10X2_UNORM */
+
+static void
+pack_ubyte_B10G10R10X2_UNORM(const GLubyte src[4], void *dst)
+{
+ GLuint *d = ((GLuint *) dst);
+ GLushort r = UBYTE_TO_USHORT(src[RCOMP]);
+ GLushort g = UBYTE_TO_USHORT(src[GCOMP]);
+ GLushort b = UBYTE_TO_USHORT(src[BCOMP]);
+ *d = PACK_COLOR_2101010_US(3, r, g, b);
+}
+
+static void
+pack_float_B10G10R10X2_UNORM(const GLfloat src[4], void *dst)
+{
+ GLuint *d = ((GLuint *) dst);
+ GLushort r, g, b;
+ UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+ *d = PACK_COLOR_2101010_US(3, r, g, b);
+}
+
+
+/* MESA_FORMAT_RGBX_UNORM16 */
+
+static void
+pack_ubyte_RGBX_UNORM16(const GLubyte src[4], void *dst)
+{
+ GLushort *d = ((GLushort *) dst);
+ d[0] = UBYTE_TO_USHORT(src[RCOMP]);
+ d[1] = UBYTE_TO_USHORT(src[GCOMP]);
+ d[2] = UBYTE_TO_USHORT(src[BCOMP]);
+ d[3] = 65535;
+}
+
+static void
+pack_float_RGBX_UNORM16(const GLfloat src[4], void *dst)
+{
+ GLushort *d = ((GLushort *) dst);
+ UNCLAMPED_FLOAT_TO_USHORT(d[0], src[RCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(d[1], src[GCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(d[2], src[BCOMP]);
+ d[3] = 65535;
+}
+
+
+/* MESA_FORMAT_RGBX_SNORM16 */
+
+static void
+pack_float_RGBX_SNORM16(const GLfloat src[4], void *dst)
+{
+ GLushort *d = ((GLushort *) dst);
+ UNCLAMPED_FLOAT_TO_SHORT(d[0], src[RCOMP]);
+ UNCLAMPED_FLOAT_TO_SHORT(d[1], src[GCOMP]);
+ UNCLAMPED_FLOAT_TO_SHORT(d[2], src[BCOMP]);
+ d[3] = 32767;
+}
+
+
+/* MESA_FORMAT_RGBX_FLOAT16 */
+
+static void
+pack_float_XBGR16161616_FLOAT(const GLfloat src[4], void *dst)
+{
+ GLushort *d = ((GLushort *) dst);
+ d[0] = _mesa_float_to_half(src[RCOMP]);
+ d[1] = _mesa_float_to_half(src[GCOMP]);
+ d[2] = _mesa_float_to_half(src[BCOMP]);
+ d[3] = _mesa_float_to_half(1.0);
+}
+
+/* MESA_FORMAT_RGBX_FLOAT32 */
+
+static void
+pack_float_RGBX_FLOAT32(const GLfloat src[4], void *dst)
+{
+ GLfloat *d = ((GLfloat *) dst);
+ d[0] = src[RCOMP];
+ d[1] = src[GCOMP];
+ d[2] = src[BCOMP];
+ d[3] = 1.0;
+}
+
+/* MESA_FORMAT_R10G10B10A2_UNORM */
+
+static void
+pack_ubyte_R10G10B10A2_UNORM(const GLubyte src[4], void *dst)
+{
+ GLuint *d = ((GLuint *) dst);
+ GLushort r = UBYTE_TO_USHORT(src[RCOMP]);
+ GLushort g = UBYTE_TO_USHORT(src[GCOMP]);
+ GLushort b = UBYTE_TO_USHORT(src[BCOMP]);
+ GLushort a = UBYTE_TO_USHORT(src[ACOMP]);
+ *d = PACK_COLOR_2101010_US(a, b, g, r);
+}
+
+static void
+pack_float_R10G10B10A2_UNORM(const GLfloat src[4], void *dst)
+{
+ GLuint *d = ((GLuint *) dst);
+ GLushort r, g, b, a;
+ UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]);
+ *d = PACK_COLOR_2101010_US(a, b, g, r);
+}
+
+/*
+ * MESA_FORMAT_G8R8_SNORM
+ */
+
+static void
+pack_float_G8R8_SNORM(const GLfloat src[4], void *dst)
+{
+ GLushort *d = (GLushort *) dst;
+ GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
+ GLbyte g = FLOAT_TO_BYTE(CLAMP(src[GCOMP], -1.0f, 1.0f));
+ *d = (r << 8) | (g & 0xff);
+}
+
+/*
+ * MESA_FORMAT_G16R16_SNORM
+ */
+
+static void
+pack_float_G16R16_SNORM(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLshort r = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f));
+ GLshort g = FLOAT_TO_SHORT(CLAMP(src[GCOMP], -1.0f, 1.0f));
+ *d = (r << 16) | (g & 0xffff);
+}
+
+/*
+ * MESA_FORMAT_B8G8R8X8_SRGB
+ */
+
+static void
+pack_float_B8G8R8X8_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+ GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+ GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+ *d = PACK_COLOR_8888(127, r, g, b);
+}
+
+/*
+ * MESA_FORMAT_X8R8G8B8_SRGB
+ */
+
+static void
+pack_float_X8R8G8B8_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+ GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+ GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+ *d = PACK_COLOR_8888(b, g, r, 255);
+}