New "FetchTexelFuncF()" function returns texels in floating point format.
Only used for depth component images at this time.
Changed original FetchTexelFunc to return GLchan instead of GLvoid, removing
need for a bunch of ugly casts.
static void
fetch_intensity8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
- GLchan *rgba = (GLchan *) texelOut;
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
const GLubyte *texel;
static void
fetch_luminance8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
- GLchan *rgba = (GLchan *) texelOut;
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
const GLubyte *texel;
static void
fetch_alpha8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
- GLchan *rgba = (GLchan *) texelOut;
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
const GLubyte *texel;
static void
fetch_index8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
(void) mml;
static void
fetch_luminance8_alpha8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
- GLchan *rgba = (GLchan *) texelOut;
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
const GLubyte *texel;
- i = i * mml->wScale;
- j = j * mml->hScale;
+ i = i * mml->wScale;
+ j = j * mml->hScale;
- texel = ((GLubyte *) texImage->Data) + (j * mml->width + i) * 2;
- rgba[RCOMP] = texel[0];
- rgba[GCOMP] = texel[0];
- rgba[BCOMP] = texel[0];
- rgba[ACOMP] = texel[1];
+ texel = ((GLubyte *) texImage->Data) + (j * mml->width + i) * 2;
+ rgba[RCOMP] = texel[0];
+ rgba[GCOMP] = texel[0];
+ rgba[BCOMP] = texel[0];
+ rgba[ACOMP] = texel[1];
}
static void
fetch_r5g6b5(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
- GLchan *rgba = (GLchan *) texelOut;
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
const GLushort *texel;
static void
fetch_r4g4b4a4(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
- GLchan *rgba = (GLchan *) texelOut;
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
const GLushort *texel;
static void
fetch_r5g5b5a1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
- GLchan *rgba = (GLchan *) texelOut;
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
const GLushort *texel;
static void
fetch_a8r8g8b8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid * texelOut)
+ GLint i, GLint j, GLint k, GLchan * rgba)
{
- GLchan *rgba = (GLchan *) texelOut;
const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
const GLuint *texel;
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
+
/**
- * Texel fetch function prototype.
+ * Texel fetch function prototype. We use texel fetch functions to
+ * extract RGBA, color indexes and depth components out of 1D, 2D and 3D
+ * texture images. These functions help to isolate us from the gritty
+ * details of all the various texture image encodings.
*
* \param texImage texture image.
* \param col texel column.
* \param row texel row.
- * \param img texel level.
- * \param texelOut output texel. If \p texImage is color-index, \p texelOut
- * returns <tt>GLchan[1]</tt>. If \p texImage is depth, \p texelOut returns
- * <tt>GLfloat[1]</tt>. Otherwise, \p texelOut returns <tt>GLchan[4]</tt>.
+ * \param img texel image level/layer.
+ * \param texelOut output texel (up to 4 GLchans)
+ */
+typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ GLchan *texelOut );
+
+/**
+ * As above, but returns floats.
+ * Used for depth component images and for upcoming signed/float
+ * texture images.
*/
-typedef void (*FetchTexelFunc)( const struct gl_texture_image *texImage,
- GLint col, GLint row, GLint img,
- GLvoid *texelOut );
+typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ GLfloat *texelOut );
/**
* Texture format record
* \name Texel fetch function pointers
*/
/*@{*/
- FetchTexelFunc FetchTexel1D;
- FetchTexelFunc FetchTexel2D;
- FetchTexelFunc FetchTexel3D;
+ FetchTexelFuncC FetchTexel1D;
+ FetchTexelFuncC FetchTexel2D;
+ FetchTexelFuncC FetchTexel3D;
+ FetchTexelFuncF FetchTexel1Df;
+ FetchTexelFuncF FetchTexel2Df;
+ FetchTexelFuncF FetchTexel3Df;
/*@}*/
};
const struct gl_texture_format *TexFormat;
- FetchTexelFunc FetchTexel; /**< Texel fetch function pointer */
+ FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */
+ FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */
GLboolean IsCompressed; /**< GL_ARB_texture_compression */
GLuint CompressedSize; /**< GL_ARB_texture_compression */
* Have to have this so the FetchTexel function pointer is never NULL.
*/
static void fetch_null_texel( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = 0;
- rgba[GCOMP] = 0;
- rgba[BCOMP] = 0;
- rgba[ACOMP] = 0;
+ texel[RCOMP] = 0;
+ texel[GCOMP] = 0;
+ texel[BCOMP] = 0;
+ texel[ACOMP] = 0;
+ _mesa_warning(NULL, "fetch_null_texel() called!");
+}
+
+static void fetch_null_texelf( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ texel[RCOMP] = 0.0;
+ texel[GCOMP] = 0.0;
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 0.0;
+ _mesa_warning(NULL, "fetch_null_texelf() called!");
}
0, /* IndexBits */
0, /* DepthBits */
4 * CHAN_BITS / 8, /* TexelBytes */
- fetch_1d_texel_rgba, /* FetchTexel1D */
- fetch_2d_texel_rgba, /* FetchTexel2D */
- fetch_3d_texel_rgba, /* FetchTexel3D */
+ fetch_texel_1d_rgba, /* FetchTexel1D */
+ fetch_texel_2d_rgba, /* FetchTexel2D */
+ fetch_texel_3d_rgba, /* FetchTexel3D */
+ fetch_texel_1d_f_rgba, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgba, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgb = {
0, /* IndexBits */
0, /* DepthBits */
3 * CHAN_BITS / 8, /* TexelBytes */
- fetch_1d_texel_rgb, /* FetchTexel1D */
- fetch_2d_texel_rgb, /* FetchTexel2D */
- fetch_3d_texel_rgb, /* FetchTexel3D */
+ fetch_texel_1d_rgb, /* FetchTexel1D */
+ fetch_texel_2d_rgb, /* FetchTexel2D */
+ fetch_texel_3d_rgb, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_alpha = {
0, /* IndexBits */
0, /* DepthBits */
CHAN_BITS / 8, /* TexelBytes */
- fetch_1d_texel_alpha, /* FetchTexel1D */
- fetch_2d_texel_alpha, /* FetchTexel2D */
- fetch_3d_texel_alpha, /* FetchTexel3D */
+ fetch_texel_1d_alpha, /* FetchTexel1D */
+ fetch_texel_2d_alpha, /* FetchTexel2D */
+ fetch_texel_3d_alpha, /* FetchTexel3D */
+ fetch_texel_1d_f_alpha, /* FetchTexel1Df */
+ fetch_texel_2d_f_alpha, /* FetchTexel2Df */
+ fetch_texel_3d_f_alpha, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_luminance = {
0, /* IndexBits */
0, /* DepthBits */
CHAN_BITS / 8, /* TexelBytes */
- fetch_1d_texel_luminance, /* FetchTexel1D */
- fetch_2d_texel_luminance, /* FetchTexel2D */
- fetch_3d_texel_luminance, /* FetchTexel3D */
+ fetch_texel_1d_luminance, /* FetchTexel1D */
+ fetch_texel_2d_luminance, /* FetchTexel2D */
+ fetch_texel_3d_luminance, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance, /* FetchTexel1Df */
+ fetch_texel_2d_f_luminance, /* FetchTexel2Df */
+ fetch_texel_3d_f_luminance, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_luminance_alpha = {
0, /* IndexBits */
0, /* DepthBits */
2 * CHAN_BITS / 8, /* TexelBytes */
- fetch_1d_texel_luminance_alpha, /* FetchTexel1D */
- fetch_2d_texel_luminance_alpha, /* FetchTexel2D */
- fetch_3d_texel_luminance_alpha, /* FetchTexel3D */
+ fetch_texel_1d_luminance_alpha, /* FetchTexel1D */
+ fetch_texel_2d_luminance_alpha, /* FetchTexel2D */
+ fetch_texel_3d_luminance_alpha, /* FetchTexel3D */
+ fetch_texel_1d_f_luminance_alpha, /* FetchTexel1Df */
+ fetch_texel_2d_f_luminance_alpha, /* FetchTexel2Df */
+ fetch_texel_3d_f_luminance_alpha, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_intensity = {
0, /* IndexBits */
0, /* DepthBits */
CHAN_BITS / 8, /* TexelBytes */
- fetch_1d_texel_intensity, /* FetchTexel1D */
- fetch_2d_texel_intensity, /* FetchTexel2D */
- fetch_3d_texel_intensity, /* FetchTexel3D */
+ fetch_texel_1d_intensity, /* FetchTexel1D */
+ fetch_texel_2d_intensity, /* FetchTexel2D */
+ fetch_texel_3d_intensity, /* FetchTexel3D */
+ fetch_texel_1d_f_intensity, /* FetchTexel1Df */
+ fetch_texel_2d_f_intensity, /* FetchTexel2Df */
+ fetch_texel_3d_f_intensity, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_color_index = {
CHAN_BITS, /* IndexBits */
0, /* DepthBits */
CHAN_BITS / 8, /* TexelBytes */
- fetch_1d_texel_color_index, /* FetchTexel1D */
- fetch_2d_texel_color_index, /* FetchTexel2D */
- fetch_3d_texel_color_index, /* FetchTexel3D */
+ fetch_texel_1d_color_index, /* FetchTexel1D */
+ fetch_texel_2d_color_index, /* FetchTexel2D */
+ fetch_texel_3d_color_index, /* FetchTexel3D */
+ fetch_texel_1d_f_color_index, /* FetchTexel1Df */
+ fetch_texel_2d_f_color_index, /* FetchTexel2Df */
+ fetch_texel_3d_f_color_index, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_depth_component = {
0, /* IndexBits */
sizeof(GLfloat) * 8, /* DepthBits */
sizeof(GLfloat), /* TexelBytes */
- fetch_1d_texel_depth_component, /* FetchTexel1D */
- fetch_2d_texel_depth_component, /* FetchTexel2D */
- fetch_3d_texel_depth_component, /* FetchTexel3D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_null_texel, /* FetchTexel1D */
+ fetch_texel_1d_f_depth_component, /* FetchTexel1Df */
+ fetch_texel_2d_f_depth_component, /* FetchTexel2Df */
+ fetch_texel_3d_f_depth_component, /* FetchTexel3Df */
};
/*@}*/
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
- fetch_1d_texel_rgba8888, /* FetchTexel1D */
- fetch_2d_texel_rgba8888, /* FetchTexel2D */
- fetch_3d_texel_rgba8888, /* FetchTexel3D */
+ fetch_texel_1d_rgba8888, /* FetchTexel1D */
+ fetch_texel_2d_rgba8888, /* FetchTexel2D */
+ fetch_texel_3d_rgba8888, /* FetchTexel3D */
+ fetch_texel_1d_f_rgba8888, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba8888, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgba8888, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_argb8888 = {
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
- fetch_1d_texel_argb8888, /* FetchTexel1D */
- fetch_2d_texel_argb8888, /* FetchTexel2D */
- fetch_3d_texel_argb8888, /* FetchTexel3D */
+ fetch_texel_1d_argb8888, /* FetchTexel1D */
+ fetch_texel_2d_argb8888, /* FetchTexel2D */
+ fetch_texel_3d_argb8888, /* FetchTexel3D */
+ fetch_texel_1d_f_argb8888, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb8888, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb8888, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgb888 = {
0, /* IndexBits */
0, /* DepthBits */
3, /* TexelBytes */
- fetch_1d_texel_rgb888, /* FetchTexel1D */
- fetch_2d_texel_rgb888, /* FetchTexel2D */
- fetch_3d_texel_rgb888, /* FetchTexel3D */
+ fetch_texel_1d_rgb888, /* FetchTexel1D */
+ fetch_texel_2d_rgb888, /* FetchTexel2D */
+ fetch_texel_3d_rgb888, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb888, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb888, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb888, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgb565 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_rgb565, /* FetchTexel1D */
- fetch_2d_texel_rgb565, /* FetchTexel2D */
- fetch_3d_texel_rgb565, /* FetchTexel3D */
+ fetch_texel_1d_rgb565, /* FetchTexel1D */
+ fetch_texel_2d_rgb565, /* FetchTexel2D */
+ fetch_texel_3d_rgb565, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb565, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb565, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb565, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_argb4444 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_argb4444, /* FetchTexel1D */
- fetch_2d_texel_argb4444, /* FetchTexel2D */
- fetch_3d_texel_argb4444, /* FetchTexel3D */
+ fetch_texel_1d_argb4444, /* FetchTexel1D */
+ fetch_texel_2d_argb4444, /* FetchTexel2D */
+ fetch_texel_3d_argb4444, /* FetchTexel3D */
+ fetch_texel_1d_f_argb4444, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb4444, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb4444, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_argb1555 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_argb1555, /* FetchTexel1D */
- fetch_2d_texel_argb1555, /* FetchTexel2D */
- fetch_3d_texel_argb1555, /* FetchTexel3D */
+ fetch_texel_1d_argb1555, /* FetchTexel1D */
+ fetch_texel_2d_argb1555, /* FetchTexel2D */
+ fetch_texel_3d_argb1555, /* FetchTexel3D */
+ fetch_texel_1d_f_argb1555, /* FetchTexel1Df */
+ fetch_texel_2d_f_argb1555, /* FetchTexel2Df */
+ fetch_texel_3d_f_argb1555, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_al88 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_al88, /* FetchTexel1D */
- fetch_2d_texel_al88, /* FetchTexel2D */
- fetch_3d_texel_al88, /* FetchTexel3D */
+ fetch_texel_1d_al88, /* FetchTexel1D */
+ fetch_texel_2d_al88, /* FetchTexel2D */
+ fetch_texel_3d_al88, /* FetchTexel3D */
+ fetch_texel_1d_f_al88, /* FetchTexel1Df */
+ fetch_texel_2d_f_al88, /* FetchTexel2Df */
+ fetch_texel_3d_f_al88, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgb332 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
- fetch_1d_texel_rgb332, /* FetchTexel1D */
- fetch_2d_texel_rgb332, /* FetchTexel2D */
- fetch_3d_texel_rgb332, /* FetchTexel3D */
+ fetch_texel_1d_rgb332, /* FetchTexel1D */
+ fetch_texel_2d_rgb332, /* FetchTexel2D */
+ fetch_texel_3d_rgb332, /* FetchTexel3D */
+ fetch_texel_1d_f_rgb332, /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb332, /* FetchTexel2Df */
+ fetch_texel_3d_f_rgb332, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_a8 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
- fetch_1d_texel_a8, /* FetchTexel1D */
- fetch_2d_texel_a8, /* FetchTexel2D */
- fetch_3d_texel_a8, /* FetchTexel3D */
+ fetch_texel_1d_a8, /* FetchTexel1D */
+ fetch_texel_2d_a8, /* FetchTexel2D */
+ fetch_texel_3d_a8, /* FetchTexel3D */
+ fetch_texel_1d_f_a8, /* FetchTexel1Df */
+ fetch_texel_2d_f_a8, /* FetchTexel2Df */
+ fetch_texel_3d_f_a8, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_l8 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
- fetch_1d_texel_l8, /* FetchTexel1D */
- fetch_2d_texel_l8, /* FetchTexel2D */
- fetch_3d_texel_l8, /* FetchTexel3D */
+ fetch_texel_1d_l8, /* FetchTexel1D */
+ fetch_texel_2d_l8, /* FetchTexel2D */
+ fetch_texel_3d_l8, /* FetchTexel3D */
+ fetch_texel_1d_f_l8, /* FetchTexel1Df */
+ fetch_texel_2d_f_l8, /* FetchTexel2Df */
+ fetch_texel_3d_f_l8, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_i8 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
- fetch_1d_texel_i8, /* FetchTexel1D */
- fetch_2d_texel_i8, /* FetchTexel2D */
- fetch_3d_texel_i8, /* FetchTexel3D */
+ fetch_texel_1d_i8, /* FetchTexel1D */
+ fetch_texel_2d_i8, /* FetchTexel2D */
+ fetch_texel_3d_i8, /* FetchTexel3D */
+ fetch_texel_1d_f_i8, /* FetchTexel1Df */
+ fetch_texel_2d_f_i8, /* FetchTexel2Df */
+ fetch_texel_3d_f_i8, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_ci8 = {
8, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
- fetch_1d_texel_ci8, /* FetchTexel1D */
- fetch_2d_texel_ci8, /* FetchTexel2D */
- fetch_3d_texel_ci8, /* FetchTexel3D */
+ fetch_texel_1d_ci8, /* FetchTexel1D */
+ fetch_texel_2d_ci8, /* FetchTexel2D */
+ fetch_texel_3d_ci8, /* FetchTexel3D */
+ fetch_texel_1d_f_ci8, /* FetchTexel1Df */
+ fetch_texel_2d_f_ci8, /* FetchTexel2Df */
+ fetch_texel_3d_f_ci8, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_ycbcr = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_ycbcr, /* FetchTexel1D */
- fetch_2d_texel_ycbcr, /* FetchTexel2D */
- fetch_3d_texel_ycbcr, /* FetchTexel3D */
+ fetch_texel_1d_ycbcr, /* FetchTexel1D */
+ fetch_texel_2d_ycbcr, /* FetchTexel2D */
+ fetch_texel_3d_ycbcr, /* FetchTexel3D */
+ fetch_texel_1d_f_ycbcr, /* FetchTexel1Df */
+ fetch_texel_2d_f_ycbcr, /* FetchTexel2Df */
+ fetch_texel_3d_f_ycbcr, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_ycbcr_rev, /* FetchTexel1D */
- fetch_2d_texel_ycbcr_rev, /* FetchTexel2D */
- fetch_3d_texel_ycbcr_rev, /* FetchTexel3D */
+ fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */
+ fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */
+ fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */
+ fetch_texel_1d_f_ycbcr_rev, /* FetchTexel1Df */
+ fetch_texel_2d_f_ycbcr_rev, /* FetchTexel2Df */
+ fetch_texel_3d_f_ycbcr_rev, /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgb_fxt1 = {
0, /* DepthBits */
0, /* TexelBytes */
NULL, /*impossible*/ /* FetchTexel1D */
- fetch_2d_texel_rgb_fxt1, /* FetchTexel2D */
+ fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
0, /* DepthBits */
0, /* TexelBytes */
NULL, /*impossible*/ /* FetchTexel1D */
- fetch_2d_texel_rgba_fxt1, /* FetchTexel2D */
+ fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
0, /* DepthBits */
0, /* TexelBytes */
NULL, /*impossible*/ /* FetchTexel1D */
- fetch_2d_texel_rgb_dxt1, /* FetchTexel2D */
+ fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
0, /* DepthBits */
0, /* TexelBytes */
NULL, /*impossible*/ /* FetchTexel1D */
- fetch_2d_texel_rgba_dxt1, /* FetchTexel2D */
+ fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt3 = {
0, /* DepthBits */
0, /* TexelBytes */
NULL, /*impossible*/ /* FetchTexel1D */
- fetch_2d_texel_rgba_dxt3, /* FetchTexel2D */
+ fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
};
const struct gl_texture_format _mesa_texformat_rgba_dxt5 = {
0, /* DepthBits */
0, /* TexelBytes */
NULL, /*impossible*/ /* FetchTexel1D */
- fetch_2d_texel_rgba_dxt5, /* FetchTexel2D */
+ fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
};
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
- fetch_1d_texel_abgr8888, /* FetchTexel1D */
- fetch_2d_texel_abgr8888, /* FetchTexel2D */
- fetch_3d_texel_abgr8888, /* FetchTexel3D */
+ fetch_texel_1d_abgr8888, /* FetchTexel1D */
+ fetch_texel_2d_abgr8888, /* FetchTexel2D */
+ fetch_texel_3d_abgr8888, /* FetchTexel3D */
+ /* XXX float fetchers */
};
const struct gl_texture_format _mesa_texformat_bgra8888 = {
0, /* IndexBits */
0, /* DepthBits */
4, /* TexelBytes */
- fetch_1d_texel_bgra8888, /* FetchTexel1D */
- fetch_2d_texel_bgra8888, /* FetchTexel2D */
- fetch_3d_texel_bgra8888, /* FetchTexel3D */
+ fetch_texel_1d_bgra8888, /* FetchTexel1D */
+ fetch_texel_2d_bgra8888, /* FetchTexel2D */
+ fetch_texel_3d_bgra8888, /* FetchTexel3D */
+ /* XXX float fetchers */
};
const struct gl_texture_format _mesa_texformat_bgr888 = {
0, /* IndexBits */
0, /* DepthBits */
3, /* TexelBytes */
- fetch_1d_texel_bgr888, /* FetchTexel1D */
- fetch_2d_texel_bgr888, /* FetchTexel2D */
- fetch_3d_texel_bgr888, /* FetchTexel3D */
+ fetch_texel_1d_bgr888, /* FetchTexel1D */
+ fetch_texel_2d_bgr888, /* FetchTexel2D */
+ fetch_texel_3d_bgr888, /* FetchTexel3D */
+ /* XXX float fetchers */
};
const struct gl_texture_format _mesa_texformat_bgr565 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_bgr565, /* FetchTexel1D */
- fetch_2d_texel_bgr565, /* FetchTexel2D */
- fetch_3d_texel_bgr565, /* FetchTexel3D */
+ fetch_texel_1d_bgr565, /* FetchTexel1D */
+ fetch_texel_2d_bgr565, /* FetchTexel2D */
+ fetch_texel_3d_bgr565, /* FetchTexel3D */
+ /* XXX float fetchers */
};
const struct gl_texture_format _mesa_texformat_bgra4444 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_bgra4444, /* FetchTexel1D */
- fetch_2d_texel_bgra4444, /* FetchTexel2D */
- fetch_3d_texel_bgra4444, /* FetchTexel3D */
+ fetch_texel_1d_bgra4444, /* FetchTexel1D */
+ fetch_texel_2d_bgra4444, /* FetchTexel2D */
+ fetch_texel_3d_bgra4444, /* FetchTexel3D */
+ /* XXX float fetchers */
};
const struct gl_texture_format _mesa_texformat_bgra5551 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_bgra1555, /* FetchTexel1D */
- fetch_2d_texel_bgra1555, /* FetchTexel2D */
- fetch_3d_texel_bgra1555, /* FetchTexel3D */
+ fetch_texel_1d_bgra1555, /* FetchTexel1D */
+ fetch_texel_2d_bgra1555, /* FetchTexel2D */
+ fetch_texel_3d_bgra1555, /* FetchTexel3D */
+ /* XXX float fetchers */
};
const struct gl_texture_format _mesa_texformat_la88 = {
0, /* IndexBits */
0, /* DepthBits */
2, /* TexelBytes */
- fetch_1d_texel_la88, /* FetchTexel1D */
- fetch_2d_texel_la88, /* FetchTexel2D */
- fetch_3d_texel_la88, /* FetchTexel3D */
+ fetch_texel_1d_la88, /* FetchTexel1D */
+ fetch_texel_2d_la88, /* FetchTexel2D */
+ fetch_texel_3d_la88, /* FetchTexel3D */
+ /* XXX float fetchers */
};
const struct gl_texture_format _mesa_texformat_bgr233 = {
0, /* IndexBits */
0, /* DepthBits */
1, /* TexelBytes */
- fetch_1d_texel_bgr233, /* FetchTexel1D */
- fetch_2d_texel_bgr233, /* FetchTexel2D */
- fetch_3d_texel_bgr233, /* FetchTexel3D */
+ fetch_texel_1d_bgr233, /* FetchTexel1D */
+ fetch_texel_2d_bgr233, /* FetchTexel2D */
+ fetch_texel_3d_bgr233, /* FetchTexel3D */
+ /* XXX float fetchers */
};
#endif
fetch_null_texel, /* FetchTexel1D */
fetch_null_texel, /* FetchTexel2D */
fetch_null_texel, /* FetchTexel3D */
+ fetch_null_texelf, /* FetchTexel1Df */
+ fetch_null_texelf, /* FetchTexel2Df */
+ fetch_null_texelf, /* FetchTexel3Df */
};
/*@}*/
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#define FLOAT_SRC( t, i, j, k ) \
((GLfloat *)(t)->Data + (i))
-#define FETCH(x) fetch_1d_texel_##x
+#define FETCH(x) fetch_texel_1d_##x
#elif DIM == 2
#define FLOAT_SRC( t, i, j, k ) \
((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)))
-#define FETCH(x) fetch_2d_texel_##x
+#define FETCH(x) fetch_texel_2d_##x
#elif DIM == 3
((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->RowStride + (i)))
-#define FETCH(x) fetch_3d_texel_##x
+#define FETCH(x) fetch_texel_3d_##x
#else
#error illegal number of texture dimensions
#endif
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *) texel;
- COPY_CHAN4( rgba, src );
+ COPY_CHAN4( texel, src );
}
+/* Fetch color 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 )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
+ texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
+ texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
+ texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
+ texel[ACOMP] = CHAN_TO_FLOAT(src[3]);
+}
+
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = src[0];
+ texel[GCOMP] = src[1];
+ texel[BCOMP] = src[2];
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch color 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 )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 3 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = src[0];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[2];
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
+ texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
+ texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
+ texel[ACOMP] = CHAN_MAXF;
}
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0;
+ texel[ACOMP] = src[0];
+}
+
+/* Fetch color 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 )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = 0;
- rgba[GCOMP] = 0;
- rgba[BCOMP] = 0;
- rgba[ACOMP] = src[0];
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
}
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = src[0];
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch color 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 )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = src[0];
- rgba[GCOMP] = src[0];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
+ texel[ACOMP] = CHAN_MAXF;
}
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 2 );
+ texel[RCOMP] = src[0];
+ texel[GCOMP] = src[0];
+ texel[BCOMP] = src[0];
+ texel[ACOMP] = src[1];
+}
+
+/* Fetch color 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 )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 2 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = src[0];
- rgba[GCOMP] = src[0];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = src[1];
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
+ texel[ACOMP] = CHAN_TO_FLOAT(src[1]);
}
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = src[0];
- rgba[GCOMP] = src[0];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = src[0];
+ texel[RCOMP] = src[0];
+ texel[GCOMP] = src[0];
+ texel[BCOMP] = src[0];
+ texel[ACOMP] = src[0];
}
+/* Fetch color 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 )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
+}
+
+
+/* Fetch CI texel from 1D, 2D or 3D CI texture, returning 1 GLchan */
static void FETCH(color_index)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
GLchan *index = (GLchan *) texel;
- *index = *src;
+ index[0] = src[0];
+}
+
+/* Fetch CI texel from 1D, 2D or 3D CI texture, returning 1 GLfloat */
+static void FETCH(f_color_index)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 );
+ texel[0] = (GLfloat) src[0];
}
+
+#if 000
+/* Fetch depth texel from 1D, 2D or 3D DEPTH texture, returning 1 GLfloat */
static void FETCH(depth_component)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
+#if 0
const GLfloat *src = FLOAT_SRC( texImage, i, j, k );
GLfloat *depth = (GLfloat *) texel;
- *depth = *src;
+ depth[0] = src[0];
+#else
+ _mesa_problem(NULL, "fetching depth component as non-float!");
+#endif
}
+#endif
+
+/* Fetch depth texel from 1D, 2D or 3D DEPTH texture, returning 1 GLfloat */
+static void FETCH(f_depth_component)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLfloat *src = FLOAT_SRC( texImage, i, j, k );
+ texel[0] = src[0];
+}
+
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[3] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[2] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[1] );
- rgba[ACOMP] = UBYTE_TO_CHAN( src[0] );
+ 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] );
}
+/* Fetch color 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] );
+}
+
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[2] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[1] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[ACOMP] = UBYTE_TO_CHAN( src[3] );
+ 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] );
}
+/* Fetch color 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] );
+}
+
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 );
+ texel[RCOMP] = UBYTE_TO_CHAN( src[2] );
+ texel[GCOMP] = UBYTE_TO_CHAN( src[1] );
+ texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch color 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 )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[2] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[1] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
+ texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
+ texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+ texel[ACOMP] = CHAN_MAXF;
}
+
+/* Fetch color 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, GLvoid *texel )
+ 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 >> 8) & 0xf8) * 255 / 0xf8 );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch color 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 )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
const GLushort s = *src;
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
+ /* xxx fixup */
+ texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf8) * 255 / 0xf8 );
+ texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 3) & 0xfc) * 255 / 0xfc );
+ texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) * 255 / 0xf8 );
+ texel[ACOMP] = CHAN_MAXF;
}
+
+/* Fetch color texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
static void FETCH(argb4444)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ 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 >> 8) & 0xf) * 255 / 0xf );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
+ texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
+}
+
+/* Fetch color texel from 1D, 2D or 3D rgb565 texture, return 4 GLfloats */
+static void FETCH(f_argb4444)( 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;
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
+ /* xxx fixup */
+ texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
+ texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
+ texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
+ texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 12) & 0xf) * 255 / 0xf );
}
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
const GLushort s = *src;
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f );
- rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
+ 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 argb1555 texture, return 4 GLfloats */
+static void FETCH(f_argb1555)( 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;
+ /* xxx better */
+ texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0x1f) * 255 / 0x1f );
+ texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0x1f) * 255 / 0x1f );
+ texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0x1f) * 255 / 0x1f );
+ texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 );
+}
+
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[ACOMP] = UBYTE_TO_CHAN( src[1] );
+}
+
+/* Fetch color 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 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[ACOMP] = UBYTE_TO_CHAN( src[1] );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+ texel[ACOMP] = UBYTE_TO_FLOAT( src[1] );
}
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
const GLubyte s = *src;
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 );
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 );
+ texel[ACOMP] = CHAN_MAX;
}
+/* Fetch color 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 )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ const GLubyte s = *src;
+ /* xxx improve */
+ texel[RCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xe0) * 255 / 0xe0 );
+ texel[GCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xe0) * 255 / 0xe0 );
+ texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 5) & 0xc0) * 255 / 0xc0 );
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = 0;
- rgba[GCOMP] = 0;
- rgba[BCOMP] = 0;
- rgba[ACOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[RCOMP] = 0;
+ texel[GCOMP] = 0;
+ texel[BCOMP] = 0;
+ texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
}
+/* Fetch color 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 )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
+}
+
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[GCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[ACOMP] = CHAN_MAX;
}
+/* Fetch color 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 )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch color 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, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[RCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[GCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
+}
+
+/* Fetch color 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 )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[ACOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] =
+ texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
}
+
+/* Fetch color texel from 1D, 2D or 3D ci8 texture, return 1 GLchan */
static void FETCH(ci8)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
GLchan *index = (GLchan *) texel;
*index = UBYTE_TO_CHAN( *src );
}
+
+/* Fetch color texel from 1D, 2D or 3D ci8 texture, return 1 GLfloat */
+static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
+ texel[0] = UBYTE_TO_FLOAT( *src );
+}
+
+
+/* Fetch color 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,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
const GLushort *src1 = src0 + 1; /* odd */
const GLubyte cb = *src0 & 0xff; /* chroma U */
const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
const GLubyte cr = *src1 & 0xff; /* chroma V */
- GLchan *rgba = (GLchan *) texel;
GLint r, g, b;
if (i & 1) {
/* odd pixel: use y1,cr,cb */
g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128));
}
- rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX);
- rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX);
- rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX);
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] = CLAMP(r, 0, CHAN_MAX);
+ texel[GCOMP] = CLAMP(g, 0, CHAN_MAX);
+ texel[BCOMP] = CLAMP(b, 0, CHAN_MAX);
+ texel[ACOMP] = CHAN_MAX;
}
+/* Fetch color 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 )
+{
+ const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */
+ const GLubyte cb = *src0 & 0xff; /* chroma U */
+ const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */
+ const GLubyte cr = *src1 & 0xff; /* chroma V */
+ GLfloat r, g, b;
+ if (i & 1) {
+ /* odd pixel: use y1,cr,cb */
+ r = (1.164 * (y1-16) + 1.596 * (cr-128));
+ g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y1-16) + 2.018 * (cb-128));
+ }
+ else {
+ /* even pixel: use y0,cr,cb */
+ r = (1.164 * (y0-16) + 1.596 * (cr-128));
+ g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y0-16) + 2.018 * (cb-128));
+ }
+ /* XXX remove / 255 here by tweaking arithmetic above */
+ r /= 255.0;
+ g /= 255.0;
+ b /= 255.0;
+ /* XXX should we really clamp??? */
+ texel[RCOMP] = CLAMP(r, 0.0, 1.0);
+ texel[GCOMP] = CLAMP(g, 0.0, 1.0);
+ texel[BCOMP] = CLAMP(b, 0.0, 1.0);
+ texel[ACOMP] = CHAN_MAXF;
+}
+
+
+/* Fetch color 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,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
const GLushort *src1 = src0 + 1; /* odd */
const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */
const GLubyte y1 = *src1 & 0xff; /* luminance */
const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
- GLchan *rgba = (GLchan *) texel;
GLint r, g, b;
if (i & 1) {
/* odd pixel: use y1,cr,cb */
g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128));
}
- rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX);
- rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX);
- rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX);
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] = CLAMP(r, 0, CHAN_MAX);
+ texel[GCOMP] = CLAMP(g, 0, CHAN_MAX);
+ texel[BCOMP] = CLAMP(b, 0, CHAN_MAX);
+ texel[ACOMP] = CHAN_MAX;
+}
+
+/* Fetch color texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats */
+/* We convert YCbCr to RGB here */
+/* XXX this may break if GLchan != GLubyte */
+static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */
+ const GLushort *src1 = src0 + 1; /* odd */
+ const GLubyte y0 = *src0 & 0xff; /* luminance */
+ const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */
+ const GLubyte y1 = *src1 & 0xff; /* luminance */
+ const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */
+ GLfloat r, g, b;
+ if (i & 1) {
+ /* odd pixel: use y1,cr,cb */
+ r = (1.164 * (y1-16) + 1.596 * (cr-128));
+ g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y1-16) + 2.018 * (cb-128));
+ }
+ else {
+ /* even pixel: use y0,cr,cb */
+ r = (1.164 * (y0-16) + 1.596 * (cr-128));
+ g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
+ b = (1.164 * (y0-16) + 2.018 * (cb-128));
+ }
+ /* XXX remove / 255 here by tweaking arithmetic above */
+ r /= 255.0;
+ g /= 255.0;
+ b /= 255.0;
+ /* XXX should we really clamp??? */
+ texel[RCOMP] = CLAMP(r, 0.0, 1.0);
+ texel[GCOMP] = CLAMP(g, 0.0, 1.0);
+ texel[BCOMP] = CLAMP(b, 0.0, 1.0);
+ texel[ACOMP] = CHAN_MAXF;
}
-#if DIM == 2
+#if DIM == 2 /* Only 2D compressed textures possible */
+
static void FETCH(rgb_fxt1)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+static void FETCH(f_rgb_fxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
{
/* Extract the (i,j) pixel from texImage->Data and return it
* in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
*/
}
-#endif
-#if DIM == 2
static void FETCH(rgba_fxt1)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
/* Extract the (i,j) pixel from texImage->Data and return it
* in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
*/
}
-#endif
+static void FETCH(f_rgba_fxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+#endif /* if DIM == 2 */
+
+
+#if DIM == 2 /* only 2D is valid */
-#if DIM == 2
static void FETCH(rgb_dxt1)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
/* Extract the (i,j) pixel from texImage->Data and return it
* in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
*/
}
-#endif
-#if DIM == 2
+static void FETCH(f_rgb_dxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+
static void FETCH(rgba_dxt1)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
/* Extract the (i,j) pixel from texImage->Data and return it
* in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
*/
}
-#endif
-#if DIM == 2
+static void FETCH(f_rgba_dxt1)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+
static void FETCH(rgba_dxt3)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
/* Extract the (i,j) pixel from texImage->Data and return it
* in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
*/
}
-#endif
-#if DIM == 2
+static void FETCH(f_rgba_dxt3)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
+
static void FETCH(rgba_dxt5)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
/* Extract the (i,j) pixel from texImage->Data and return it
* in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
*/
}
+
+static void FETCH(f_rgba_dxt5)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ /* Extract the (i,j) pixel from texImage->Data and return it
+ * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP].
+ */
+}
+
#endif
#if 0
static void FETCH(abgr8888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[3] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[2] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[1] );
- rgba[ACOMP] = UBYTE_TO_CHAN( src[0] );
+ 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] );
}
static void FETCH(bgra8888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[2] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[1] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[ACOMP] = UBYTE_TO_CHAN( src[3] );
+ 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] );
}
static void FETCH(bgr888)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[2] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[1] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] = UBYTE_TO_CHAN( src[2] );
+ texel[GCOMP] = UBYTE_TO_CHAN( src[1] );
+ texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[ACOMP] = CHAN_MAX;
}
static void FETCH(bgr565)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
const GLushort s = *src;
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
+ 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 << 3) & 0xf8) * 255 / 0xf8 );
+ texel[ACOMP] = CHAN_MAX;
}
static void FETCH(bgra4444)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
const GLushort s = *src;
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
+ texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf );
}
static void FETCH(bgra5551)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
const GLushort s = *src;
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f );
- rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
+ 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 );
}
static void FETCH(la88)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 );
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[GCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[BCOMP] = UBYTE_TO_CHAN( src[0] );
- rgba[ACOMP] = UBYTE_TO_CHAN( src[1] );
+ texel[RCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[GCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
+ texel[ACOMP] = UBYTE_TO_CHAN( src[1] );
}
static void FETCH(bgr233)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLvoid *texel )
+ GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
const GLubyte s = *src;
- GLchan *rgba = (GLchan *) texel;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 );
- rgba[ACOMP] = CHAN_MAX;
+ texel[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 );
+ texel[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 );
+ texel[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 );
+ texel[ACOMP] = CHAN_MAX;
}
#endif
/*
* Mesa 3-D graphics library
- * Version: 6.0
+ * Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
img->DepthLog2 = 0;
img->Data = NULL;
img->TexFormat = &_mesa_null_texformat;
- img->FetchTexel = NULL;
+ img->FetchTexelc = NULL;
+ img->FetchTexelf = NULL;
img->IsCompressed = 0;
img->CompressedSize = 0;
}
GLuint indexRow[MAX_WIDTH];
GLint col;
for (col = 0; col < width; col++) {
- (*texImage->FetchTexel)(texImage, col, row, img,
- (GLvoid *) &indexRow[col]);
+ GLchan indx;
+ (*texImage->FetchTexelc)(texImage, col, row, img, &indx);
+ indexRow[col] = indx;
}
_mesa_pack_index_span(ctx, width, type, dest,
indexRow, &ctx->Pack,
GLfloat depthRow[MAX_WIDTH];
GLint col;
for (col = 0; col < width; col++) {
- (*texImage->FetchTexel)(texImage, col, row, img,
- (GLvoid *) &depthRow[col]);
+ (*texImage->FetchTexelf)(texImage, col, row, img,
+ (GLvoid *) &depthRow[col]);
}
_mesa_pack_depth_span(ctx, width, dest, type,
depthRow, &ctx->Pack);
GLchan rgba[MAX_WIDTH][4];
GLint col;
for (col = 0; col < width; col++) {
- (*texImage->FetchTexel)(texImage, col, row, img,
- (GLvoid *) rgba[col]);
+ (*texImage->FetchTexelc)(texImage, col, row, img, rgba[col]);
}
_mesa_pack_rgba_span(ctx, width, (const GLchan (*)[4])rgba,
format, type, dest, &ctx->Pack,
&ctx->Unpack, texObj, texImage);
ASSERT(texImage->TexFormat);
- if (!texImage->FetchTexel) {
- /* If driver didn't explicitly set this, use the default */
- texImage->FetchTexel = texImage->TexFormat->FetchTexel1D;
- }
- ASSERT(texImage->FetchTexel);
+
+ /* If driver didn't explicitly set this, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
/* state update */
texObj->Complete = GL_FALSE;
&ctx->Unpack, texObj, texImage);
ASSERT(texImage->TexFormat);
- if (!texImage->FetchTexel) {
- /* If driver didn't explicitly set this, use the default */
- texImage->FetchTexel = texImage->TexFormat->FetchTexel2D;
- }
- ASSERT(texImage->FetchTexel);
+
+ /* If driver didn't explicitly set these, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
/* state update */
texObj->Complete = GL_FALSE;
pixels, &ctx->Unpack, texObj, texImage);
ASSERT(texImage->TexFormat);
- if (!texImage->FetchTexel) {
- /* If driver didn't explicitly set this, use the default */
- texImage->FetchTexel = texImage->TexFormat->FetchTexel3D;
- }
- ASSERT(texImage->FetchTexel);
+
+ /* If driver didn't explicitly set these, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
/* state update */
texObj->Complete = GL_FALSE;
x, y, width, border);
ASSERT(texImage->TexFormat);
- if (!texImage->FetchTexel) {
- /* If driver didn't explicitly set this, use the default */
- texImage->FetchTexel = texImage->TexFormat->FetchTexel1D;
- }
- ASSERT(texImage->FetchTexel);
+
+ /* If driver didn't explicitly set these, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
/* state update */
texObj->Complete = GL_FALSE;
x, y, width, height, border);
ASSERT(texImage->TexFormat);
- if (!texImage->FetchTexel) {
- /* If driver didn't explicitly set this, use the default */
- texImage->FetchTexel = texImage->TexFormat->FetchTexel2D;
- }
- ASSERT(texImage->FetchTexel);
+
+ /* If driver didn't explicitly set these, use the defaults */
+ if (!texImage->FetchTexelc)
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
+ if (!texImage->FetchTexelf)
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
/* state update */
texObj->Complete = GL_FALSE;
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
internalFormat, format, type);
assert(texImage->TexFormat);
- texImage->FetchTexel = texImage->TexFormat->FetchTexel1D;
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
texelBytes = texImage->TexFormat->TexelBytes;
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
internalFormat, format, type);
assert(texImage->TexFormat);
- texImage->FetchTexel = texImage->TexFormat->FetchTexel2D;
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
texelBytes = texImage->TexFormat->TexelBytes;
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
internalFormat, format, type);
assert(texImage->TexFormat);
- texImage->FetchTexel = texImage->TexFormat->FetchTexel3D;
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D;
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df;
texelBytes = texImage->TexFormat->TexelBytes;
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
internalFormat, 0, 0);
assert(texImage->TexFormat);
- texImage->FetchTexel = texImage->TexFormat->FetchTexel2D;
+ texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
+ texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
/* allocate storage */
texImage->Data = MESA_PBUFFER_ALLOC(imageSize);
for (row = 0; row < srcImage->Height; row++) {
GLuint col;
for (col = 0; col < srcImage->Width; col++) {
- (*srcImage->FetchTexel)(srcImage, col, row, 0, (GLvoid *) dst);
+ srcImage->FetchTexelc(srcImage, col, row, 0, dst);
dst += components;
}
}
dstDepth, border, srcImage->IntFormat);
dstImage->DriverData = NULL;
dstImage->TexFormat = srcImage->TexFormat;
- dstImage->FetchTexel = srcImage->FetchTexel;
+ dstImage->FetchTexelc = srcImage->FetchTexelc;
+ dstImage->FetchTexelf = srcImage->FetchTexelf;
ASSERT(dstImage->TexFormat);
- ASSERT(dstImage->FetchTexel);
+ ASSERT(dstImage->FetchTexelc);
+ ASSERT(dstImage->FetchTexelf);
/* Alloc new teximage data buffer.
* Setup src and dest data pointers.
GLchan rgba[4];
SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ /* XXX use a float-valued TextureSample routine here!!! */
swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current,
1, (const GLfloat (*)[4]) texcoord,
&lambda, &rgba);
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
COPY_CHAN4(rgba, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i, 0, 0, (GLvoid *) rgba);
+ img->FetchTexelc(img, i, 0, 0, rgba);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, rgba[0], rgba);
}
COPY_CHAN4(t0, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i0, 0, 0, (GLvoid *) t0);
+ img->FetchTexelc(img, i0, 0, 0, t0);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t0[0], t0);
}
COPY_CHAN4(t1, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i1, 0, 0, (GLvoid *) t1);
+ img->FetchTexelc(img, i1, 0, 0, t1);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t1[0], t1);
}
COPY_CHAN4(rgba, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i, j, 0, (GLvoid *) rgba);
+ img->FetchTexelc(img, i, j, 0, rgba);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, rgba[0], rgba);
}
COPY_CHAN4(t00, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i0, j0, 0, (GLvoid *) t00);
+ img->FetchTexelc(img, i0, j0, 0, t00);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t00[0], t00);
}
COPY_CHAN4(t10, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i1, j0, 0, (GLvoid *) t10);
+ img->FetchTexelc(img, i1, j0, 0, t10);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t10[0], t10);
}
COPY_CHAN4(t01, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i0, j1, 0, (GLvoid *) t01);
+ img->FetchTexelc(img, i0, j1, 0, t01);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t01[0], t01);
}
COPY_CHAN4(t11, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i1, j1, 0, (GLvoid *) t11);
+ img->FetchTexelc(img, i1, j1, 0, t11);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t11[0], t11);
}
GLchan t01[4];
GLchan t11[4];
- (*img->FetchTexel)(img, i0, j0, 0, (GLvoid *) t00);
- (*img->FetchTexel)(img, i1, j0, 0, (GLvoid *) t10);
- (*img->FetchTexel)(img, i0, j1, 0, (GLvoid *) t01);
- (*img->FetchTexel)(img, i1, j1, 0, (GLvoid *) t11);
+ img->FetchTexelc(img, i0, j0, 0, t00);
+ img->FetchTexelc(img, i1, j0, 0, t10);
+ img->FetchTexelc(img, i0, j1, 0, t01);
+ img->FetchTexelc(img, i1, j1, 0, t11);
#if CHAN_TYPE == GL_FLOAT
rgba[0] = w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0];
COPY_CHAN4(rgba, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i, j, k, (GLvoid *) rgba);
+ img->FetchTexelc(img, i, j, k, rgba);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, rgba[0], rgba);
}
COPY_CHAN4(t000, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i0, j0, k0, (GLvoid *) t000);
+ img->FetchTexelc(img, i0, j0, k0, t000);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t000[0], t000);
}
COPY_CHAN4(t100, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i1, j0, k0, (GLvoid *) t100);
+ img->FetchTexelc(img, i1, j0, k0, t100);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t100[0], t100);
}
COPY_CHAN4(t010, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i0, j1, k0, (GLvoid *) t010);
+ img->FetchTexelc(img, i0, j1, k0, t010);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t010[0], t010);
}
COPY_CHAN4(t110, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i1, j1, k0, (GLvoid *) t110);
+ img->FetchTexelc(img, i1, j1, k0, t110);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t110[0], t110);
}
COPY_CHAN4(t001, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i0, j0, k1, (GLvoid *) t001);
+ img->FetchTexelc(img, i0, j0, k1, t001);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t001[0], t001);
}
COPY_CHAN4(t101, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i1, j0, k1, (GLvoid *) t101);
+ img->FetchTexelc(img, i1, j0, k1, t101);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t101[0], t101);
}
COPY_CHAN4(t011, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i0, j1, k1, (GLvoid *) t011);
+ img->FetchTexelc(img, i0, j1, k1, t011);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t011[0], t011);
}
COPY_CHAN4(t111, tObj->_BorderChan);
}
else {
- (*img->FetchTexel)(img, i1, j1, k1, (GLvoid *) t111);
+ img->FetchTexelc(img, i1, j1, k1, t111);
if (img->Format == GL_COLOR_INDEX) {
palette_sample(ctx, tObj, t111[0], t111);
}
col = CLAMP(col, 0, width_minus_1);
row = CLAMP(row, 0, height_minus_1);
- (*img->FetchTexel)(img, col, row, 0, (GLvoid *) rgba[i]);
+ img->FetchTexelc(img, col, row, 0, rgba[i]);
}
}
row1 = CLAMP(row1, 0, height_minus_1);
/* get four texel samples */
- (*img->FetchTexel)(img, col0, row0, 0, (GLvoid *) t00);
- (*img->FetchTexel)(img, col1, row0, 0, (GLvoid *) t10);
- (*img->FetchTexel)(img, col0, row1, 0, (GLvoid *) t01);
- (*img->FetchTexel)(img, col1, row1, 0, (GLvoid *) t11);
+ img->FetchTexelc(img, col0, row0, 0, t00);
+ img->FetchTexelc(img, col1, row0, 0, t10);
+ img->FetchTexelc(img, col0, row1, 0, t01);
+ img->FetchTexelc(img, col1, row1, 0, t11);
/* compute sample weights */
a = FRAC(fcol);
/* XXX fix for texture rectangle! */
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], width, col);
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], height, row);
- depthSample = *((const GLfloat *) texImage->Data + row * width + col);
+ texImage->FetchTexelf(texImage, col, row, 0, &depthSample);
switch (function) {
case GL_LEQUAL:
depth00 = 1.0;
}
else {
- depth00 = *((const GLfloat *) texImage->Data + j0 * width + i0);
+ texImage->FetchTexelf(texImage, i0, j0, 0, &depth00);
}
if (useBorderTexel & (I1BIT | J0BIT)) {
depth10 = 1.0;
}
else {
- depth10 = *((const GLfloat *) texImage->Data + j0 * width + i1);
+ texImage->FetchTexelf(texImage, i1, j0, 0, &depth10);
}
if (useBorderTexel & (I0BIT | J1BIT)) {
depth01 = 1.0;
}
else {
- depth01 = *((const GLfloat *) texImage->Data + j1 * width + i0);
+ texImage->FetchTexelf(texImage, i0, j1, 0, &depth01);
}
if (useBorderTexel & (I1BIT | J1BIT)) {
depth11 = 1.0;
}
else {
- depth11 = *((const GLfloat *) texImage->Data + j1 * width + i1);
+ texImage->FetchTexelf(texImage, i1, j1, 0, &depth11);
}
if (0) {
count = 0;
for (jj = jmin; jj <= jmax; jj++) {
for (ii = imin; ii <= imax; ii++) {
- GLfloat depthSample = *((const GLfloat *) texImage->Data
- + jj * width + ii);
+ GLfloat depthSample;
+ texImage->FetchTexelf(texImage, ii, jj, 0, &depthSample);
if ((depthSample <= r[i] && lequal) ||
(depthSample >= r[i] && gequal)) {
count++;