aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/format_unpack.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-17 16:37:26 +0100
committermarha <marha@users.sourceforge.net>2011-11-17 16:37:26 +0100
commitd41bc08d1ae8c4784c09d8977816c0fadab1ba52 (patch)
tree4dc3081a9af0316eeee02356a44fcc2419e1b15e /mesalib/src/mesa/main/format_unpack.c
parent156e37d3879b316329e3e05579414031da2647e2 (diff)
downloadvcxsrv-d41bc08d1ae8c4784c09d8977816c0fadab1ba52.tar.gz
vcxsrv-d41bc08d1ae8c4784c09d8977816c0fadab1ba52.tar.bz2
vcxsrv-d41bc08d1ae8c4784c09d8977816c0fadab1ba52.zip
xserver mesa git update 17 nov 2011
Diffstat (limited to 'mesalib/src/mesa/main/format_unpack.c')
-rw-r--r--mesalib/src/mesa/main/format_unpack.c1530
1 files changed, 900 insertions, 630 deletions
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 525bbcb1c..6e2ce7a05 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -57,1049 +57,1335 @@ nonlinear_to_linear(GLubyte cs8)
}
-typedef void (*unpack_rgba_func)(const void *src, GLfloat dst[4]);
+typedef void (*unpack_rgba_func)(const void *src, GLfloat dst[][4], GLuint n);
static void
-unpack_RGBA8888(const void *src, GLfloat dst[4])
+unpack_RGBA8888(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
- dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- dst[BCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- dst[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ 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 );
+ }
}
static void
-unpack_RGBA8888_REV(const void *src, GLfloat dst[4])
+unpack_RGBA8888_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
- dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- dst[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- dst[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( (s[i] ) & 0xff );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( (s[i] >> 16) & 0xff );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( (s[i] >> 24) );
+ }
}
static void
-unpack_ARGB8888(const void *src, GLfloat dst[4])
+unpack_ARGB8888(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- dst[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
- dst[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( (s[i] >> 16) & 0xff );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( (s[i] ) & 0xff );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( (s[i] >> 24) );
+ }
}
static void
-unpack_ARGB8888_REV(const void *src, GLfloat dst[4])
+unpack_ARGB8888_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- dst[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
- dst[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( (s[i] >> 8) & 0xff );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( (s[i] >> 16) & 0xff );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( (s[i] >> 24) );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( (s[i] ) & 0xff );
+ }
}
static void
-unpack_XRGB8888(const void *src, GLfloat dst[4])
+unpack_XRGB8888(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- dst[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
- dst[ACOMP] = 1.0f;
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( (s[i] >> 16) & 0xff );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( (s[i] ) & 0xff );
+ dst[i][ACOMP] = 1.0f;
+ }
}
static void
-unpack_XRGB8888_REV(const void *src, GLfloat dst[4])
+unpack_XRGB8888_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
- dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
- dst[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
- dst[ACOMP] = 1.0f;
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( (s[i] >> 8) & 0xff );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( (s[i] >> 16) & 0xff );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( (s[i] >> 24) );
+ dst[i][ACOMP] = 1.0f;
+ }
}
static void
-unpack_RGB888(const void *src, GLfloat dst[4])
+unpack_RGB888(const void *src, GLfloat dst[][4], GLuint n)
{
const GLubyte *s = (const GLubyte *) src;
- dst[RCOMP] = UBYTE_TO_FLOAT( s[2] );
- dst[GCOMP] = UBYTE_TO_FLOAT( s[1] );
- dst[BCOMP] = UBYTE_TO_FLOAT( s[0] );
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( s[i*3+2] );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( s[i*3+1] );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( s[i*3+0] );
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_BGR888(const void *src, GLfloat dst[4])
+unpack_BGR888(const void *src, GLfloat dst[][4], GLuint n)
{
const GLubyte *s = (const GLubyte *) src;
- dst[RCOMP] = UBYTE_TO_FLOAT( s[0] );
- dst[GCOMP] = UBYTE_TO_FLOAT( s[1] );
- dst[BCOMP] = UBYTE_TO_FLOAT( s[2] );
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( s[i*3+0] );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( s[i*3+1] );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( s[i*3+2] );
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_RGB565(const void *src, GLfloat dst[4])
+unpack_RGB565(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
- dst[GCOMP] = ((s >> 5 ) & 0x3f) * (1.0F / 63.0F);
- dst[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F);
- dst[ACOMP] = 1.0F;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = ((s[i] >> 11) & 0x1f) * (1.0F / 31.0F);
+ dst[i][GCOMP] = ((s[i] >> 5 ) & 0x3f) * (1.0F / 63.0F);
+ dst[i][BCOMP] = ((s[i] ) & 0x1f) * (1.0F / 31.0F);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_RGB565_REV(const void *src, GLfloat dst[4])
+unpack_RGB565_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- GLushort s = *((const GLushort *) src);
- s = (s >> 8) | (s << 8); /* byte swap */
- dst[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) );
- dst[GCOMP] = UBYTE_TO_FLOAT( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) );
- dst[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) );
- dst[ACOMP] = 1.0F;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLuint t = (s[i] >> 8) | (s[i] << 8); /* byte swap */
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( ((t >> 8) & 0xf8) | ((t >> 13) & 0x7) );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( ((t >> 3) & 0xfc) | ((t >> 9) & 0x3) );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( ((t << 3) & 0xf8) | ((t >> 2) & 0x7) );
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_ARGB4444(const void *src, GLfloat dst[4])
+unpack_ARGB4444(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F);
- dst[GCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
- dst[BCOMP] = ((s ) & 0xf) * (1.0F / 15.0F);
- dst[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = ((s[i] >> 8) & 0xf) * (1.0F / 15.0F);
+ dst[i][GCOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F);
+ dst[i][BCOMP] = ((s[i] ) & 0xf) * (1.0F / 15.0F);
+ dst[i][ACOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
+ }
}
static void
-unpack_ARGB4444_REV(const void *src, GLfloat dst[4])
+unpack_ARGB4444_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = ((s ) & 0xf) * (1.0F / 15.0F);
- dst[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
- dst[BCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F);
- dst[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = ((s[i] ) & 0xf) * (1.0F / 15.0F);
+ dst[i][GCOMP] = ((s[i] >> 12) & 0xf) * (1.0F / 15.0F);
+ dst[i][BCOMP] = ((s[i] >> 8) & 0xf) * (1.0F / 15.0F);
+ dst[i][ACOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F);
+ }
}
static void
-unpack_RGBA5551(const void *src, GLfloat dst[4])
+unpack_RGBA5551(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
- dst[GCOMP] = ((s >> 6) & 0x1f) * (1.0F / 31.0F);
- dst[BCOMP] = ((s >> 1) & 0x1f) * (1.0F / 31.0F);
- dst[ACOMP] = ((s ) & 0x01) * 1.0F;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = ((s[i] >> 11) & 0x1f) * (1.0F / 31.0F);
+ dst[i][GCOMP] = ((s[i] >> 6) & 0x1f) * (1.0F / 31.0F);
+ dst[i][BCOMP] = ((s[i] >> 1) & 0x1f) * (1.0F / 31.0F);
+ dst[i][ACOMP] = ((s[i] ) & 0x01) * 1.0F;
+ }
}
static void
-unpack_ARGB1555(const void *src, GLfloat dst[4])
+unpack_ARGB1555(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F);
- dst[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F);
- dst[BCOMP] = ((s >> 0) & 0x1f) * (1.0F / 31.0F);
- dst[ACOMP] = ((s >> 15) & 0x01) * 1.0F;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = ((s[i] >> 10) & 0x1f) * (1.0F / 31.0F);
+ dst[i][GCOMP] = ((s[i] >> 5) & 0x1f) * (1.0F / 31.0F);
+ dst[i][BCOMP] = ((s[i] >> 0) & 0x1f) * (1.0F / 31.0F);
+ dst[i][ACOMP] = ((s[i] >> 15) & 0x01) * 1.0F;
+ }
}
static void
-unpack_ARGB1555_REV(const void *src, GLfloat dst[4])
+unpack_ARGB1555_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) );
- dst[GCOMP] = UBYTE_TO_FLOAT( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) );
- dst[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) );
- dst[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 );
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( ((s[i] >> 7) & 0xf8) | ((s[i] >> 12) & 0x7) );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( ((s[i] >> 2) & 0xf8) | ((s[i] >> 7) & 0x7) );
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( ((s[i] << 3) & 0xf8) | ((s[i] >> 2) & 0x7) );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( ((s[i] >> 15) & 0x01) * 255 );
+ }
}
static void
-unpack_AL44(const void *src, GLfloat dst[4])
+unpack_AL44(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLubyte s = *((const GLubyte *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = (s & 0xf) * (1.0F / 15.0F);
- dst[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = (s[i] & 0xf) * (1.0F / 15.0F);
+ dst[i][ACOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F);
+ }
}
static void
-unpack_AL88(const void *src, GLfloat dst[4])
+unpack_AL88(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
- dst[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( s[i] & 0xff );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 8 );
+ }
}
static void
-unpack_AL88_REV(const void *src, GLfloat dst[4])
+unpack_AL88_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
- dst[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = UBYTE_TO_FLOAT( s[i] >> 8 );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] & 0xff );
+ }
}
static void
-unpack_AL1616(const void *src, GLfloat dst[4])
+unpack_AL1616(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = USHORT_TO_FLOAT( s & 0xffff );
- dst[ACOMP] = USHORT_TO_FLOAT( s >> 16 );
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = USHORT_TO_FLOAT( s[i] & 0xffff );
+ dst[i][ACOMP] = USHORT_TO_FLOAT( s[i] >> 16 );
+ }
}
static void
-unpack_AL1616_REV(const void *src, GLfloat dst[4])
+unpack_AL1616_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = USHORT_TO_FLOAT( s >> 16 );
- dst[ACOMP] = USHORT_TO_FLOAT( s & 0xffff );
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = USHORT_TO_FLOAT( s[i] >> 16 );
+ dst[i][ACOMP] = USHORT_TO_FLOAT( s[i] & 0xffff );
+ }
}
static void
-unpack_RGB332(const void *src, GLfloat dst[4])
+unpack_RGB332(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLubyte s = *((const GLubyte *) src);
- dst[RCOMP] = ((s >> 5) & 0x7) * (1.0F / 7.0F);
- dst[GCOMP] = ((s >> 2) & 0x7) * (1.0F / 7.0F);
- dst[BCOMP] = ((s ) & 0x3) * (1.0F / 3.0F);
- dst[ACOMP] = 1.0F;
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = ((s[i] >> 5) & 0x7) * (1.0F / 7.0F);
+ dst[i][GCOMP] = ((s[i] >> 2) & 0x7) * (1.0F / 7.0F);
+ dst[i][BCOMP] = ((s[i] ) & 0x3) * (1.0F / 3.0F);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_A8(const void *src, GLfloat dst[4])
+unpack_A8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLubyte s = *((const GLubyte *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = UBYTE_TO_FLOAT(s);
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i]);
+ }
}
static void
-unpack_A16(const void *src, GLfloat dst[4])
+unpack_A16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = USHORT_TO_FLOAT(s);
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = USHORT_TO_FLOAT(s[i]);
+ }
}
static void
-unpack_L8(const void *src, GLfloat dst[4])
+unpack_L8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLubyte s = *((const GLubyte *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = UBYTE_TO_FLOAT(s);
- dst[ACOMP] = 1.0F;
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = UBYTE_TO_FLOAT(s[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_L16(const void *src, GLfloat dst[4])
+unpack_L16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = USHORT_TO_FLOAT(s);
- dst[ACOMP] = 1.0F;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = USHORT_TO_FLOAT(s[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_I8(const void *src, GLfloat dst[4])
+unpack_I8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLubyte s = *((const GLubyte *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] =
- dst[ACOMP] = UBYTE_TO_FLOAT(s);
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i]);
+ }
}
static void
-unpack_I16(const void *src, GLfloat dst[4])
+unpack_I16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] =
- dst[ACOMP] = USHORT_TO_FLOAT(s);
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = USHORT_TO_FLOAT(s[i]);
+ }
}
static void
-unpack_YCBCR(const void *src, GLfloat dst[4])
+unpack_YCBCR(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint i = 0;
- const GLushort *src0 = (const GLushort *) src;
- const GLushort *src1 = src0 + 1; /* odd */
- const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */
- const GLubyte cb = *src0 & 0xff; /* chroma U */
- const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
- const GLubyte cr = *src1 & 0xff; /* chroma V */
- const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */
- GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
- GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
- GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
- r *= (1.0F / 255.0F);
- g *= (1.0F / 255.0F);
- b *= (1.0F / 255.0F);
- dst[RCOMP] = CLAMP(r, 0.0F, 1.0F);
- dst[GCOMP] = CLAMP(g, 0.0F, 1.0F);
- dst[BCOMP] = CLAMP(b, 0.0F, 1.0F);
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ const GLushort *src0 = ((const GLushort *) src) + i * 2; /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */
+ const GLubyte cb = *src0 & 0xff; /* chroma U */
+ const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
+ const GLubyte cr = *src1 & 0xff; /* chroma V */
+ const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */
+ GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
+ GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
+ GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
+ r *= (1.0F / 255.0F);
+ g *= (1.0F / 255.0F);
+ b *= (1.0F / 255.0F);
+ dst[i][RCOMP] = CLAMP(r, 0.0F, 1.0F);
+ dst[i][GCOMP] = CLAMP(g, 0.0F, 1.0F);
+ dst[i][BCOMP] = CLAMP(b, 0.0F, 1.0F);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_YCBCR_REV(const void *src, GLfloat dst[4])
+unpack_YCBCR_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint i = 0;
- const GLushort *src0 = (const GLushort *) src;
- const GLushort *src1 = src0 + 1; /* odd */
- const GLubyte y0 = *src0 & 0xff; /* luminance */
- const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */
- const GLubyte y1 = *src1 & 0xff; /* luminance */
- const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
- const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */
- GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
- GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
- GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
- r *= (1.0F / 255.0F);
- g *= (1.0F / 255.0F);
- b *= (1.0F / 255.0F);
- dst[RCOMP] = CLAMP(r, 0.0F, 1.0F);
- dst[GCOMP] = CLAMP(g, 0.0F, 1.0F);
- dst[BCOMP] = CLAMP(b, 0.0F, 1.0F);
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ const GLushort *src0 = ((const GLushort *) src) + i * 2; /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = *src0 & 0xff; /* luminance */
+ const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */
+ const GLubyte y1 = *src1 & 0xff; /* luminance */
+ const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
+ const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */
+ GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128);
+ GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128);
+ GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128);
+ r *= (1.0F / 255.0F);
+ g *= (1.0F / 255.0F);
+ b *= (1.0F / 255.0F);
+ dst[i][RCOMP] = CLAMP(r, 0.0F, 1.0F);
+ dst[i][GCOMP] = CLAMP(g, 0.0F, 1.0F);
+ dst[i][BCOMP] = CLAMP(b, 0.0F, 1.0F);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_R8(const void *src, GLfloat dst[4])
+unpack_R8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLubyte s = *((const GLubyte *) src);
- dst[0] = UBYTE_TO_FLOAT(s);
- dst[1] = dst[2] = 0.0F;
- dst[3] = 1.0F;
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] = UBYTE_TO_FLOAT(s[i]);
+ dst[i][1] =
+ dst[i][2] = 0.0F;
+ dst[i][3] = 1.0F;
+ }
}
static void
-unpack_RG88(const void *src, GLfloat dst[4])
+unpack_RG88(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
- dst[GCOMP] = UBYTE_TO_FLOAT( s >> 8 );
- dst[BCOMP] = 0.0;
- dst[ACOMP] = 1.0;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( s[i] & 0xff );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( s[i] >> 8 );
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
}
static void
-unpack_RG88_REV(const void *src, GLfloat dst[4])
+unpack_RG88_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
- dst[GCOMP] = UBYTE_TO_FLOAT( s >> 8 );
- dst[BCOMP] = 0.0;
- dst[ACOMP] = 1.0;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = UBYTE_TO_FLOAT( s[i] & 0xff );
+ dst[i][GCOMP] = UBYTE_TO_FLOAT( s[i] >> 8 );
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
}
static void
-unpack_R16(const void *src, GLfloat dst[4])
+unpack_R16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = USHORT_TO_FLOAT(s);
- dst[GCOMP] = 0.0;
- dst[BCOMP] = 0.0;
- dst[ACOMP] = 1.0;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = USHORT_TO_FLOAT(s[i]);
+ dst[i][GCOMP] = 0.0;
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
}
static void
-unpack_RG1616(const void *src, GLfloat dst[4])
+unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = USHORT_TO_FLOAT( s & 0xffff );
- dst[GCOMP] = USHORT_TO_FLOAT( s >> 16 );
- dst[BCOMP] = 0.0;
- dst[ACOMP] = 1.0;
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = USHORT_TO_FLOAT( s[i] & 0xffff );
+ dst[i][GCOMP] = USHORT_TO_FLOAT( s[i] >> 16 );
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
}
static void
-unpack_RG1616_REV(const void *src, GLfloat dst[4])
+unpack_RG1616_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = USHORT_TO_FLOAT( s >> 16 );
- dst[GCOMP] = USHORT_TO_FLOAT( s & 0xffff );
- dst[BCOMP] = 0.0;
- dst[ACOMP] = 1.0;
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = USHORT_TO_FLOAT( s[i] >> 16 );
+ dst[i][GCOMP] = USHORT_TO_FLOAT( s[i] & 0xffff );
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
}
static void
-unpack_ARGB2101010(const void *src, GLfloat dst[4])
+unpack_ARGB2101010(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = ((s >> 20) & 0x3ff) * (1.0F / 1023.0F);
- dst[GCOMP] = ((s >> 10) & 0x3ff) * (1.0F / 1023.0F);
- dst[BCOMP] = ((s >> 0) & 0x3ff) * (1.0F / 1023.0F);
- dst[ACOMP] = ((s >> 30) & 0x03) * (1.0F / 3.0F);
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = ((s[i] >> 20) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][GCOMP] = ((s[i] >> 10) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][BCOMP] = ((s[i] >> 0) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][ACOMP] = ((s[i] >> 30) & 0x03) * (1.0F / 3.0F);
+ }
}
static void
-unpack_Z24_S8(const void *src, GLfloat dst[4])
+unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
{
/* only return Z, not stencil data */
- const GLuint s = *((const GLuint *) src);
+ const GLuint *s = ((const GLuint *) src);
const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
- dst[0] = dst[1] = dst[2] = (s >> 8) * scale;
- dst[3] = 1.0F;
- ASSERT(dst[0] >= 0.0F);
- ASSERT(dst[0] <= 1.0F);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] =
+ dst[i][1] =
+ dst[i][2] = (s[i] >> 8) * scale;
+ dst[i][3] = 1.0F;
+ ASSERT(dst[i][0] >= 0.0F);
+ ASSERT(dst[i][0] <= 1.0F);
+ }
}
static void
-unpack_S8_Z24(const void *src, GLfloat dst[4])
+unpack_S8_Z24(const void *src, GLfloat dst[][4], GLuint n)
{
/* only return Z, not stencil data */
- const GLuint s = *((const GLuint *) src);
+ const GLuint *s = ((const GLuint *) src);
const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
- dst[0] = dst[1] = dst[2] = (s & 0x00ffffff) * scale;
- dst[3] = 1.0F;
- ASSERT(dst[0] >= 0.0F);
- ASSERT(dst[0] <= 1.0F);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] =
+ dst[i][1] =
+ dst[i][2] = (s[i] & 0x00ffffff) * scale;
+ dst[i][3] = 1.0F;
+ ASSERT(dst[i][0] >= 0.0F);
+ ASSERT(dst[i][0] <= 1.0F);
+ }
}
static void
-unpack_Z16(const void *src, GLfloat dst[4])
+unpack_Z16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[0] = dst[1] = dst[2] = s * (1.0F / 65535.0F);
- dst[3] = 1.0F;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] =
+ dst[i][1] =
+ dst[i][2] = s[i] * (1.0F / 65535.0F);
+ dst[i][3] = 1.0F;
+ }
}
static void
-unpack_X8_Z24(const void *src, GLfloat dst[4])
+unpack_X8_Z24(const void *src, GLfloat dst[][4], GLuint n)
{
- unpack_S8_Z24(src, dst);
+ unpack_S8_Z24(src, dst, n);
}
static void
-unpack_Z24_X8(const void *src, GLfloat dst[4])
+unpack_Z24_X8(const void *src, GLfloat dst[][4], GLuint n)
{
- unpack_Z24_S8(src, dst);
+ unpack_Z24_S8(src, dst, n);
}
static void
-unpack_Z32(const void *src, GLfloat dst[4])
+unpack_Z32(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[0] = dst[1] = dst[2] = s * (1.0F / 0xffffffff);
- dst[3] = 1.0F;
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] =
+ dst[i][1] =
+ dst[i][2] = s[i] * (1.0F / 0xffffffff);
+ dst[i][3] = 1.0F;
+ }
}
static void
-unpack_Z32_FLOAT(const void *src, GLfloat dst[4])
+unpack_Z32_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLfloat s = *((const GLfloat *) src);
- dst[0] = dst[1] = dst[2] = s;
- dst[3] = 1.0F;
+ const GLfloat *s = ((const GLfloat *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] =
+ dst[i][1] =
+ dst[i][2] = s[i];
+ dst[i][3] = 1.0F;
+ }
}
static void
-unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[4])
+unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLfloat s = *((const GLfloat *) src);
- dst[0] = dst[1] = dst[2] = s;
- dst[3] = 1.0F;
+ const GLfloat *s = ((const GLfloat *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] =
+ dst[i][1] =
+ dst[i][2] = s[i];
+ dst[i][3] = 1.0F;
+ }
}
static void
-unpack_S8(const void *src, GLfloat dst[4])
+unpack_S8(const void *src, GLfloat dst[][4], GLuint n)
{
/* should never be used */
- dst[0] = dst[1] = dst[2] = 0.0F;
- dst[3] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] =
+ dst[i][1] =
+ dst[i][2] = 0.0F;
+ dst[i][3] = 1.0F;
+ }
}
static void
-unpack_SRGB8(const void *src, GLfloat dst[4])
+unpack_SRGB8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLubyte *s = (const GLubyte *) src;
- dst[RCOMP] = nonlinear_to_linear(s[2]);
- dst[GCOMP] = nonlinear_to_linear(s[1]);
- dst[BCOMP] = nonlinear_to_linear(s[0]);
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = nonlinear_to_linear(s[i*3+2]);
+ dst[i][GCOMP] = nonlinear_to_linear(s[i*3+1]);
+ dst[i][BCOMP] = nonlinear_to_linear(s[i*3+0]);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SRGBA8(const void *src, GLfloat dst[4])
+unpack_SRGBA8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = nonlinear_to_linear( (s >> 24) );
- dst[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
- dst[BCOMP] = nonlinear_to_linear( (s >> 8) & 0xff );
- dst[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); /* linear! */
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = nonlinear_to_linear( (s[i] >> 24) );
+ dst[i][GCOMP] = nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][BCOMP] = nonlinear_to_linear( (s[i] >> 8) & 0xff );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] & 0xff ); /* linear! */
+ }
}
static void
-unpack_SARGB8(const void *src, GLfloat dst[4])
+unpack_SARGB8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
- dst[GCOMP] = nonlinear_to_linear( (s >> 8) & 0xff );
- dst[BCOMP] = nonlinear_to_linear( (s ) & 0xff );
- dst[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][GCOMP] = nonlinear_to_linear( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = nonlinear_to_linear( (s[i] ) & 0xff );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */
+ }
}
static void
-unpack_SL8(const void *src, GLfloat dst[4])
+unpack_SL8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLubyte s = *((const GLubyte *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = nonlinear_to_linear(s);
- dst[ACOMP] = 1.0F;
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = nonlinear_to_linear(s[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SLA8(const void *src, GLfloat dst[4])
+unpack_SLA8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLubyte *s = (const GLubyte *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = nonlinear_to_linear(s[0]);
- dst[ACOMP] = UBYTE_TO_FLOAT(s[1]); /* linear */
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = nonlinear_to_linear(s[i*2+0]);
+ dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i*2+1]); /* linear! */
+ }
}
static void
-unpack_SRGB_DXT1(const void *src, GLfloat dst[4])
+unpack_SRGB_DXT1(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_SRGBA_DXT1(const void *src, GLfloat dst[4])
+unpack_SRGBA_DXT1(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_SRGBA_DXT3(const void *src, GLfloat dst[4])
+unpack_SRGBA_DXT3(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_SRGBA_DXT5(const void *src, GLfloat dst[4])
+unpack_SRGBA_DXT5(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_RGB_FXT1(const void *src, GLfloat dst[4])
+unpack_RGB_FXT1(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_RGBA_FXT1(const void *src, GLfloat dst[4])
+unpack_RGBA_FXT1(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_RGB_DXT1(const void *src, GLfloat dst[4])
+unpack_RGB_DXT1(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_RGBA_DXT1(const void *src, GLfloat dst[4])
+unpack_RGBA_DXT1(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_RGBA_DXT3(const void *src, GLfloat dst[4])
+unpack_RGBA_DXT3(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_RGBA_DXT5(const void *src, GLfloat dst[4])
+unpack_RGBA_DXT5(const void *src, GLfloat dst[][4], GLuint n)
{
}
static void
-unpack_RGBA_FLOAT32(const void *src, GLfloat dst[4])
+unpack_RGBA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = (const GLfloat *) src;
- dst[RCOMP] = s[0];
- dst[GCOMP] = s[1];
- dst[BCOMP] = s[2];
- dst[ACOMP] = s[3];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i*4+0];
+ dst[i][GCOMP] = s[i*4+1];
+ dst[i][BCOMP] = s[i*4+2];
+ dst[i][ACOMP] = s[i*4+3];
+ }
}
static void
-unpack_RGBA_FLOAT16(const void *src, GLfloat dst[4])
+unpack_RGBA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLhalfARB *s = (const GLhalfARB *) src;
- dst[RCOMP] = _mesa_half_to_float(s[0]);
- dst[GCOMP] = _mesa_half_to_float(s[1]);
- dst[BCOMP] = _mesa_half_to_float(s[2]);
- dst[ACOMP] = _mesa_half_to_float(s[3]);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_half_to_float(s[i*4+0]);
+ dst[i][GCOMP] = _mesa_half_to_float(s[i*4+1]);
+ dst[i][BCOMP] = _mesa_half_to_float(s[i*4+2]);
+ dst[i][ACOMP] = _mesa_half_to_float(s[i*4+3]);
+ }
}
static void
-unpack_RGB_FLOAT32(const void *src, GLfloat dst[4])
+unpack_RGB_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = (const GLfloat *) src;
- dst[RCOMP] = s[0];
- dst[GCOMP] = s[1];
- dst[BCOMP] = s[2];
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i*3+0];
+ dst[i][GCOMP] = s[i*3+1];
+ dst[i][BCOMP] = s[i*3+2];
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_RGB_FLOAT16(const void *src, GLfloat dst[4])
+unpack_RGB_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLhalfARB *s = (const GLhalfARB *) src;
- dst[RCOMP] = _mesa_half_to_float(s[0]);
- dst[GCOMP] = _mesa_half_to_float(s[1]);
- dst[BCOMP] = _mesa_half_to_float(s[2]);
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_half_to_float(s[i*3+0]);
+ dst[i][GCOMP] = _mesa_half_to_float(s[i*3+1]);
+ dst[i][BCOMP] = _mesa_half_to_float(s[i*3+2]);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_ALPHA_FLOAT32(const void *src, GLfloat dst[4])
+unpack_ALPHA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = (const GLfloat *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = s[0];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = s[i];
+ }
}
static void
-unpack_ALPHA_FLOAT16(const void *src, GLfloat dst[4])
+unpack_ALPHA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLhalfARB *s = (const GLhalfARB *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = _mesa_half_to_float(s[0]);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = _mesa_half_to_float(s[i]);
+ }
}
static void
-unpack_LUMINANCE_FLOAT32(const void *src, GLfloat dst[4])
+unpack_LUMINANCE_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = (const GLfloat *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = s[0];
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = s[i];
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_LUMINANCE_FLOAT16(const void *src, GLfloat dst[4])
+unpack_LUMINANCE_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLhalfARB *s = (const GLhalfARB *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = _mesa_half_to_float(s[0]);
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = _mesa_half_to_float(s[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_LUMINANCE_ALPHA_FLOAT32(const void *src, GLfloat dst[4])
+unpack_LUMINANCE_ALPHA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = (const GLfloat *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = s[0];
- dst[ACOMP] = s[1];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = s[i*2+0];
+ dst[i][ACOMP] = s[i*2+1];
+ }
}
static void
-unpack_LUMINANCE_ALPHA_FLOAT16(const void *src, GLfloat dst[4])
+unpack_LUMINANCE_ALPHA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLhalfARB *s = (const GLhalfARB *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = _mesa_half_to_float(s[0]);
- dst[ACOMP] = _mesa_half_to_float(s[1]);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = _mesa_half_to_float(s[i*2+0]);
+ dst[i][ACOMP] = _mesa_half_to_float(s[i*2+1]);
+ }
}
static void
-unpack_INTENSITY_FLOAT32(const void *src, GLfloat dst[4])
+unpack_INTENSITY_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = (const GLfloat *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] =
- dst[ACOMP] = s[0];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = s[i];
+ }
}
static void
-unpack_INTENSITY_FLOAT16(const void *src, GLfloat dst[4])
+unpack_INTENSITY_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLhalfARB *s = (const GLhalfARB *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] =
- dst[ACOMP] = s[0];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = s[i];
+ }
}
static void
-unpack_R_FLOAT32(const void *src, GLfloat dst[4])
+unpack_R_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = (const GLfloat *) src;
- dst[RCOMP] = s[0];
- dst[GCOMP] = 0.0F;
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i];
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_R_FLOAT16(const void *src, GLfloat dst[4])
+unpack_R_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLhalfARB *s = (const GLhalfARB *) src;
- dst[RCOMP] = _mesa_half_to_float(s[0]);
- dst[GCOMP] = 0.0F;
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_half_to_float(s[i]);
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_RG_FLOAT32(const void *src, GLfloat dst[4])
+unpack_RG_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = (const GLfloat *) src;
- dst[RCOMP] = s[0];
- dst[GCOMP] = s[1];
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i*2+0];
+ dst[i][GCOMP] = s[i*2+1];
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_RG_FLOAT16(const void *src, GLfloat dst[4])
+unpack_RG_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLhalfARB *s = (const GLhalfARB *) src;
- dst[RCOMP] = _mesa_half_to_float(s[0]);
- dst[GCOMP] = _mesa_half_to_float(s[1]);
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_half_to_float(s[i*2+0]);
+ dst[i][GCOMP] = _mesa_half_to_float(s[i*2+1]);
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_RGBA_INT8(const void *src, GLfloat dst[4])
+unpack_RGBA_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLbyte *s = (const GLbyte *) src;
- dst[RCOMP] = (GLfloat) s[0];
- dst[GCOMP] = (GLfloat) s[1];
- dst[BCOMP] = (GLfloat) s[2];
- dst[ACOMP] = (GLfloat) s[3];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = (GLfloat) s[i*4+3];
+ }
}
static void
-unpack_RGBA_INT16(const void *src, GLfloat dst[4])
+unpack_RGBA_INT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLshort *s = (const GLshort *) src;
- dst[RCOMP] = (GLfloat) s[0];
- dst[GCOMP] = (GLfloat) s[1];
- dst[BCOMP] = (GLfloat) s[2];
- dst[ACOMP] = (GLfloat) s[3];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = (GLfloat) s[i*4+3];
+ }
}
static void
-unpack_RGBA_INT32(const void *src, GLfloat dst[4])
+unpack_RGBA_INT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLint *s = (const GLint *) src;
- dst[RCOMP] = (GLfloat) s[0];
- dst[GCOMP] = (GLfloat) s[1];
- dst[BCOMP] = (GLfloat) s[2];
- dst[ACOMP] = (GLfloat) s[3];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = (GLfloat) s[i*4+3];
+ }
}
static void
-unpack_RGBA_UINT8(const void *src, GLfloat dst[4])
+unpack_RGBA_UINT8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLubyte *s = (const GLubyte *) src;
- dst[RCOMP] = (GLfloat) s[0];
- dst[GCOMP] = (GLfloat) s[1];
- dst[BCOMP] = (GLfloat) s[2];
- dst[ACOMP] = (GLfloat) s[3];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = (GLfloat) s[i*4+3];
+ }
}
static void
-unpack_RGBA_UINT16(const void *src, GLfloat dst[4])
+unpack_RGBA_UINT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLushort *s = (const GLushort *) src;
- dst[RCOMP] = (GLfloat) s[0];
- dst[GCOMP] = (GLfloat) s[1];
- dst[BCOMP] = (GLfloat) s[2];
- dst[ACOMP] = (GLfloat) s[3];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = (GLfloat) s[i*4+3];
+ }
}
static void
-unpack_RGBA_UINT32(const void *src, GLfloat dst[4])
+unpack_RGBA_UINT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = (const GLuint *) src;
- dst[RCOMP] = (GLfloat) s[0];
- dst[GCOMP] = (GLfloat) s[1];
- dst[BCOMP] = (GLfloat) s[2];
- dst[ACOMP] = (GLfloat) s[3];
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = (GLfloat) s[i*4+3];
+ }
}
static void
-unpack_DUDV8(const void *src, GLfloat dst[4])
+unpack_DUDV8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLbyte *s = (const GLbyte *) src;
- dst[RCOMP] = BYTE_TO_FLOAT(s[0]);
- dst[GCOMP] = BYTE_TO_FLOAT(s[1]);
- dst[BCOMP] = 0;
- dst[ACOMP] = 0;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = BYTE_TO_FLOAT(s[i*2+0]);
+ dst[i][GCOMP] = BYTE_TO_FLOAT(s[i*2+1]);
+ dst[i][BCOMP] = 0;
+ dst[i][ACOMP] = 0;
+ }
}
static void
-unpack_SIGNED_R8(const void *src, GLfloat dst[4])
+unpack_SIGNED_R8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLbyte s = *((const GLbyte *) src);
- dst[RCOMP] = BYTE_TO_FLOAT_TEX( s );
- dst[GCOMP] = 0.0F;
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = 1.0F;
+ const GLbyte *s = ((const GLbyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( s[i] );
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SIGNED_RG88_REV(const void *src, GLfloat dst[4])
+unpack_SIGNED_RG88_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLushort *) src);
- dst[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s & 0xff) );
- dst[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = 1.0F;
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SIGNED_RGBX8888(const void *src, GLfloat dst[4])
+unpack_SIGNED_RGBX8888(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
- dst[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) );
- dst[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
- dst[ACOMP] = 1.0f;
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][ACOMP] = 1.0f;
+ }
}
static void
-unpack_SIGNED_RGBA8888(const void *src, GLfloat dst[4])
+unpack_SIGNED_RGBA8888(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
- dst[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) );
- dst[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
- dst[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) );
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] ) );
+ }
}
static void
-unpack_SIGNED_RGBA8888_REV(const void *src, GLfloat dst[4])
+unpack_SIGNED_RGBA8888_REV(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) );
- dst[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
- dst[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) );
- dst[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] ) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
+ }
}
static void
-unpack_SIGNED_R16(const void *src, GLfloat dst[4])
+unpack_SIGNED_R16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort s = *((const GLshort *) src);
- dst[RCOMP] = SHORT_TO_FLOAT_TEX( s );
- dst[GCOMP] = 0.0F;
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = 1.0F;
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i] );
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SIGNED_GR1616(const void *src, GLfloat dst[4])
+unpack_SIGNED_GR1616(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint s = *((const GLuint *) src);
- dst[RCOMP] = SHORT_TO_FLOAT_TEX( s & 0xffff );
- dst[GCOMP] = SHORT_TO_FLOAT_TEX( s >> 16 );
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = 1.0F;
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i] & 0xffff );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( s[i] >> 16 );
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SIGNED_RGB_16(const void *src, GLfloat dst[4])
+unpack_SIGNED_RGB_16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLshort *s = (const GLshort *) src;
- dst[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] );
- dst[GCOMP] = SHORT_TO_FLOAT_TEX( s[1] );
- dst[BCOMP] = SHORT_TO_FLOAT_TEX( s[2] );
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+0] );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+1] );
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+2] );
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SIGNED_RGBA_16(const void *src, GLfloat dst[4])
+unpack_SIGNED_RGBA_16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLshort *s = (const GLshort *) src;
- dst[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] );
- dst[GCOMP] = SHORT_TO_FLOAT_TEX( s[1] );
- dst[BCOMP] = SHORT_TO_FLOAT_TEX( s[2] );
- dst[ACOMP] = SHORT_TO_FLOAT_TEX( s[3] );
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+0] );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+1] );
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+2] );
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i*4+3] );
+ }
}
static void
-unpack_RGBA_16(const void *src, GLfloat dst[4])
+unpack_RGBA_16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLushort *s = (const GLushort *) src;
- dst[RCOMP] = USHORT_TO_FLOAT( s[0] );
- dst[GCOMP] = USHORT_TO_FLOAT( s[1] );
- dst[BCOMP] = USHORT_TO_FLOAT( s[2] );
- dst[ACOMP] = USHORT_TO_FLOAT( s[3] );
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = USHORT_TO_FLOAT( s[i*4+0] );
+ dst[i][GCOMP] = USHORT_TO_FLOAT( s[i*4+1] );
+ dst[i][BCOMP] = USHORT_TO_FLOAT( s[i*4+2] );
+ dst[i][ACOMP] = USHORT_TO_FLOAT( s[i*4+3] );
+ }
}
static void
-unpack_RED_RGTC1(const void *src, GLfloat dst[4])
+unpack_RED_RGTC1(const void *src, GLfloat dst[][4], GLuint n)
{
/* XXX to do */
}
static void
-unpack_SIGNED_RED_RGTC1(const void *src, GLfloat dst[4])
+unpack_SIGNED_RED_RGTC1(const void *src, GLfloat dst[][4], GLuint n)
{
/* XXX to do */
}
static void
-unpack_RG_RGTC2(const void *src, GLfloat dst[4])
+unpack_RG_RGTC2(const void *src, GLfloat dst[][4], GLuint n)
{
/* XXX to do */
}
static void
-unpack_SIGNED_RG_RGTC2(const void *src, GLfloat dst[4])
+unpack_SIGNED_RG_RGTC2(const void *src, GLfloat dst[][4], GLuint n)
{
/* XXX to do */
}
static void
-unpack_L_LATC1(const void *src, GLfloat dst[4])
+unpack_L_LATC1(const void *src, GLfloat dst[][4], GLuint n)
{
/* XXX to do */
}
static void
-unpack_SIGNED_L_LATC1(const void *src, GLfloat dst[4])
+unpack_SIGNED_L_LATC1(const void *src, GLfloat dst[][4], GLuint n)
{
/* XXX to do */
}
static void
-unpack_LA_LATC2(const void *src, GLfloat dst[4])
+unpack_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
{
/* XXX to do */
}
static void
-unpack_SIGNED_LA_LATC2(const void *src, GLfloat dst[4])
+unpack_SIGNED_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
{
/* XXX to do */
}
static void
-unpack_SIGNED_A8(const void *src, GLfloat dst[4])
+unpack_SIGNED_A8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLbyte s = *((const GLbyte *) src);
- dst[RCOMP] = 0.0F;
- dst[GCOMP] = 0.0F;
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = BYTE_TO_FLOAT_TEX( s );
+ const GLbyte *s = ((const GLbyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = 0.0F;
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( s[i] );
+ }
}
static void
-unpack_SIGNED_L8(const void *src, GLfloat dst[4])
+unpack_SIGNED_L8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLbyte s = *((const GLbyte *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = BYTE_TO_FLOAT_TEX( s );
- dst[ACOMP] = 1.0F;
+ const GLbyte *s = ((const GLbyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( s[i] );
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SIGNED_AL88(const void *src, GLfloat dst[4])
+unpack_SIGNED_AL88(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort s = *((const GLshort *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s & 0xff) );
- dst[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) );
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ }
}
static void
-unpack_SIGNED_I8(const void *src, GLfloat dst[4])
+unpack_SIGNED_I8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLbyte s = *((const GLbyte *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] =
- dst[ACOMP] = BYTE_TO_FLOAT_TEX( s );
+ const GLbyte *s = ((const GLbyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( s[i] );
+ }
}
static void
-unpack_SIGNED_A16(const void *src, GLfloat dst[4])
+unpack_SIGNED_A16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort s = *((const GLshort *) src);
- dst[RCOMP] = 0.0F;
- dst[GCOMP] = 0.0F;
- dst[BCOMP] = 0.0F;
- dst[ACOMP] = SHORT_TO_FLOAT_TEX( s );
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = 0.0F;
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i] );
+ }
}
static void
-unpack_SIGNED_L16(const void *src, GLfloat dst[4])
+unpack_SIGNED_L16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort s = *((const GLshort *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = SHORT_TO_FLOAT_TEX( s );
- dst[ACOMP] = 1.0F;
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i] );
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_SIGNED_AL1616(const void *src, GLfloat dst[4])
+unpack_SIGNED_AL1616(const void *src, GLfloat dst[][4], GLuint n)
{
const GLshort *s = (const GLshort *) src;
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] = SHORT_TO_FLOAT_TEX( s[0] );
- dst[ACOMP] = SHORT_TO_FLOAT_TEX( s[1] );
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*2+0] );
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i*2+1] );
+ }
}
static void
-unpack_SIGNED_I16(const void *src, GLfloat dst[4])
+unpack_SIGNED_I16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort s = *((const GLshort *) src);
- dst[RCOMP] =
- dst[GCOMP] =
- dst[BCOMP] =
- dst[ACOMP] = SHORT_TO_FLOAT_TEX( s );
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i] );
+ }
}
static void
-unpack_RGB9_E5_FLOAT(const void *src, GLfloat dst[4])
+unpack_RGB9_E5_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = (const GLuint *) src;
- rgb9e5_to_float3(*s, dst);
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgb9e5_to_float3(s[i], dst[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
}
static void
-unpack_R11_G11_B10_FLOAT(const void *src, GLfloat dst[4])
+unpack_R11_G11_B10_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = (const GLuint *) src;
- r11g11b10f_to_float3(*s, dst);
- dst[ACOMP] = 1.0F;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ r11g11b10f_to_float3(s[i], dst[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
}
@@ -1248,14 +1534,7 @@ _mesa_unpack_rgba_row(gl_format format, GLuint n,
const void *src, GLfloat dst[][4])
{
unpack_rgba_func unpack = get_unpack_rgba_function(format);
- GLuint srcStride = _mesa_get_format_bytes(format);
- const GLubyte *srcPtr = (GLubyte *) src;
- GLuint i;
-
- for (i = 0; i < n; i++) {
- unpack(srcPtr, dst[i]);
- srcPtr += srcStride;
- }
+ unpack(src, dst, n);
}
static void
@@ -1401,10 +1680,9 @@ _mesa_unpack_rgba_block(gl_format format,
unpack_rgba_func unpack = get_unpack_rgba_function(format);
const GLuint srcPixStride = _mesa_get_format_bytes(format);
const GLuint dstPixStride = 4 * sizeof(GLfloat);
- const GLubyte *srcRow, *srcPix;
+ const GLubyte *srcRow;
GLubyte *dstRow;
- GLfloat *dstPix;
- GLuint i, j;
+ GLuint i;
/* XXX needs to be fixed for compressed formats */
@@ -1412,14 +1690,7 @@ _mesa_unpack_rgba_block(gl_format format,
dstRow = ((GLubyte *) dst) + dstRowStride * y + dstPixStride * x;
for (i = 0; i < height; i++) {
- srcPix = srcRow;
- dstPix = (GLfloat *) dstRow;
-
- for (j = 0; j < width; j++) {
- unpack(srcPix, dstPix);
- srcPix += srcPixStride;
- dstPix += dstPixStride;
- }
+ unpack(srcRow, (GLfloat (*)[4]) dstRow, width);
dstRow += dstRowStride;
srcRow += srcRowStride;
@@ -1429,60 +1700,64 @@ _mesa_unpack_rgba_block(gl_format format,
-typedef void (*unpack_float_z_func)(const void *src, GLfloat *dst);
+typedef void (*unpack_float_z_func)(GLuint n, const void *src, GLfloat *dst);
static void
-unpack_float_z_Z24_S8(const void *src, GLfloat *dst)
+unpack_float_z_Z24_X8(GLuint n, const void *src, GLfloat *dst)
{
/* only return Z, not stencil data */
- const GLuint s = *((const GLuint *) src);
+ const GLuint *s = ((const GLuint *) src);
const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
- *dst = (s >> 8) * scale;
- ASSERT(*dst >= 0.0F);
- ASSERT(*dst <= 1.0F);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (s[i] >> 8) * scale;
+ ASSERT(dst[i] >= 0.0F);
+ ASSERT(dst[i] <= 1.0F);
+ }
}
static void
-unpack_float_z_S8_Z24(const void *src, GLfloat *dst)
+unpack_float_z_X8_Z24(GLuint n, const void *src, GLfloat *dst)
{
/* only return Z, not stencil data */
- const GLuint s = *((const GLuint *) src);
+ const GLuint *s = ((const GLuint *) src);
const GLfloat scale = 1.0F / (GLfloat) 0xffffff;
- *dst = (s & 0x00ffffff) * scale;
- ASSERT(*dst >= 0.0F);
- ASSERT(*dst <= 1.0F);
-}
-
-static void
-unpack_float_z_Z16(const void *src, GLfloat *dst)
-{
- const GLushort s = *((const GLushort *) src);
- *dst = s * (1.0F / 65535.0F);
-}
-
-static void
-unpack_float_z_X8_Z24(const void *src, GLfloat *dst)
-{
- unpack_float_z_S8_Z24(src, dst);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (s[i] & 0x00ffffff) * scale;
+ ASSERT(dst[i] >= 0.0F);
+ ASSERT(dst[i] <= 1.0F);
+ }
}
static void
-unpack_float_z_Z24_X8(const void *src, GLfloat *dst)
+unpack_float_z_Z16(GLuint n, const void *src, GLfloat *dst)
{
- unpack_float_z_Z24_S8(src, dst);
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = s[i] * (1.0F / 65535.0F);
+ }
}
static void
-unpack_float_z_Z32(const void *src, GLfloat *dst)
+unpack_float_z_Z32(GLuint n, const void *src, GLfloat *dst)
{
- const GLuint s = *((const GLuint *) src);
- *dst = s * (1.0F / 0xffffffff);
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = s[i] * (1.0F / 0xffffffff);
+ }
}
static void
-unpack_float_z_Z32X24S8(const void *src, GLfloat *dst)
+unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst)
{
- *dst = *((const GLfloat *) src);
+ const GLfloat *s = ((const GLfloat *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = s[i * 2];
+ }
}
@@ -1492,25 +1767,18 @@ _mesa_unpack_float_z_row(gl_format format, GLuint n,
const void *src, GLfloat *dst)
{
unpack_float_z_func unpack;
- GLuint srcStride = _mesa_get_format_bytes(format);
- const GLubyte *srcPtr = (GLubyte *) src;
- GLuint i;
switch (format) {
case MESA_FORMAT_Z24_S8:
- unpack = unpack_float_z_Z24_S8;
+ case MESA_FORMAT_Z24_X8:
+ unpack = unpack_float_z_Z24_X8;
break;
case MESA_FORMAT_S8_Z24:
- unpack = unpack_float_z_S8_Z24;
- break;
- case MESA_FORMAT_Z16:
- unpack = unpack_float_z_Z16;
- break;
case MESA_FORMAT_X8_Z24:
unpack = unpack_float_z_X8_Z24;
break;
- case MESA_FORMAT_Z24_X8:
- unpack = unpack_float_z_Z24_X8;
+ case MESA_FORMAT_Z16:
+ unpack = unpack_float_z_Z16;
break;
case MESA_FORMAT_Z32:
unpack = unpack_float_z_Z32;
@@ -1524,43 +1792,49 @@ _mesa_unpack_float_z_row(gl_format format, GLuint n,
return;
}
- for (i = 0; i < n; i++) {
- unpack(srcPtr, &dst[i]);
- srcPtr += srcStride;
- }
+ unpack(n, src, dst);
}
-typedef void (*unpack_uint_z_func)(const void *src, GLuint *dst);
+typedef void (*unpack_uint_z_func)(const void *src, GLuint *dst, GLuint n);
static void
-unpack_uint_z_Z24_X8(const void *src, GLuint *dst)
+unpack_uint_z_Z24_X8(const void *src, GLuint *dst, GLuint n)
{
/* only return Z, not stencil data */
- const GLuint s = *((const GLuint *) src);
- *dst = (s & 0xffffff00) | (s >> 24);
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (s[i] & 0xffffff00) | (s[i] >> 24);
+ }
}
static void
-unpack_uint_z_X8_Z24(const void *src, GLuint *dst)
+unpack_uint_z_X8_Z24(const void *src, GLuint *dst, GLuint n)
{
/* only return Z, not stencil data */
- const GLuint s = *((const GLuint *) src);
- *dst = (s << 8) | ((s >> 16) & 0xff);
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (s[i] << 8) | ((s[i] >> 16) & 0xff);
+ }
}
static void
-unpack_uint_z_Z16(const void *src, GLuint *dst)
+unpack_uint_z_Z16(const void *src, GLuint *dst, GLuint n)
{
- const GLushort s = *((const GLushort *)src);
- *dst = (s << 16) | s;
+ const GLushort *s = ((const GLushort *)src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = (s[i] << 16) | s[i];
+ }
}
static void
-unpack_uint_z_Z32(const void *src, GLuint *dst)
+unpack_uint_z_Z32(const void *src, GLuint *dst, GLuint n)
{
- *dst = *((const GLuint *) src);
+ memcpy(dst, src, n * sizeof(GLuint));
}
@@ -1569,9 +1843,7 @@ _mesa_unpack_uint_z_row(gl_format format, GLuint n,
const void *src, GLuint *dst)
{
unpack_uint_z_func unpack;
- GLuint srcStride = _mesa_get_format_bytes(format);
const GLubyte *srcPtr = (GLubyte *) src;
- GLuint i;
switch (format) {
case MESA_FORMAT_Z24_S8:
@@ -1594,12 +1866,10 @@ _mesa_unpack_uint_z_row(gl_format format, GLuint n,
return;
}
- for (i = 0; i < n; i++) {
- unpack(srcPtr, &dst[i]);
- srcPtr += srcStride;
- }
+ unpack(srcPtr, dst, n);
}
+
static void
unpack_ubyte_s_S8(const void *src, GLubyte *dst, GLuint n)
{