fetch_texel_3d_f_rgba8888, /* FetchTexel3Df */
};
-const struct gl_texture_format _mesa_texformat_abgr8888 = {
- MESA_FORMAT_ABGR8888, /* MesaFormat */
+const struct gl_texture_format _mesa_texformat_rgba8888_rev = {
+ MESA_FORMAT_RGBA8888_REV, /* MesaFormat */
GL_RGBA, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
- _mesa_texstore_abgr8888, /* StoreTexImageFunc */
- fetch_texel_1d_abgr8888, /* FetchTexel1D */
- fetch_texel_2d_abgr8888, /* FetchTexel2D */
- fetch_texel_3d_abgr8888, /* FetchTexel3D */
- fetch_texel_1d_f_abgr8888, /* FetchTexel1Df */
- fetch_texel_2d_f_abgr8888, /* FetchTexel2Df */
- fetch_texel_3d_f_abgr8888, /* FetchTexel3Df */
+ _mesa_texstore_rgba8888, /* StoreTexImageFunc */
+ fetch_texel_1d_rgba8888_rev, /* FetchTexel1D */
+ fetch_texel_2d_rgba8888_rev, /* FetchTexel2D */
+ fetch_texel_3d_rgba8888_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_rgba8888_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba8888_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgba8888_rev, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_argb8888 = {
fetch_texel_3d_f_argb8888, /* FetchTexel3Df */
};
-const struct gl_texture_format _mesa_texformat_bgra8888 = {
- MESA_FORMAT_BGRA8888, /* MesaFormat */
+const struct gl_texture_format _mesa_texformat_argb8888_rev = {
+ MESA_FORMAT_ARGB8888_REV, /* MesaFormat */
GL_RGBA, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
8, /* RedBits */
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
- _mesa_texstore_bgra8888, /* StoreTexImageFunc */
- fetch_texel_1d_bgra8888, /* FetchTexel1D */
- fetch_texel_2d_bgra8888, /* FetchTexel2D */
- fetch_texel_3d_bgra8888, /* FetchTexel3D */
- fetch_texel_1d_f_bgra8888, /* FetchTexel1Df */
- fetch_texel_2d_f_bgra8888, /* FetchTexel2Df */
- fetch_texel_3d_f_bgra8888, /* FetchTexel3Df */
+ _mesa_texstore_argb8888, /* StoreTexImageFunc */
+ fetch_texel_1d_argb8888_rev, /* FetchTexel1D */
+ fetch_texel_2d_argb8888_rev, /* FetchTexel2D */
+ fetch_texel_3d_argb8888_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_argb8888_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb8888_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb8888_rev, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgb888 = {
fetch_texel_3d_f_rgb565, /* FetchTexel3Df */
};
-const struct gl_texture_format _mesa_texformat_bgr565 = {
- MESA_FORMAT_BGR565, /* MesaFormat */
+const struct gl_texture_format _mesa_texformat_rgb565_rev = {
+ MESA_FORMAT_RGB565_REV, /* MesaFormat */
GL_RGB, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
5, /* RedBits */
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- _mesa_texstore_bgr565, /* StoreTexImageFunc */
- fetch_texel_1d_bgr565, /* FetchTexel1D */
- fetch_texel_2d_bgr565, /* FetchTexel2D */
- fetch_texel_3d_bgr565, /* FetchTexel3D */
- fetch_texel_1d_f_bgr565, /* FetchTexel1Df */
- fetch_texel_2d_f_bgr565, /* FetchTexel2Df */
- fetch_texel_3d_f_bgr565, /* FetchTexel3Df */
+ _mesa_texstore_rgb565, /* StoreTexImageFunc */
+ fetch_texel_1d_rgb565_rev, /* FetchTexel1D */
+ fetch_texel_2d_rgb565_rev, /* FetchTexel2D */
+ fetch_texel_3d_rgb565_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb565_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb565_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb565_rev, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_argb4444 = {
fetch_texel_3d_f_argb4444, /* FetchTexel3Df */
};
-const struct gl_texture_format _mesa_texformat_bgra4444 = {
- MESA_FORMAT_BGRA4444, /* MesaFormat */
+const struct gl_texture_format _mesa_texformat_argb4444_rev = {
+ MESA_FORMAT_ARGB4444_REV, /* MesaFormat */
GL_RGBA, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /* RedBits */
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- _mesa_texstore_bgra4444, /* StoreTexImageFunc */
- fetch_texel_1d_bgra4444, /* FetchTexel1D */
- fetch_texel_2d_bgra4444, /* FetchTexel2D */
- fetch_texel_3d_bgra4444, /* FetchTexel3D */
- fetch_texel_1d_f_bgra4444, /* FetchTexel1Df */
- fetch_texel_2d_f_bgra4444, /* FetchTexel2Df */
- fetch_texel_3d_f_bgra4444, /* FetchTexel3Df */
+ _mesa_texstore_argb4444, /* StoreTexImageFunc */
+ fetch_texel_1d_argb4444_rev, /* FetchTexel1D */
+ fetch_texel_2d_argb4444_rev, /* FetchTexel2D */
+ fetch_texel_3d_argb4444_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_argb4444_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb4444_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb4444_rev, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_argb1555 = {
fetch_texel_3d_f_argb1555, /* FetchTexel3Df */
};
-const struct gl_texture_format _mesa_texformat_bgra5551 = {
- MESA_FORMAT_BGRA5551, /* MesaFormat */
+const struct gl_texture_format _mesa_texformat_argb1555_rev = {
+ MESA_FORMAT_ARGB1555_REV, /* MesaFormat */
GL_RGBA, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
5, /* RedBits */
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- _mesa_texstore_bgra5551, /* StoreTexImageFunc */
- fetch_texel_1d_bgra5551, /* FetchTexel1D */
- fetch_texel_2d_bgra5551, /* FetchTexel2D */
- fetch_texel_3d_bgra5551, /* FetchTexel3D */
- fetch_texel_1d_f_bgra5551, /* FetchTexel1Df */
- fetch_texel_2d_f_bgra5551, /* FetchTexel2Df */
- fetch_texel_3d_f_bgra5551, /* FetchTexel3Df */
+ _mesa_texstore_argb1555, /* StoreTexImageFunc */
+ fetch_texel_1d_argb1555_rev, /* FetchTexel1D */
+ fetch_texel_2d_argb1555_rev, /* FetchTexel2D */
+ fetch_texel_3d_argb1555_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_argb1555_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb1555_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb1555_rev, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_al88 = {
fetch_texel_3d_f_al88, /* FetchTexel3Df */
};
-const struct gl_texture_format _mesa_texformat_la88 = {
- MESA_FORMAT_LA88, /* MesaFormat */
+const struct gl_texture_format _mesa_texformat_al88_rev = {
+ MESA_FORMAT_AL88_REV, /* MesaFormat */
GL_LUMINANCE_ALPHA, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
0, /* RedBits */
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- _mesa_texstore_la88, /* StoreTexImageFunc */
- fetch_texel_1d_la88, /* FetchTexel1D */
- fetch_texel_2d_la88, /* FetchTexel2D */
- fetch_texel_3d_la88, /* FetchTexel3D */
- fetch_texel_1d_f_la88, /* FetchTexel1Df */
- fetch_texel_2d_f_la88, /* FetchTexel2Df */
- fetch_texel_3d_f_la88, /* FetchTexel3Df */
+ _mesa_texstore_al88, /* StoreTexImageFunc */
+ fetch_texel_1d_al88_rev, /* FetchTexel1D */
+ fetch_texel_2d_al88_rev, /* FetchTexel2D */
+ fetch_texel_3d_al88_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_al88_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_al88_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_al88_rev, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgb332 = {
case GL_RGB5_A1:
return &_mesa_texformat_argb1555;
case GL_RGBA2:
+ return &_mesa_texformat_argb4444_rev; /* just to test another format*/
case GL_RGBA4:
return &_mesa_texformat_argb4444;
/* RGB formats */
case 3:
case GL_RGB:
- case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
return &_mesa_texformat_rgb;
+ case GL_RGB8:
+ return &_mesa_texformat_rgb888;
case GL_R3_G3_B2:
return &_mesa_texformat_rgb332;
case GL_RGB4:
+ return &_mesa_texformat_rgb565_rev; /* just to test another format */
case GL_RGB5:
return &_mesa_texformat_rgb565;
((GLubyte *)(t)->Data + (i) * (sz))
#define USHORT_SRC( t, i, j, k ) \
((GLushort *)(t)->Data + (i))
+#define UINT_SRC( t, i, j, k ) \
+ ((GLuint *)(t)->Data + (i))
#define FLOAT_SRC( t, i, j, k, sz ) \
((GLfloat *)(t)->Data + (i) * (sz))
#define HALF_SRC( t, i, j, k, sz ) \
((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
#define USHORT_SRC( t, i, j, k ) \
((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i)))
+#define UINT_SRC( t, i, j, k ) \
+ ((GLuint *)(t)->Data + ((t)->RowStride * (j) + (i)))
#define FLOAT_SRC( t, i, j, k, sz ) \
((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
#define HALF_SRC( t, i, j, k, sz ) \
#define USHORT_SRC( t, i, j, k ) \
((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->RowStride + (i)))
+#define UINT_SRC( t, i, j, k ) \
+ ((GLuint *)(t)->Data + (((t)->Height * (k) + (j)) * \
+ (t)->RowStride + (i)))
#define FLOAT_SRC( t, i, j, k, sz ) \
((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->RowStride + (i)) * (sz))
#endif
-/* Fetch color texel from 1D, 2D or 3D RGBA texture, returning 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLchans */
static void FETCH(rgba)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
COPY_CHAN4( texel, src );
}
-/* Fetch color texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */
static void FETCH(f_rgba)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D RGB texture, returning 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLchans */
static void FETCH(rgb)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */
static void FETCH(f_rgb)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
texel[ACOMP] = CHAN_MAXF;
}
-/* Fetch color texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */
static void FETCH(alpha)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = src[0];
}
-/* Fetch color texel from 1D, 2D or 3D ALPHA texture, returning 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLfloats */
static void FETCH(f_alpha)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
}
-/* Fetch color texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */
static void FETCH(luminance)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */
static void FETCH(f_luminance)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
texel[ACOMP] = CHAN_MAXF;
}
-/* Fetch color texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */
static void FETCH(luminance_alpha)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = src[1];
}
-/* Fetch color texel from 1D, 2D or 3D L_A texture, returning 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLfloats */
static void FETCH(f_luminance_alpha)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */
static void FETCH(intensity)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = src[0];
}
-/* Fetch color texel from 1D, 2D or 3D INT. texture, returning 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLfloats */
static void FETCH(f_intensity)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(rgba_f32)( const struct gl_texture_image *texImage,
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[3]);
}
-/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = src[3];
}
-/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(rgba_f16)( const struct gl_texture_image *texImage,
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[3]));
}
-/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
texel[ACOMP] = _mesa_half_to_float(src[3]);
}
-/* Fetch color texel from 1D, 2D or 3D RGB_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(rgb_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D RGB_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAXF;
}
-/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(rgb_f16)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D RGB_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAXF;
}
-/* Fetch color texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(alpha_f32)( const struct gl_texture_image *texImage,
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[0]);
}
-/* Fetch color texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = src[0];
}
-/* Fetch color texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(alpha_f16)( const struct gl_texture_image *texImage,
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[0]));
}
-/* Fetch color texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
texel[ACOMP] = _mesa_half_to_float(src[0]);
}
-/* Fetch color texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAXF;
}
-/* Fetch color texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_f16)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAXF;
}
-/* Fetch color texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_alpha_f32)( const struct gl_texture_image *texImage,
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[1]);
}
-/* Fetch color texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = src[1];
}
-/* Fetch color texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(luminance_alpha_f16)( const struct gl_texture_image *texImage,
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[1]));
}
-/* Fetch color texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage,
texel[ACOMP] = _mesa_half_to_float(src[1]);
}
-/* Fetch color texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(intensity_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = texel[RCOMP];
}
-/* Fetch color texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = src[0];
}
-/* Fetch color texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(intensity_f16)( const struct gl_texture_image *texImage,
texel[ACOMP] = texel[RCOMP];
}
-/* Fetch color texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
+/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
* Begin Hardware formats
*/
-/* Fetch color texel from 1D, 2D or 3D rgba8888 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLchans */
static void FETCH(rgba8888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = UBYTE_TO_CHAN( src[3] );
- texel[GCOMP] = UBYTE_TO_CHAN( src[2] );
- texel[BCOMP] = UBYTE_TO_CHAN( src[1] );
- texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( (s >> 24) );
+ texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff );
+ texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff );
}
-/* Fetch color texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = UBYTE_TO_FLOAT( src[3] );
- texel[GCOMP] = UBYTE_TO_FLOAT( src[2] );
- texel[BCOMP] = UBYTE_TO_FLOAT( src[1] );
- texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
}
-/* Fetch color texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
-static void FETCH(abgr8888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
+static void FETCH(rgba8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = UBYTE_TO_CHAN( src[0] );
- texel[GCOMP] = UBYTE_TO_CHAN( src[1] );
- texel[BCOMP] = UBYTE_TO_CHAN( src[2] );
- texel[ACOMP] = UBYTE_TO_CHAN( src[3] );
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( (s ) & 0xff );
+ texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
+ texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) );
}
-/* Fetch color texel from 1D, 2D or 3D abgr8888 texture, return 4 GLfloats */
-static void FETCH(f_abgr8888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLfloats */
+static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = UBYTE_TO_FLOAT( src[0] );
- texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
- texel[BCOMP] = UBYTE_TO_FLOAT( src[2] );
- texel[ACOMP] = UBYTE_TO_FLOAT( src[3] );
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) );
}
-/* Fetch color texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
static void FETCH(argb8888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = UBYTE_TO_CHAN( src[2] );
- texel[GCOMP] = UBYTE_TO_CHAN( src[1] );
- texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
- texel[ACOMP] = UBYTE_TO_CHAN( src[3] );
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
+ texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_CHAN( (s ) & 0xff );
+ texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) );
}
-/* Fetch color texel from 1D, 2D or 3D argb8888 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLfloats */
static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
- texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
- texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
- texel[ACOMP] = UBYTE_TO_FLOAT( src[3] );
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
+ texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) );
}
-/* Fetch color texel from 1D, 2D or 3D bgra8888 texture, return 4 GLchans */
-static void FETCH(bgra8888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLchans */
+static void FETCH(argb8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = UBYTE_TO_CHAN( src[1] );
- texel[GCOMP] = UBYTE_TO_CHAN( src[2] );
- texel[BCOMP] = UBYTE_TO_CHAN( src[3] );
- texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff );
+ texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_CHAN( (s >> 24) );
+ texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff );
}
-/* Fetch color texel from 1D, 2D or 3D bgra8888 texture, return 4 GLfloats */
-static void FETCH(f_bgra8888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+
+/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
+static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = UBYTE_TO_FLOAT( src[1] );
- texel[GCOMP] = UBYTE_TO_FLOAT( src[2] );
- texel[BCOMP] = UBYTE_TO_FLOAT( src[3] );
- texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
+ const GLuint s = *UINT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
+ texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
}
-/* Fetch color texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
static void FETCH(rgb888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D rgb888 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLfloats */
static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
static void FETCH(bgr888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D bgr888 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLfloats */
static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
static void FETCH(rgb565)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D rgb565 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLfloats */
static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D bgr565 texture, return 4 GLchans */
-static void FETCH(bgr565)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
+static void FETCH(rgb565_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
- const GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
+ const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 );
texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc );
- texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D bgr565 texture, return 4 GLfloats */
-static void FETCH(f_bgr565)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLfloats */
+static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
- const GLushort s = *src;
- texel[RCOMP] = ((s << 3) & 0xf8) * (1.0F / 248.0F);
+ const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
+ texel[RCOMP] = ((s >> 8) & 0xf8) * (1.0F / 248.0F);
texel[GCOMP] = ((s >> 3) & 0xfc) * (1.0F / 252.0F);
- texel[BCOMP] = ((s >> 8) & 0xf8) * (1.0F / 248.0F);
+ texel[BCOMP] = ((s << 3) & 0xf8) * (1.0F / 248.0F);
texel[ACOMP] = CHAN_MAXF;
}
-/* Fetch color texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
static void FETCH(argb4444)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
}
-/* Fetch color texel from 1D, 2D or 3D argb4444 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D argb4444 texture, return 4 GLfloats */
static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D bgra444 texture, return 4 GLchans */
-static void FETCH(bgra4444)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
+static void FETCH(argb4444_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- const GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
- texel[ACOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
+ texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
}
-/* Fetch color texel from 1D, 2D or 3D bgra4444 texture, return 4 GLfloats */
-static void FETCH(f_bgra4444)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLfloats */
+static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- const GLushort s = *src;
- texel[RCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
- texel[GCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F);
- texel[BCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
- texel[ACOMP] = ((s ) & 0xf) * (1.0F / 15.0F);
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
+ texel[RCOMP] = ((s ) & 0xf) * (1.0F / 15.0F);
+ texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+ texel[BCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F);
+ texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
}
-/* Fetch color texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
static void FETCH(argb1555)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
}
-/* Fetch color texel from 1D, 2D or 3D argb1555 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLfloats */
static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D bgra5551 texture, return 4 GLchans */
-static void FETCH(bgra5551)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
+static void FETCH(argb1555_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
- const GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 1) & 0x1f) * 255 / 0x1f );
- texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 6) & 0x1f) * 255 / 0x1f );
- texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 11) & 0x1f) * 255 / 0x1f );
- texel[ACOMP] = UBYTE_TO_CHAN( ((s ) & 0x01) * 255 );
+ const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f );
+ texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
}
-/* Fetch color texel from 1D, 2D or 3D bgra5551 texture, return 4 GLfloats */
-static void FETCH(f_bgra5551)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLfloats */
+static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
- const GLushort s = *src;
- texel[RCOMP] = ((s >> 1) & 0x1f) * (1.0F / 31.0F);
- texel[GCOMP] = ((s >> 6) & 0x1f) * (1.0F / 31.0F);
- texel[BCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
- texel[ACOMP] = ((s ) & 0x01);
+ const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
+ texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F);
+ texel[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F);
+ texel[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F);
+ texel[ACOMP] = ((s >> 15) & 0x01);
}
-/* Fetch color texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
static void FETCH(al88)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 );
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
texel[RCOMP] =
texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
- texel[ACOMP] = UBYTE_TO_CHAN( src[1] );
+ texel[BCOMP] = UBYTE_TO_CHAN( s & 0xff );
+ texel[ACOMP] = UBYTE_TO_CHAN( s >> 8 );
}
-/* Fetch color texel from 1D, 2D or 3D al88 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLfloats */
static void FETCH(f_al88)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 );
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
texel[RCOMP] =
texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
- texel[ACOMP] = UBYTE_TO_FLOAT( src[1] );
+ texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
+ texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
}
-/* Fetch color texel from 1D, 2D or 3D la88 texture, return 4 GLchans */
-static void FETCH(la88)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
+static void FETCH(al88_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLchan *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 );
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
texel[RCOMP] =
texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_CHAN( src[1] );
- texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[BCOMP] = UBYTE_TO_CHAN( s >> 8 );
+ texel[ACOMP] = UBYTE_TO_CHAN( s & 0xff );
}
-/* Fetch color texel from 1D, 2D or 3D la88 texture, return 4 GLfloats */
-static void FETCH(f_la88)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLfloats */
+static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
- const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 );
+ const GLushort s = *USHORT_SRC( texImage, i, j, k );
texel[RCOMP] =
texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_FLOAT( src[1] );
- texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
+ texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
+ texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
}
-/* Fetch color texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
static void FETCH(rgb332)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D rgb332 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLfloats */
static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
static void FETCH(a8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
}
-/* Fetch color texel from 1D, 2D or 3D a8 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLfloats */
static void FETCH(f_a8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
static void FETCH(l8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D l8 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLfloats */
static void FETCH(f_l8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
static void FETCH(i8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
}
-/* Fetch color texel from 1D, 2D or 3D i8 texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLfloats */
static void FETCH(f_i8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
}
-/* Fetch color texel from 1D, 2D or 3D ycbcr texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLchans */
/* We convert YCbCr to RGB here */
/* XXX this may break if GLchan != GLubyte */
static void FETCH(ycbcr)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats */
/* We convert YCbCr to RGB here */
static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
}
-/* Fetch color texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLchans */
+/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLchans */
/* We convert YCbCr to RGB here */
/* XXX this may break if GLchan != GLubyte */
static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAX;
}
-/* Fetch color texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats */
+/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats */
/* We convert YCbCr to RGB here */
static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
#undef CHAN_SRC
#undef UBYTE_SRC
#undef USHORT_SRC
+#undef UINT_SRC
#undef FLOAT_SRC
#undef HALF_SRC
#undef FETCH
/**
- * Store an rgb565 texture image.
+ * Store an rgb565 or rgb565_rev texture image.
*/
GLboolean
_mesa_texstore_rgb565(STORE_PARAMS)
{
- ASSERT(dstFormat == &_mesa_texformat_rgb565);
+ ASSERT(dstFormat == &_mesa_texformat_rgb565 ||
+ dstFormat == &_mesa_texformat_rgb565_rev);
ASSERT(dstFormat->TexelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_rgb565 &&
baseInternalFormat == GL_RGB &&
srcFormat == GL_RGB &&
srcType == GL_UNSIGNED_SHORT_5_6_5) {
dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] );
srcUB += 3;
}
+ /* check for byteswapped format */
+ if (dstFormat == &_mesa_texformat_rgb565_rev) {
+ _mesa_swap2(dstUS, srcWidth);
+ }
dst += dstRowStride;
src += srcRowStride;
}
CHAN_TO_UBYTE(src[BCOMP]) );
src += 3;
}
- dstRow += dstRowStride;
- }
- dstImage += dstImageStride;
- }
- _mesa_free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-/**
- * Store an bgr565 texture image.
- */
-GLboolean
-_mesa_texstore_bgr565(STORE_PARAMS)
-{
- ASSERT(dstFormat == &_mesa_texformat_bgr565);
- ASSERT(dstFormat->TexelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGB &&
- srcFormat == GL_RGB &&
- srcType == GL_UNSIGNED_SHORT_5_6_5_REV) {
- /* simple memcpy path */
- memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGB &&
- srcFormat == GL_BGR &&
- srcType == GL_UNSIGNED_BYTE &&
- dims == 2) {
- /* do optimized tex store */
- const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth,
- srcFormat, srcType);
- const GLubyte *src = (const GLubyte *)
- _mesa_image_address(srcPacking, srcAddr, srcWidth, srcHeight,
- srcFormat, srcType, 0, 0, 0);
- GLubyte *dst = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint row, col;
- for (row = 0; row < srcHeight; row++) {
- const GLubyte *srcUB = (const GLubyte *) src;
- GLushort *dstUS = (GLushort *) dst;
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_565( srcUB[2], srcUB[1], srcUB[0] );
- srcUB += 3;
- }
- dst += dstRowStride;
- src += srcRowStride;
- }
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- dstFormat->BaseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUS = (GLushort *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[BCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[RCOMP]) );
- src += 3;
+ /* check for byteswapped format */
+ if (dstFormat == &_mesa_texformat_rgb565_rev) {
+ _mesa_swap2(dstUS, srcWidth);
}
dstRow += dstRowStride;
}
GLboolean
_mesa_texstore_rgba8888(STORE_PARAMS)
{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- ASSERT(dstFormat == &_mesa_texformat_rgba8888);
+ ASSERT(dstFormat == &_mesa_texformat_rgba8888 ||
+ dstFormat == &_mesa_texformat_rgba8888_rev);
ASSERT(dstFormat->TexelBytes == 4);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_rgba8888 &&
baseInternalFormat == GL_RGBA &&
- srcFormat == GL_RGBA &&
- ((srcType == GL_UNSIGNED_INT_8_8_8_8_REV && littleEndian) ||
- (srcType == GL_UNSIGNED_INT_8_8_8_8 && !littleEndian))) {
+ ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
+ (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV))) {
/* simple memcpy path */
memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
CHAN_TO_UBYTE(src[ACOMP]) );
src += 4;
}
- dstRow += dstRowStride;
- }
- dstImage += dstImageStride;
- }
- _mesa_free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-GLboolean
-_mesa_texstore_abgr8888(STORE_PARAMS)
-{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- ASSERT(dstFormat == &_mesa_texformat_abgr8888);
- ASSERT(dstFormat->TexelBytes == 4);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGBA &&
- srcFormat == GL_ABGR_EXT &&
- ((srcType == GL_UNSIGNED_INT_8_8_8_8_REV && littleEndian) ||
- (srcType == GL_UNSIGNED_INT_8_8_8_8 && !littleEndian))) {
- /* simple memcpy path */
- memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- dstFormat->BaseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- GLuint *dstUI = (GLuint *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[BCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[RCOMP]) );
- src += 4;
+ /* check for byteswapped format */
+ if (dstFormat == &_mesa_texformat_rgba8888_rev) {
+ _mesa_swap4(dstUI, srcWidth);
}
dstRow += dstRowStride;
}
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
- ASSERT(dstFormat == &_mesa_texformat_argb8888);
+ ASSERT(dstFormat == &_mesa_texformat_argb8888 ||
+ dstFormat == &_mesa_texformat_argb8888_rev);
ASSERT(dstFormat->TexelBytes == 4);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_argb8888 &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
((srcType == GL_UNSIGNED_BYTE && littleEndian) ||
- (srcType == GL_UNSIGNED_INT_8_8_8_8_REV && littleEndian) ||
- (srcType == GL_UNSIGNED_INT_8_8_8_8 && !littleEndian))) {
- /* simple memcpy path */
+ srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) {
+ /* simple memcpy path (little endian) */
memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- dstFormat->BaseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- GLuint *dstUI = (GLuint *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
- src += 4;
- }
- dstRow += dstRowStride;
- }
- dstImage += dstImageStride;
- }
- _mesa_free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-GLboolean
-_mesa_texstore_bgra8888(STORE_PARAMS)
-{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- ASSERT(dstFormat == &_mesa_texformat_bgra8888);
- ASSERT(dstFormat->TexelBytes == 4);
-
- if (!ctx->_ImageTransferState &&
+ else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_argb8888_rev &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
- (srcType == GL_UNSIGNED_INT_8_8_8_8_REV && !littleEndian) ||
- (srcType == GL_UNSIGNED_INT_8_8_8_8 && littleEndian))) {
- /* simple memcpy path */
+ srcType == GL_UNSIGNED_INT_8_8_8_8)) {
+ /* simple memcpy path (big endian) */
memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[BCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
+ dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]),
CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[ACOMP]) );
+ CHAN_TO_UBYTE(src[GCOMP]),
+ CHAN_TO_UBYTE(src[BCOMP]) );
src += 4;
}
+ if (dstFormat == &_mesa_texformat_argb8888_rev) {
+ _mesa_swap4(dstUI, srcWidth);
+ }
dstRow += dstRowStride;
}
dstImage += dstImageStride;
GLboolean
_mesa_texstore_argb4444(STORE_PARAMS)
{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- ASSERT(dstFormat == &_mesa_texformat_argb4444);
+ ASSERT(dstFormat == &_mesa_texformat_argb4444 ||
+ dstFormat == &_mesa_texformat_argb4444_rev);
ASSERT(dstFormat->TexelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_argb4444 &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
- ((srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV && littleEndian) ||
- (srcType == GL_UNSIGNED_SHORT_4_4_4_4 && !littleEndian))) {
+ srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
/* simple memcpy path */
memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
CHAN_TO_UBYTE(src[BCOMP]) );
src += 4;
}
- dstRow += dstRowStride;
- }
- dstImage += dstImageStride;
- }
- _mesa_free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-GLboolean
-_mesa_texstore_bgra4444(STORE_PARAMS)
-{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- ASSERT(dstFormat == &_mesa_texformat_bgra4444);
- ASSERT(dstFormat->TexelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGBA &&
- srcFormat == GL_BGRA &&
- ((srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV && !littleEndian) ||
- (srcType == GL_UNSIGNED_SHORT_4_4_4_4 && littleEndian))) {
- /* simple memcpy path */
- memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- dstFormat->BaseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUS = (GLushort *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[BCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[ACOMP]) );
- src += 4;
+ if (dstFormat == &_mesa_texformat_argb4444_rev) {
+ _mesa_swap2(dstUS, srcWidth);
}
dstRow += dstRowStride;
}
}
+
GLboolean
_mesa_texstore_argb1555(STORE_PARAMS)
{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- ASSERT(dstFormat == &_mesa_texformat_argb1555);
+ ASSERT(dstFormat == &_mesa_texformat_argb1555 ||
+ dstFormat == &_mesa_texformat_argb1555_rev);
ASSERT(dstFormat->TexelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_argb1555 &&
baseInternalFormat == GL_RGBA &&
srcFormat == GL_BGRA &&
- ((srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV && littleEndian) ||
- (srcType == GL_UNSIGNED_SHORT_5_5_5_1 && !littleEndian))) {
+ srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
/* simple memcpy path */
memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
CHAN_TO_UBYTE(src[BCOMP]) );
src += 4;
}
- dstRow += dstRowStride;
- }
- dstImage += dstImageStride;
- }
- _mesa_free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-GLboolean
-_mesa_texstore_bgra5551(STORE_PARAMS)
-{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- ASSERT(dstFormat == &_mesa_texformat_bgra5551);
- ASSERT(dstFormat->TexelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_RGBA &&
- srcFormat == GL_BGRA &&
- ((srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV && !littleEndian) ||
- (srcType == GL_UNSIGNED_SHORT_5_5_5_1 && littleEndian))) {
- /* simple memcpy path */
- memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- dstFormat->BaseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src =tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUS = (GLushort *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_5551( CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]),
- CHAN_TO_UBYTE(src[ACOMP]) );
- src += 4;
+ if (dstFormat == &_mesa_texformat_argb1555_rev) {
+ _mesa_swap2(dstUS, srcWidth);
}
dstRow += dstRowStride;
}
const GLuint ui = 1;
const GLubyte littleEndian = *((const GLubyte *) &ui);
- ASSERT(dstFormat == &_mesa_texformat_al88);
+ ASSERT(dstFormat == &_mesa_texformat_al88 ||
+ dstFormat == &_mesa_texformat_al88_rev);
ASSERT(dstFormat->TexelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == &_mesa_texformat_al88 &&
baseInternalFormat == GL_LUMINANCE_ALPHA &&
srcFormat == GL_LUMINANCE_ALPHA &&
srcType == GL_UNSIGNED_BYTE &&
CHAN_TO_UBYTE(src[RCOMP]) );
src += 2;
}
- dstRow += dstRowStride;
- }
- dstImage += dstImageStride;
- }
- _mesa_free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
-GLboolean
-_mesa_texstore_la88(STORE_PARAMS)
-{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- ASSERT(dstFormat == &_mesa_texformat_la88);
- ASSERT(dstFormat->TexelBytes == 2);
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == GL_LUMINANCE_ALPHA &&
- srcFormat == GL_LUMINANCE_ALPHA &&
- srcType == GL_UNSIGNED_BYTE &&
- !littleEndian) {
- /* simple memcpy path */
- memcpy_texture(dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageStride,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- dstFormat->BaseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint img, row, col;
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUS = (GLushort *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[ACOMP]) );
- src += 2;
+ if (dstFormat == &_mesa_texformat_al88_rev) {
+ _mesa_swap2(dstUS, srcWidth);
}
dstRow += dstRowStride;
}
return;
/* Begin hardware formats */
case MESA_FORMAT_RGBA8888:
- case MESA_FORMAT_ABGR8888:
+ case MESA_FORMAT_RGBA8888_REV:
case MESA_FORMAT_ARGB8888:
- case MESA_FORMAT_BGRA8888:
+ case MESA_FORMAT_ARGB8888_REV:
{
GLuint i, j, k;
const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA;
}
return;
case MESA_FORMAT_RGB565:
- case MESA_FORMAT_BGR565:
+ case MESA_FORMAT_RGB565_REV:
{
GLuint i, j, k;
const GLushort *rowA = (const GLushort *) srcRowA;
}
return;
case MESA_FORMAT_ARGB4444:
- case MESA_FORMAT_BGRA4444:
+ case MESA_FORMAT_ARGB4444_REV:
{
GLuint i, j, k;
const GLushort *rowA = (const GLushort *) srcRowA;
}
return;
case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_ARGB1555_REV: /* XXX broken? */
{
GLuint i, j, k;
const GLushort *rowA = (const GLushort *) srcRowA;
}
return;
case MESA_FORMAT_AL88:
+ case MESA_FORMAT_AL88_REV:
{
GLuint i, j, k;
const GLubyte (*rowA)[2] = (const GLubyte (*)[2]) srcRowA;