*d = PACK_COLOR_2101010_US(a, b, g, r);
}
+/*
+ * MESA_FORMAT_SIGNED_RG88
+ */
+
+static void
+pack_float_SIGNED_RG88(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_SIGNED_RG1616
+ */
+
+static void
+pack_float_SIGNED_RG1616(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);
+}
/**
* Return a function that can pack a GLubyte rgba[4] color.
table[MESA_FORMAT_ABGR2101010] = pack_float_ABGR2101010;
+ table[MESA_FORMAT_SIGNED_RG88] = pack_float_SIGNED_RG88;
+ table[MESA_FORMAT_SIGNED_RG1616] = pack_float_SIGNED_RG1616;
+
initialized = GL_TRUE;
}
}
}
+static void
+unpack_SIGNED_RG88(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) );
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_RG1616(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] >> 16) );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] & 0xffff) );
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
/**
* Return the unpacker function for the given format.
*/
table[MESA_FORMAT_ABGR2101010] = unpack_ABGR2101010;
+ table[MESA_FORMAT_SIGNED_RG88] = unpack_SIGNED_RG88;
+ table[MESA_FORMAT_SIGNED_RG1616] = unpack_SIGNED_RG1616;
+
initialized = GL_TRUE;
}
0, 0, 0, 0, 0,
1, 1, 4
},
+ {
+ MESA_FORMAT_SIGNED_RG88,
+ "MESA_FORMAT_SIGNED_RG88",
+ GL_RG,
+ GL_SIGNED_NORMALIZED,
+ 8, 8, 0, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 2
+ },
+ {
+ MESA_FORMAT_SIGNED_RG1616,
+ "MESA_FORMAT_SIGNED_RG1616",
+ GL_RG,
+ GL_SIGNED_NORMALIZED,
+ 16, 16, 0, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
};
*comps = 4;
return;
+ case MESA_FORMAT_SIGNED_RG88:
+ *datatype = GL_BYTE;
+ *comps = 2;
+ return;
+
+ case MESA_FORMAT_SIGNED_RG1616:
+ *datatype = GL_SHORT;
+ *comps = 2;
+ return;
+
case MESA_FORMAT_COUNT:
assert(0);
return;
return format == GL_RGBA && type == GL_UNSIGNED_INT_2_10_10_10_REV &&
!swapBytes;
+ case MESA_FORMAT_SIGNED_RG88:
+ return format == GL_RG && type == GL_BYTE && !littleEndian &&
+ !swapBytes;
+
+ case MESA_FORMAT_SIGNED_RG1616:
+ return format == GL_RG && type == GL_SHORT && !littleEndian &&
+ !swapBytes;
}
return GL_FALSE;
MESA_FORMAT_ABGR2101010,
+ MESA_FORMAT_SIGNED_RG88,
+ MESA_FORMAT_SIGNED_RG1616,
+
MESA_FORMAT_COUNT
} gl_format;
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL88 ||
+ dstFormat == MESA_FORMAT_SIGNED_RG88 ||
dstFormat == MESA_FORMAT_SIGNED_RG88_REV);
ASSERT(_mesa_get_format_bytes(dstFormat) == 2);
for (img = 0; img < srcDepth; img++) {
GLbyte *dstRow = (GLbyte *) dstSlices[img];
for (row = 0; row < srcHeight; row++) {
- GLbyte *dst = dstRow;
- for (col = 0; col < srcWidth; col++) {
- dst[0] = FLOAT_TO_BYTE_TEX(src[0]);
- dst[1] = FLOAT_TO_BYTE_TEX(src[1]);
- src += 2;
- dst += 2;
+ GLushort *dst = (GLushort *) dstRow;
+
+ if (dstFormat == MESA_FORMAT_SIGNED_AL88 ||
+ dstFormat == MESA_FORMAT_SIGNED_RG88_REV) {
+ for (col = 0; col < srcWidth; col++) {
+ GLubyte l = FLOAT_TO_BYTE_TEX(src[0]);
+ GLubyte a = FLOAT_TO_BYTE_TEX(src[1]);
+
+ dst[col] = PACK_COLOR_88_REV(l, a);
+ src += 2;
+ }
+ } else {
+ for (col = 0; col < srcWidth; col++) {
+ GLubyte l = FLOAT_TO_BYTE_TEX(src[0]);
+ GLubyte a = FLOAT_TO_BYTE_TEX(src[1]);
+
+ dst[col] = PACK_COLOR_88(l, a);
+ src += 2;
+ }
}
+
dstRow += dstRowStride;
}
}
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL1616 ||
+ dstFormat == MESA_FORMAT_SIGNED_RG1616 ||
dstFormat == MESA_FORMAT_SIGNED_GR1616);
ASSERT(_mesa_get_format_bytes(dstFormat) == 4);
for (img = 0; img < srcDepth; img++) {
GLubyte *dstRow = dstSlices[img];
for (row = 0; row < srcHeight; row++) {
- GLshort *dst = (GLshort *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- GLushort l, a;
+ GLuint *dst = (GLuint *) dstRow;
- UNCLAMPED_FLOAT_TO_SHORT(l, src[0]);
- UNCLAMPED_FLOAT_TO_SHORT(a, src[1]);
- dst[0] = l;
- dst[1] = a;
- src += 2;
- dst += 2;
+ if (dstFormat == MESA_FORMAT_SIGNED_AL1616 ||
+ dstFormat == MESA_FORMAT_SIGNED_GR1616) {
+ for (col = 0; col < srcWidth; col++) {
+ GLushort l, a;
+
+ UNCLAMPED_FLOAT_TO_SHORT(l, src[0]);
+ UNCLAMPED_FLOAT_TO_SHORT(a, src[1]);
+ dst[col] = PACK_COLOR_1616_REV(l, a);
+ src += 2;
+ }
+ } else {
+ for (col = 0; col < srcWidth; col++) {
+ GLushort l, a;
+
+ UNCLAMPED_FLOAT_TO_SHORT(l, src[0]);
+ UNCLAMPED_FLOAT_TO_SHORT(a, src[1]);
+ dst[col] = PACK_COLOR_1616_REV(l, a);
+ src += 2;
+ }
}
+
dstRow += dstRowStride;
}
}
table[MESA_FORMAT_ABGR2101010] = _mesa_texstore_abgr2101010;
+ table[MESA_FORMAT_SIGNED_RG88] = _mesa_texstore_snorm88;
+ table[MESA_FORMAT_SIGNED_RG1616] = _mesa_texstore_snorm1616;
+
initialized = GL_TRUE;
}
NULL,
NULL
},
+ {
+ MESA_FORMAT_SIGNED_RG88,
+ NULL,
+ NULL,
+ NULL
+ },
+ {
+ MESA_FORMAT_SIGNED_RG1616,
+ NULL,
+ NULL,
+ NULL
+ },
};