store_texel_signed_rgba8888 /* StoreTexel */
};
+const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = {
+ MESA_FORMAT_SIGNED_RGBA8888_REV, /* MesaFormat */
+ GL_RGBA, /* BaseFormat */
+ GL_SIGNED_NORMALIZED, /* DataType */
+ 8, /* RedBits */
+ 8, /* GreenBits */
+ 8, /* BlueBits */
+ 8, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* StencilBits */
+ 4, /* TexelBytes */
+ _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */
+ NULL, /* FetchTexel1D */
+ NULL, /* FetchTexel2D */
+ NULL, /* FetchTexel3D */
+ fetch_texel_1d_signed_rgba8888_rev, /* FetchTexel1Df */
+ fetch_texel_2d_signed_rgba8888_rev, /* FetchTexel2Df */
+ fetch_texel_3d_signed_rgba8888_rev, /* FetchTexel3Df */
+ store_texel_signed_rgba8888_rev /* StoreTexel */
+};
+
/*@}*/
return;
case MESA_FORMAT_SIGNED_RGBA8888:
+ case MESA_FORMAT_SIGNED_RGBA8888_REV:
*datatype = GL_BYTE;
*comps = 4;
return;
*/
/*@{*/
MESA_FORMAT_DUDV8,
- MESA_FORMAT_SIGNED_RGBA8888
+ MESA_FORMAT_SIGNED_RGBA8888,
+ MESA_FORMAT_SIGNED_RGBA8888_REV
/*@}*/
};
/*@{*/
extern const struct gl_texture_format _mesa_texformat_dudv8;
extern const struct gl_texture_format _mesa_texformat_signed_rgba8888;
+extern const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev;
/*@}*/
/** \name Assorted hardware-friendly formats */
texel[ACOMP] = 0;
}
-/* MESA_FORMAT_SIGNED_ARGB8888 ***********************************************/
+/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/
static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
}
#endif
+static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s ) & 0xff );
+ texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 8) & 0xff );
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
+ texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s >> 24) );
+}
+
+#if DIM == 3
+static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+
/* MESA_FORMAT_YCBCR *********************************************************/
}
/**
- * Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV.
+ * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV
*/
GLboolean
_mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
- ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888);
+ ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888 ||
+ dstFormat == &_mesa_texformat_signed_rgba8888_rev);
ASSERT(dstFormat->TexelBytes == 4);
if (!ctx->_ImageTransferState &&
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_signed_rgba8888_rev &&
+ baseInternalFormat == GL_RGBA &&
+ ((srcFormat == GL_RGBA && srcType == GL_BYTE && littleEndian) ||
+ (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) {
+ /* simple memcpy path */
+ memcpy_texture(ctx, dims,
+ dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride,
+ dstImageOffsets,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
else if (!ctx->_ImageTransferState &&
(srcType == GL_BYTE) &&
can_swizzle(baseInternalFormat) &&
/* dstmap - how to swizzle from RGBA to dst format:
*/
- if (littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) {
+ if ((littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) ||
+ (!littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888_rev)) {
dstmap[3] = 0;
dstmap[2] = 1;
dstmap[1] = 2;
srcRow += 4;
}
}
+ else {
+ for (col = 0; col < srcWidth; col++) {
+ dstUI[col] = PACK_COLOR_8888_REV( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]),
+ FLOAT_TO_BYTE_TEX(srcRow[GCOMP]),
+ FLOAT_TO_BYTE_TEX(srcRow[BCOMP]),
+ FLOAT_TO_BYTE_TEX(srcRow[ACOMP]) );
+ srcRow += 4;
+ }
+ }
dstRow += dstRowStride;
}
}