* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
+/** Helper struct for MESA_FORMAT_Z32_FLOAT_X24S8 */
+struct z32f_x24s8
+{
+ float z;
+ uint32_t x24s8;
+};
+
/* Expand 1, 2, 3, 4, 5, 6-bit values to fill 8 bits */
* linear RGB value in [0, 1].
* Implemented with a 256-entry lookup table.
*/
-static inline GLfloat
-nonlinear_to_linear(GLubyte cs8)
+GLfloat
+_mesa_nonlinear_to_linear(GLubyte cs8)
{
static GLfloat table[256];
static GLboolean tableReady = GL_FALSE;
}
static void
-unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n)
+unpack_GR1616(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = ((const GLuint *) src);
GLuint i;
}
static void
-unpack_RG1616_REV(const void *src, GLfloat dst[][4], GLuint n)
+unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = ((const GLuint *) src);
GLuint i;
}
+static void
+unpack_ARGB2101010_UINT(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] = (GLfloat)((s[i] >> 20) & 0x3ff);
+ dst[i][GCOMP] = (GLfloat)((s[i] >> 10) & 0x3ff);
+ dst[i][BCOMP] = (GLfloat)((s[i] >> 0) & 0x3ff);
+ dst[i][ACOMP] = (GLfloat)((s[i] >> 30) & 0x03);
+ }
+}
+
+
+static void
+unpack_ABGR2101010_UINT(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] = (GLfloat)((s[i] >> 0) & 0x3ff);
+ dst[i][GCOMP] = (GLfloat)((s[i] >> 10) & 0x3ff);
+ dst[i][BCOMP] = (GLfloat)((s[i] >> 20) & 0x3ff);
+ dst[i][ACOMP] = (GLfloat)((s[i] >> 30) & 0x03);
+ }
+}
+
+
static void
unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
{
for (i = 0; i < n; i++) {
dst[i][0] =
dst[i][1] =
- dst[i][2] = (s[i] >> 8) * scale;
+ dst[i][2] = (GLfloat) ((s[i] >> 8) * scale);
dst[i][3] = 1.0F;
ASSERT(dst[i][0] >= 0.0F);
ASSERT(dst[i][0] <= 1.0F);
for (i = 0; i < n; i++) {
dst[i][0] =
dst[i][1] =
- dst[i][2] = (s[i] & 0x00ffffff) * scale;
+ dst[i][2] = (float) ((s[i] & 0x00ffffff) * scale);
dst[i][3] = 1.0F;
ASSERT(dst[i][0] >= 0.0F);
ASSERT(dst[i][0] <= 1.0F);
const GLubyte *s = (const GLubyte *) src;
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][RCOMP] = _mesa_nonlinear_to_linear(s[i*3+2]);
+ dst[i][GCOMP] = _mesa_nonlinear_to_linear(s[i*3+1]);
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear(s[i*3+0]);
dst[i][ACOMP] = 1.0F;
}
}
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][RCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 24) );
+ dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff );
dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] & 0xff ); /* 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][RCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff );
dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */
}
}
for (i = 0; i < n; i++) {
dst[i][RCOMP] =
dst[i][GCOMP] =
- dst[i][BCOMP] = nonlinear_to_linear(s[i]);
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear(s[i]);
dst[i][ACOMP] = 1.0F;
}
}
for (i = 0; i < n; i++) {
dst[i][RCOMP] =
dst[i][GCOMP] =
- dst[i][BCOMP] = nonlinear_to_linear(s[i] & 0xff);
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear(s[i] & 0xff);
dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i] >> 8); /* linear! */
}
}
}
}
+static void
+unpack_ALPHA_UINT8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLubyte *s = (const GLubyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = (GLfloat) s[i];
+ }
+}
+
+static void
+unpack_ALPHA_UINT16(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] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = (GLfloat) s[i];
+ }
+}
static void
-unpack_RGBA_INT8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_ALPHA_UINT32(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] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = (GLfloat) s[i];
+ }
+}
+
+static void
+unpack_ALPHA_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLbyte *s = (const GLbyte *) src;
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];
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_RGBA_INT16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_ALPHA_INT16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLshort *s = (const GLshort *) src;
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];
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_RGBA_INT32(const void *src, GLfloat dst[][4], GLuint n)
+unpack_ALPHA_INT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLint *s = (const GLint *) src;
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];
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_RGBA_UINT8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_INTENSITY_UINT8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLubyte *s = (const GLubyte *) src;
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];
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_RGBA_UINT16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_INTENSITY_UINT16(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] = (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];
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_RGBA_UINT32(const void *src, GLfloat dst[][4], GLuint n)
+unpack_INTENSITY_UINT32(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] = (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];
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_DUDV8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_INTENSITY_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLbyte *s = (const GLbyte *) src;
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;
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_SIGNED_R8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_INTENSITY_INT16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLbyte *s = ((const GLbyte *) src);
+ const GLshort *s = (const GLshort *) 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;
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_SIGNED_RG88_REV(const void *src, GLfloat dst[][4], GLuint n)
+unpack_INTENSITY_INT32(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLushort *s = ((const GLushort *) src);
+ const GLint *s = (const GLint *) 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;
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = (GLfloat) s[i];
}
}
static void
-unpack_SIGNED_RGBX8888(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_UINT8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint *s = ((const GLuint *) src);
+ const GLubyte *s = (const GLubyte *) 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;
+ dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i];
+ dst[i][ACOMP] = 1.0;
}
}
static void
-unpack_SIGNED_RGBA8888(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_UINT16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint *s = ((const GLuint *) src);
+ const GLushort *s = (const GLushort *) 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] ) );
+ dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i];
+ dst[i][ACOMP] = 1.0;
}
}
static void
-unpack_SIGNED_RGBA8888_REV(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_UINT32(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint *s = ((const GLuint *) src);
+ 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) );
+ dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i];
+ dst[i][ACOMP] = 1.0;
}
}
static void
-unpack_SIGNED_R16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort *s = ((const GLshort *) src);
+ const GLbyte *s = (const GLbyte *) 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;
+ dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i];
+ dst[i][ACOMP] = 1.0;
}
}
static void
-unpack_SIGNED_GR1616(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_INT16(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint *s = ((const GLuint *) src);
+ const GLshort *s = (const GLshort *) src;
GLuint i;
for (i = 0; i < n; i++) {
- dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] & 0xffff) );
- dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] >> 16) );
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
+ dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i];
+ dst[i][ACOMP] = 1.0;
}
}
static void
-unpack_SIGNED_RGB_16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_INT32(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort *s = (const GLshort *) src;
+ const GLint *s = (const GLint *) src;
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;
+ dst[i][RCOMP] = dst[i][GCOMP] = dst[i][BCOMP] = (GLfloat) s[i];
+ dst[i][ACOMP] = 1.0;
}
}
static void
-unpack_SIGNED_RGBA_16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_ALPHA_UINT8(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort *s = (const GLshort *) src;
+ const GLubyte *s = (const GLubyte *) src;
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] );
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = (GLfloat) s[2*i+0];
+ dst[i][ACOMP] = (GLfloat) s[2*i+1];
}
}
static void
-unpack_RGBA_16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_ALPHA_UINT16(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] = 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] );
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = (GLfloat) s[2*i+0];
+ dst[i][ACOMP] = (GLfloat) s[2*i+1];
}
}
static void
-unpack_RED_RGTC1(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_ALPHA_UINT32(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLuint *s = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = (GLfloat) s[2*i+0];
+ dst[i][ACOMP] = (GLfloat) s[2*i+1];
+ }
}
static void
-unpack_SIGNED_RED_RGTC1(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_ALPHA_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLbyte *s = (const GLbyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = (GLfloat) s[2*i+0];
+ dst[i][ACOMP] = (GLfloat) s[2*i+1];
+ }
}
static void
-unpack_RG_RGTC2(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_ALPHA_INT16(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = (GLfloat) s[2*i+0];
+ dst[i][ACOMP] = (GLfloat) s[2*i+1];
+ }
}
static void
-unpack_SIGNED_RG_RGTC2(const void *src, GLfloat dst[][4], GLuint n)
+unpack_LUMINANCE_ALPHA_INT32(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLint *s = (const GLint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = (GLfloat) s[2*i+0];
+ dst[i][ACOMP] = (GLfloat) s[2*i+1];
+ }
}
static void
-unpack_L_LATC1(const void *src, GLfloat dst[][4], GLuint n)
+unpack_R_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLbyte *s = (const GLbyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i];
+ dst[i][GCOMP] = 0.0;
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
}
static void
-unpack_SIGNED_L_LATC1(const void *src, GLfloat dst[][4], GLuint n)
+unpack_RG_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLbyte *s = (const GLbyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*2+0];
+ dst[i][GCOMP] = (GLfloat) s[i*2+1];
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
}
static void
-unpack_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
+unpack_RGB_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLbyte *s = (const GLbyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*3+0];
+ dst[i][GCOMP] = (GLfloat) s[i*3+1];
+ dst[i][BCOMP] = (GLfloat) s[i*3+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGBA_INT8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLbyte *s = (const GLbyte *) src;
+ 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_R_INT16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i];
+ dst[i][GCOMP] = 0.0;
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RG_INT16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*2+0];
+ dst[i][GCOMP] = (GLfloat) s[i*2+1];
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGB_INT16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*3+0];
+ dst[i][GCOMP] = (GLfloat) s[i*3+1];
+ dst[i][BCOMP] = (GLfloat) s[i*3+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGBA_INT16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ 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_R_INT32(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLint *s = (const GLint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i];
+ dst[i][GCOMP] = 0.0;
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RG_INT32(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLint *s = (const GLint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*2+0];
+ dst[i][GCOMP] = (GLfloat) s[i*2+1];
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGB_INT32(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLint *s = (const GLint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*3+0];
+ dst[i][GCOMP] = (GLfloat) s[i*3+1];
+ dst[i][BCOMP] = (GLfloat) s[i*3+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+
+static void
+unpack_RGBA_INT32(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLint *s = (const GLint *) src;
+ 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_R_UINT8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLubyte *s = (const GLubyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i];
+ dst[i][GCOMP] = 0.0;
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RG_UINT8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLubyte *s = (const GLubyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*2+0];
+ dst[i][GCOMP] = (GLfloat) s[i*2+1];
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGB_UINT8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLubyte *s = (const GLubyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*3+0];
+ dst[i][GCOMP] = (GLfloat) s[i*3+1];
+ dst[i][BCOMP] = (GLfloat) s[i*3+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGBA_UINT8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLubyte *s = (const GLubyte *) src;
+ 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_R_UINT16(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] = (GLfloat) s[i];
+ dst[i][GCOMP] = 0.0;
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RG_UINT16(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] = (GLfloat) s[i*2+0];
+ dst[i][GCOMP] = (GLfloat) s[i*2+1];
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGB_UINT16(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] = (GLfloat) s[i*3+0];
+ dst[i][GCOMP] = (GLfloat) s[i*3+1];
+ dst[i][BCOMP] = (GLfloat) s[i*3+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGBA_UINT16(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] = (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_R_UINT32(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] = (GLfloat) s[i];
+ dst[i][GCOMP] = 0.0;
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RG_UINT32(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] = (GLfloat) s[i*2+0];
+ dst[i][GCOMP] = (GLfloat) s[i*2+1];
+ dst[i][BCOMP] = 0.0;
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGB_UINT32(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] = (GLfloat) s[i*3+0];
+ dst[i][GCOMP] = (GLfloat) s[i*3+1];
+ dst[i][BCOMP] = (GLfloat) s[i*3+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_RGBA_UINT32(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] = (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], GLuint n)
+{
+ const GLbyte *s = (const GLbyte *) src;
+ 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], GLuint n)
+{
+ 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], 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] & 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], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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], 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] & 0xffff) );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (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], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ 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], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ 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], GLuint n)
+{
+ const GLushort *s = (const GLushort *) src;
+ 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], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+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], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+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], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+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], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_SIGNED_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC1_RGB8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_RGB8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SRGB8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_RGBA8_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SRGB8_ALPHA8_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_R11_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_RG11_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SIGNED_R11_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SIGNED_RG11_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1(const void *src, GLfloat dst[][4],
+ GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1(const void *src, GLfloat dst[][4],
+ GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_SIGNED_A8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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], GLuint n)
+{
+ 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*2+0] );
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i*2+1] );
+ }
+}
+
+static void
+unpack_SIGNED_I16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ 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], GLuint n)
+{
+ const GLuint *s = (const GLuint *) src;
+ 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], GLuint n)
+{
+ const GLuint *s = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ r11g11b10f_to_float3(s[i], dst[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_XRGB4444_UNORM(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] = ((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] = 1.0;
+ }
+}
+
+static void
+unpack_XRGB1555_UNORM(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] = ((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] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR8888_SNORM(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] = 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] = 1.0;
+ }
}
static void
-unpack_SIGNED_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR8888_SRGB(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff );
+ dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */
+ }
}
static void
-unpack_ETC1_RGB8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR8888_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
- /* XXX to do */
+ const GLbyte *s = (const GLbyte *) src;
+ 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] = 1.0;
+ }
}
static void
-unpack_SIGNED_A8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR8888_SINT(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLbyte *s = ((const GLbyte *) src);
+ 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] );
+ dst[i][RCOMP] = s[i*4+0];
+ dst[i][GCOMP] = s[i*4+1];
+ dst[i][BCOMP] = s[i*4+2];
+ dst[i][ACOMP] = 1.0;
}
}
static void
-unpack_SIGNED_L8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XRGB2101010_UNORM(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLbyte *s = ((const GLbyte *) src);
+ const GLuint *s = ((const GLuint *) 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;
+ 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] = 1.0;
}
}
static void
-unpack_SIGNED_AL88(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR16161616_UNORM(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort *s = ((const GLshort *) src);
+ const GLushort *s = (const GLushort *) 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) );
+ 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] = 1.0;
}
}
static void
-unpack_SIGNED_I8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR16161616_SNORM(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLbyte *s = ((const GLbyte *) src);
+ 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] = BYTE_TO_FLOAT_TEX( s[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] = 1.0;
}
}
static void
-unpack_SIGNED_A16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR16161616_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort *s = ((const GLshort *) src);
+ 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] );
+ 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] = 1.0;
}
}
static void
-unpack_SIGNED_L16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR16161616_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort *s = ((const GLshort *) src);
+ const GLushort *s = (const GLushort *) 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;
+ 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] = 1.0;
}
}
static void
-unpack_SIGNED_AL1616(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR16161616_SINT(const void *src, GLfloat dst[][4], GLuint n)
{
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*2+0] );
- dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i*2+1] );
+ 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] = 1.0;
}
}
static void
-unpack_SIGNED_I16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR32323232_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLshort *s = ((const GLshort *) src);
+ const GLfloat *s = (const GLfloat *) 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] );
+ dst[i][RCOMP] = s[i*4+0];
+ dst[i][GCOMP] = s[i*4+1];
+ dst[i][BCOMP] = s[i*4+2];
+ dst[i][ACOMP] = 1.0;
}
}
static void
-unpack_RGB9_E5_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR32323232_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = (const GLuint *) src;
GLuint i;
for (i = 0; i < n; i++) {
- rgb9e5_to_float3(s[i], dst[i]);
- dst[i][ACOMP] = 1.0F;
+ 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] = 1.0;
}
}
static void
-unpack_R11_G11_B10_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
+unpack_XBGR32323232_SINT(const void *src, GLfloat dst[][4], GLuint n)
{
- const GLuint *s = (const GLuint *) src;
+ const GLint *s = (const GLint *) src;
GLuint i;
for (i = 0; i < n; i++) {
- r11g11b10f_to_float3(s[i], dst[i]);
- dst[i][ACOMP] = 1.0F;
+ 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] = 1.0;
}
}
table[MESA_FORMAT_GR88] = unpack_GR88;
table[MESA_FORMAT_RG88] = unpack_RG88;
table[MESA_FORMAT_R16] = unpack_R16;
+ table[MESA_FORMAT_GR1616] = unpack_GR1616;
table[MESA_FORMAT_RG1616] = unpack_RG1616;
- table[MESA_FORMAT_RG1616_REV] = unpack_RG1616_REV;
table[MESA_FORMAT_ARGB2101010] = unpack_ARGB2101010;
+ table[MESA_FORMAT_ARGB2101010_UINT] = unpack_ARGB2101010_UINT;
+ table[MESA_FORMAT_ABGR2101010_UINT] = unpack_ABGR2101010_UINT;
table[MESA_FORMAT_Z24_S8] = unpack_Z24_S8;
table[MESA_FORMAT_S8_Z24] = unpack_S8_Z24;
table[MESA_FORMAT_Z16] = unpack_Z16;
table[MESA_FORMAT_RG_FLOAT32] = unpack_RG_FLOAT32;
table[MESA_FORMAT_RG_FLOAT16] = unpack_RG_FLOAT16;
+ table[MESA_FORMAT_ALPHA_UINT8] = unpack_ALPHA_UINT8;
+ table[MESA_FORMAT_ALPHA_UINT16] = unpack_ALPHA_UINT16;
+ table[MESA_FORMAT_ALPHA_UINT32] = unpack_ALPHA_UINT32;
+ table[MESA_FORMAT_ALPHA_INT8] = unpack_ALPHA_INT8;
+ table[MESA_FORMAT_ALPHA_INT16] = unpack_ALPHA_INT16;
+ table[MESA_FORMAT_ALPHA_INT32] = unpack_ALPHA_INT32;
+
+ table[MESA_FORMAT_INTENSITY_UINT8] = unpack_INTENSITY_UINT8;
+ table[MESA_FORMAT_INTENSITY_UINT16] = unpack_INTENSITY_UINT16;
+ table[MESA_FORMAT_INTENSITY_UINT32] = unpack_INTENSITY_UINT32;
+ table[MESA_FORMAT_INTENSITY_INT8] = unpack_INTENSITY_INT8;
+ table[MESA_FORMAT_INTENSITY_INT16] = unpack_INTENSITY_INT16;
+ table[MESA_FORMAT_INTENSITY_INT32] = unpack_INTENSITY_INT32;
+
+ table[MESA_FORMAT_LUMINANCE_UINT8] = unpack_LUMINANCE_UINT8;
+ table[MESA_FORMAT_LUMINANCE_UINT16] = unpack_LUMINANCE_UINT16;
+ table[MESA_FORMAT_LUMINANCE_UINT32] = unpack_LUMINANCE_UINT32;
+ table[MESA_FORMAT_LUMINANCE_INT8] = unpack_LUMINANCE_INT8;
+ table[MESA_FORMAT_LUMINANCE_INT16] = unpack_LUMINANCE_INT16;
+ table[MESA_FORMAT_LUMINANCE_INT32] = unpack_LUMINANCE_INT32;
+
+ table[MESA_FORMAT_LUMINANCE_ALPHA_UINT8] = unpack_LUMINANCE_ALPHA_UINT8;
+ table[MESA_FORMAT_LUMINANCE_ALPHA_UINT16] = unpack_LUMINANCE_ALPHA_UINT16;
+ table[MESA_FORMAT_LUMINANCE_ALPHA_UINT32] = unpack_LUMINANCE_ALPHA_UINT32;
+ table[MESA_FORMAT_LUMINANCE_ALPHA_INT8] = unpack_LUMINANCE_ALPHA_INT8;
+ table[MESA_FORMAT_LUMINANCE_ALPHA_INT16] = unpack_LUMINANCE_ALPHA_INT16;
+ table[MESA_FORMAT_LUMINANCE_ALPHA_INT32] = unpack_LUMINANCE_ALPHA_INT32;
+
+ table[MESA_FORMAT_R_INT8] = unpack_R_INT8;
+ table[MESA_FORMAT_RG_INT8] = unpack_RG_INT8;
+ table[MESA_FORMAT_RGB_INT8] = unpack_RGB_INT8;
table[MESA_FORMAT_RGBA_INT8] = unpack_RGBA_INT8;
+ table[MESA_FORMAT_R_INT16] = unpack_R_INT16;
+ table[MESA_FORMAT_RG_INT16] = unpack_RG_INT16;
+ table[MESA_FORMAT_RGB_INT16] = unpack_RGB_INT16;
table[MESA_FORMAT_RGBA_INT16] = unpack_RGBA_INT16;
+ table[MESA_FORMAT_R_INT32] = unpack_R_INT32;
+ table[MESA_FORMAT_RG_INT32] = unpack_RG_INT32;
+ table[MESA_FORMAT_RGB_INT32] = unpack_RGB_INT32;
table[MESA_FORMAT_RGBA_INT32] = unpack_RGBA_INT32;
+ table[MESA_FORMAT_R_UINT8] = unpack_R_UINT8;
+ table[MESA_FORMAT_RG_UINT8] = unpack_RG_UINT8;
+ table[MESA_FORMAT_RGB_UINT8] = unpack_RGB_UINT8;
table[MESA_FORMAT_RGBA_UINT8] = unpack_RGBA_UINT8;
+ table[MESA_FORMAT_R_UINT16] = unpack_R_UINT16;
+ table[MESA_FORMAT_RG_UINT16] = unpack_RG_UINT16;
+ table[MESA_FORMAT_RGB_UINT16] = unpack_RGB_UINT16;
table[MESA_FORMAT_RGBA_UINT16] = unpack_RGBA_UINT16;
+ table[MESA_FORMAT_R_UINT32] = unpack_R_UINT32;
+ table[MESA_FORMAT_RG_UINT32] = unpack_RG_UINT32;
+ table[MESA_FORMAT_RGB_UINT32] = unpack_RGB_UINT32;
table[MESA_FORMAT_RGBA_UINT32] = unpack_RGBA_UINT32;
table[MESA_FORMAT_DUDV8] = unpack_DUDV8;
table[MESA_FORMAT_SIGNED_LA_LATC2] = unpack_SIGNED_LA_LATC2;
table[MESA_FORMAT_ETC1_RGB8] = unpack_ETC1_RGB8;
-
+ table[MESA_FORMAT_ETC2_RGB8] = unpack_ETC2_RGB8;
+ table[MESA_FORMAT_ETC2_SRGB8] = unpack_ETC2_SRGB8;
+ table[MESA_FORMAT_ETC2_RGBA8_EAC] = unpack_ETC2_RGBA8_EAC;
+ table[MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC] = unpack_ETC2_SRGB8_ALPHA8_EAC;
+ table[MESA_FORMAT_ETC2_R11_EAC] = unpack_ETC2_R11_EAC;
+ table[MESA_FORMAT_ETC2_RG11_EAC] = unpack_ETC2_RG11_EAC;
+ table[MESA_FORMAT_ETC2_SIGNED_R11_EAC] = unpack_ETC2_SIGNED_R11_EAC;
+ table[MESA_FORMAT_ETC2_SIGNED_RG11_EAC] = unpack_ETC2_SIGNED_RG11_EAC;
+ table[MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1] =
+ unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
+ table[MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1] =
+ unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1;
table[MESA_FORMAT_SIGNED_A8] = unpack_SIGNED_A8;
table[MESA_FORMAT_SIGNED_L8] = unpack_SIGNED_L8;
table[MESA_FORMAT_SIGNED_AL88] = unpack_SIGNED_AL88;
table[MESA_FORMAT_Z32_FLOAT] = unpack_Z32_FLOAT;
table[MESA_FORMAT_Z32_FLOAT_X24S8] = unpack_Z32_FLOAT_X24S8;
+ table[MESA_FORMAT_XRGB4444_UNORM] = unpack_XRGB4444_UNORM;
+ table[MESA_FORMAT_XRGB1555_UNORM] = unpack_XRGB1555_UNORM;
+ table[MESA_FORMAT_XBGR8888_SNORM] = unpack_XBGR8888_SNORM;
+ table[MESA_FORMAT_XBGR8888_SRGB] = unpack_XBGR8888_SRGB;
+ table[MESA_FORMAT_XBGR8888_UINT] = unpack_XBGR8888_UINT;
+ table[MESA_FORMAT_XBGR8888_SINT] = unpack_XBGR8888_SINT;
+ table[MESA_FORMAT_XRGB2101010_UNORM] = unpack_XRGB2101010_UNORM;
+ table[MESA_FORMAT_XBGR16161616_UNORM] = unpack_XBGR16161616_UNORM;
+ table[MESA_FORMAT_XBGR16161616_SNORM] = unpack_XBGR16161616_SNORM;
+ table[MESA_FORMAT_XBGR16161616_FLOAT] = unpack_XBGR16161616_FLOAT;
+ table[MESA_FORMAT_XBGR16161616_UINT] = unpack_XBGR16161616_UINT;
+ table[MESA_FORMAT_XBGR16161616_SINT] = unpack_XBGR16161616_SINT;
+ table[MESA_FORMAT_XBGR32323232_FLOAT] = unpack_XBGR32323232_FLOAT;
+ table[MESA_FORMAT_XBGR32323232_UINT] = unpack_XBGR32323232_UINT;
+ table[MESA_FORMAT_XBGR32323232_SINT] = unpack_XBGR32323232_SINT;
+
initialized = GL_TRUE;
}
+ if (table[format] == NULL) {
+ _mesa_problem(NULL, "unsupported unpack for format %s",
+ _mesa_get_format_name(format));
+ }
+
return table[format];
}
default:
/* get float values, convert to ubyte */
{
- GLfloat *tmp = (GLfloat *) malloc(n * 4 * sizeof(GLfloat));
+ GLfloat *tmp = malloc(n * 4 * sizeof(GLfloat));
if (tmp) {
GLuint i;
_mesa_unpack_rgba_row(format, n, src, (GLfloat (*)[4]) tmp);
}
}
+static void
+unpack_int_rgba_ARGB8888(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLubyte) src[i * 4 + 2];
+ dst[i][GCOMP] = (GLubyte) src[i * 4 + 1];
+ dst[i][BCOMP] = (GLubyte) src[i * 4 + 0];
+ dst[i][ACOMP] = (GLubyte) src[i * 4 + 3];
+ }
+}
+
+static void
+unpack_int_rgba_XRGB8888(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLubyte) src[i * 4 + 2];
+ dst[i][GCOMP] = (GLubyte) src[i * 4 + 1];
+ dst[i][BCOMP] = (GLubyte) src[i * 4 + 0];
+ dst[i][ACOMP] = (GLubyte) 0xff;
+ }
+}
+
static void
unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
{
}
}
+static void
+unpack_int_rgba_ABGR2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ GLuint tmp = src[i];
+ dst[i][0] = (tmp >> 0) & 0x3ff;
+ dst[i][1] = (tmp >> 10) & 0x3ff;
+ dst[i][2] = (tmp >> 20) & 0x3ff;
+ dst[i][3] = (tmp >> 30) & 0x3;
+ }
+}
+
+static void
+unpack_int_rgba_ARGB2101010(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ GLuint tmp = src[i];
+ dst[i][0] = (tmp >> 20) & 0x3ff;
+ dst[i][1] = (tmp >> 10) & 0x3ff;
+ dst[i][2] = (tmp >> 0) & 0x3ff;
+ dst[i][3] = (tmp >> 30) & 0x3;
+ }
+}
+
+static void
+unpack_int_rgba_XBGR8888_UINT(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_XBGR8888_SINT(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_XBGR16161616_UINT(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_XBGR16161616_SINT(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_XBGR32323232_UINT(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 4 + 0];
+ dst[i][1] = src[i * 4 + 1];
+ dst[i][2] = src[i * 4 + 2];
+ dst[i][3] = 1;
+ }
+}
+
void
_mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
const void *src, GLuint dst[][4])
unpack_int_rgba_RGBA_INT8(src, dst, n);
break;
+ case MESA_FORMAT_ARGB8888:
+ unpack_int_rgba_ARGB8888(src, dst, n);
+ break;
+
+ case MESA_FORMAT_XRGB8888:
+ unpack_int_rgba_XRGB8888(src, dst, n);
+ break;
+
case MESA_FORMAT_RGB_UINT32:
case MESA_FORMAT_RGB_INT32:
unpack_int_rgba_RGB_UINT32(src, dst, n);
case MESA_FORMAT_ARGB2101010_UINT:
unpack_int_rgba_ARGB2101010_UINT(src, dst, n);
break;
+
+ case MESA_FORMAT_ABGR2101010_UINT:
+ unpack_int_rgba_ABGR2101010_UINT(src, dst, n);
+ break;
+
+ case MESA_FORMAT_ARGB2101010:
+ unpack_int_rgba_ARGB2101010(src, dst, n);
+ break;
+
+ case MESA_FORMAT_XBGR8888_UINT:
+ unpack_int_rgba_XBGR8888_UINT(src, dst, n);
+ break;
+
+ case MESA_FORMAT_XBGR8888_SINT:
+ unpack_int_rgba_XBGR8888_SINT(src, dst, n);
+ break;
+
+ case MESA_FORMAT_XBGR16161616_UINT:
+ unpack_int_rgba_XBGR16161616_UINT(src, dst, n);
+ break;
+
+ case MESA_FORMAT_XBGR16161616_SINT:
+ unpack_int_rgba_XBGR16161616_SINT(src, dst, n);
+ break;
+
+ case MESA_FORMAT_XBGR32323232_UINT:
+ case MESA_FORMAT_XBGR32323232_SINT:
+ unpack_int_rgba_XBGR32323232_UINT(src, dst, n);
+ break;
+
default:
_mesa_problem(NULL, "%s: bad format %s", __FUNCTION__,
_mesa_get_format_name(format));
const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
GLuint i;
for (i = 0; i < n; i++) {
- dst[i] = (s[i] >> 8) * scale;
+ dst[i] = (GLfloat) ((s[i] >> 8) * scale);
ASSERT(dst[i] >= 0.0F);
ASSERT(dst[i] <= 1.0F);
}
const GLdouble scale = 1.0 / (GLdouble) 0xffffff;
GLuint i;
for (i = 0; i < n; i++) {
- dst[i] = (s[i] & 0x00ffffff) * scale;
+ dst[i] = (GLfloat) ((s[i] & 0x00ffffff) * scale);
ASSERT(dst[i] >= 0.0F);
ASSERT(dst[i] <= 1.0F);
}
static void
unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst)
{
- const GLfloat *s = ((const GLfloat *) src);
+ const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
GLuint i;
for (i = 0; i < n; i++) {
- dst[i] = s[i * 2];
+ dst[i] = s[i].z;
}
}
const float *s = (const float *)src;
GLuint i;
for (i = 0; i < n; i++) {
- dst[i] = FLOAT_TO_UINT(IROUND(CLAMP((s[i]), 0.0F, 1.0F)));
+ dst[i] = FLOAT_TO_UINT(CLAMP(s[i], 0.0F, 1.0F));
}
}
static void
unpack_uint_z_Z32_FLOAT_X24S8(const void *src, GLuint *dst, GLuint n)
{
- struct z32f_x24s8 {
- float z;
- uint32_t x24s8;
- };
-
const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
GLuint i;
for (i = 0; i < n; i++) {
- dst[i] = FLOAT_TO_UINT(IROUND(CLAMP((s[i].z), 0.0F, 1.0F)));
+ dst[i] = FLOAT_TO_UINT(CLAMP(s[i].z, 0.0F, 1.0F));
}
}
unpack_ubyte_s_Z32_FLOAT_X24S8(const void *src, GLubyte *dst, GLuint n)
{
GLuint i;
- const GLuint *src32 = src;
+ const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
for (i = 0; i < n; i++)
- dst[i] = src32[i * 2 + 1] & 0xff;
+ dst[i] = s[i].x24s8 & 0xff;
}
void