aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/format_pack.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-02-07 10:45:44 +0100
committermarha <marha@users.sourceforge.net>2013-02-07 10:45:44 +0100
commitcbcf519f983c24f5d315b4abc194e5d147dc0ab7 (patch)
tree3f9cafad0ae5ba278eb444c4ec85f53155e7050d /mesalib/src/mesa/main/format_pack.c
parent012567f7279756f1fcc4aee30e5e72f0938fe3da (diff)
parent956c20498738c242726b5a42ed28db8572a90bed (diff)
downloadvcxsrv-cbcf519f983c24f5d315b4abc194e5d147dc0ab7.tar.gz
vcxsrv-cbcf519f983c24f5d315b4abc194e5d147dc0ab7.tar.bz2
vcxsrv-cbcf519f983c24f5d315b4abc194e5d147dc0ab7.zip
Merge remote-tracking branch 'origin/released'
* origin/released: mesa fontconfig git update 7 Feb 2013
Diffstat (limited to 'mesalib/src/mesa/main/format_pack.c')
-rw-r--r--mesalib/src/mesa/main/format_pack.c202
1 files changed, 194 insertions, 8 deletions
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c
index 051fb40b9..1a14b98b7 100644
--- a/mesalib/src/mesa/main/format_pack.c
+++ b/mesalib/src/mesa/main/format_pack.c
@@ -934,10 +934,10 @@ pack_float_R16(const GLfloat src[4], void *dst)
}
-/* MESA_FORMAT_RG1616 */
+/* MESA_FORMAT_GR1616 */
static void
-pack_ubyte_RG1616(const GLubyte src[4], void *dst)
+pack_ubyte_GR1616(const GLubyte src[4], void *dst)
{
GLuint *d = ((GLuint *) dst);
GLushort r = UBYTE_TO_USHORT(src[RCOMP]);
@@ -946,7 +946,7 @@ pack_ubyte_RG1616(const GLubyte src[4], void *dst)
}
static void
-pack_float_RG1616(const GLfloat src[4], void *dst)
+pack_float_GR1616(const GLfloat src[4], void *dst)
{
GLuint *d = ((GLuint *) dst);
GLushort r, g;
@@ -956,10 +956,10 @@ pack_float_RG1616(const GLfloat src[4], void *dst)
}
-/* MESA_FORMAT_RG1616_REV */
+/* MESA_FORMAT_RG1616 */
static void
-pack_ubyte_RG1616_REV(const GLubyte src[4], void *dst)
+pack_ubyte_RG1616(const GLubyte src[4], void *dst)
{
GLuint *d = ((GLuint *) dst);
GLushort r = UBYTE_TO_USHORT(src[RCOMP]);
@@ -969,7 +969,7 @@ pack_ubyte_RG1616_REV(const GLubyte src[4], void *dst)
static void
-pack_float_RG1616_REV(const GLfloat src[4], void *dst)
+pack_float_RG1616(const GLfloat src[4], void *dst)
{
GLuint *d = ((GLuint *) dst);
GLushort r, g;
@@ -1669,6 +1669,160 @@ pack_float_R11_G11_B10_FLOAT(const GLfloat src[4], void *dst)
}
+/*
+ * MESA_FORMAT_XRGB4444_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_XRGB1555_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_XBGR8888_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_XBGR8888_SRGB
+ */
+
+static void
+pack_float_XBGR8888_SRGB(const GLfloat src[4], void *dst)
+{
+ GLuint *d = (GLuint *) dst;
+ GLubyte r = linear_float_to_srgb_ubyte(src[RCOMP]);
+ GLubyte g = linear_float_to_srgb_ubyte(src[GCOMP]);
+ GLubyte b = linear_float_to_srgb_ubyte(src[BCOMP]);
+ *d = PACK_COLOR_8888(127, b, g, r);
+}
+
+
+/* MESA_FORMAT_XRGB2101010_UNORM */
+
+static void
+pack_ubyte_XRGB2101010_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_XRGB2101010_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_XBGR16161616_UNORM */
+
+static void
+pack_ubyte_XBGR16161616_UNORM(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_XBGR16161616_UNORM(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_XBGR16161616_SNORM */
+
+static void
+pack_float_XBGR16161616_SNORM(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_XBGR16161616_FLOAT */
+
+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_XBGR32323232_FLOAT */
+
+static void
+pack_float_XBGR32323232_FLOAT(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;
+}
+
/**
* Return a function that can pack a GLubyte rgba[4] color.
@@ -1719,8 +1873,8 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format)
table[MESA_FORMAT_GR88] = pack_ubyte_GR88;
table[MESA_FORMAT_RG88] = pack_ubyte_RG88;
table[MESA_FORMAT_R16] = pack_ubyte_R16;
+ table[MESA_FORMAT_GR1616] = pack_ubyte_GR1616;
table[MESA_FORMAT_RG1616] = pack_ubyte_RG1616;
- table[MESA_FORMAT_RG1616_REV] = pack_ubyte_RG1616_REV;
table[MESA_FORMAT_ARGB2101010] = pack_ubyte_ARGB2101010;
table[MESA_FORMAT_ABGR2101010_UINT] = pack_ubyte_ABGR2101010_UINT;
@@ -1807,6 +1961,22 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format)
table[MESA_FORMAT_RGB9_E5_FLOAT] = pack_ubyte_RGB9_E5_FLOAT;
table[MESA_FORMAT_R11_G11_B10_FLOAT] = pack_ubyte_R11_G11_B10_FLOAT;
+ table[MESA_FORMAT_XRGB4444_UNORM] = pack_ubyte_XRGB4444_UNORM;
+ table[MESA_FORMAT_XRGB1555_UNORM] = pack_ubyte_XRGB1555_UNORM;
+ table[MESA_FORMAT_XBGR8888_SNORM] = NULL;
+ table[MESA_FORMAT_XBGR8888_SRGB] = NULL;
+ table[MESA_FORMAT_XBGR8888_UINT] = NULL;
+ table[MESA_FORMAT_XBGR8888_SINT] = NULL;
+ table[MESA_FORMAT_XRGB2101010_UNORM] = pack_ubyte_XRGB2101010_UNORM;
+ table[MESA_FORMAT_XBGR16161616_UNORM] = pack_ubyte_XBGR16161616_UNORM;
+ table[MESA_FORMAT_XBGR16161616_SNORM] = NULL;
+ table[MESA_FORMAT_XBGR16161616_FLOAT] = NULL;
+ table[MESA_FORMAT_XBGR16161616_UINT] = NULL;
+ table[MESA_FORMAT_XBGR16161616_SINT] = NULL;
+ table[MESA_FORMAT_XBGR32323232_FLOAT] = NULL;
+ table[MESA_FORMAT_XBGR32323232_UINT] = NULL;
+ table[MESA_FORMAT_XBGR32323232_SINT] = NULL;
+
initialized = GL_TRUE;
}
@@ -1865,8 +2035,8 @@ _mesa_get_pack_float_rgba_function(gl_format format)
table[MESA_FORMAT_GR88] = pack_float_GR88;
table[MESA_FORMAT_RG88] = pack_float_RG88;
table[MESA_FORMAT_R16] = pack_float_R16;
+ table[MESA_FORMAT_GR1616] = pack_float_GR1616;
table[MESA_FORMAT_RG1616] = pack_float_RG1616;
- table[MESA_FORMAT_RG1616_REV] = pack_float_RG1616_REV;
table[MESA_FORMAT_ARGB2101010] = pack_float_ARGB2101010;
table[MESA_FORMAT_ABGR2101010_UINT] = pack_float_ABGR2101010_UINT;
@@ -1949,6 +2119,22 @@ _mesa_get_pack_float_rgba_function(gl_format format)
table[MESA_FORMAT_RGB9_E5_FLOAT] = pack_float_RGB9_E5_FLOAT;
table[MESA_FORMAT_R11_G11_B10_FLOAT] = pack_float_R11_G11_B10_FLOAT;
+ table[MESA_FORMAT_XRGB4444_UNORM] = pack_float_XRGB4444_UNORM;
+ table[MESA_FORMAT_XRGB1555_UNORM] = pack_float_XRGB1555_UNORM;
+ table[MESA_FORMAT_XBGR8888_SNORM] = pack_float_XBGR8888_SNORM;
+ table[MESA_FORMAT_XBGR8888_SRGB] = pack_float_XBGR8888_SRGB;
+ table[MESA_FORMAT_XBGR8888_UINT] = NULL;
+ table[MESA_FORMAT_XBGR8888_SINT] = NULL;
+ table[MESA_FORMAT_XRGB2101010_UNORM] = pack_float_XRGB2101010_UNORM;
+ table[MESA_FORMAT_XBGR16161616_UNORM] = pack_float_XBGR16161616_UNORM;
+ table[MESA_FORMAT_XBGR16161616_SNORM] = pack_float_XBGR16161616_SNORM;
+ table[MESA_FORMAT_XBGR16161616_FLOAT] = pack_float_XBGR16161616_FLOAT;
+ table[MESA_FORMAT_XBGR16161616_UINT] = NULL;
+ table[MESA_FORMAT_XBGR16161616_SINT] = NULL;
+ table[MESA_FORMAT_XBGR32323232_FLOAT] = pack_float_XBGR32323232_FLOAT;
+ table[MESA_FORMAT_XBGR32323232_UINT] = NULL;
+ table[MESA_FORMAT_XBGR32323232_SINT] = NULL;
+
initialized = GL_TRUE;
}