Removed: MESA_FORMAT_RGBA, RGB, ALPHA, LUMINANCE, LUMINANCE_ALPHA, INTENSITY.
{
switch (internalFormat) {
case GL_COMPRESSED_RGB_ARB:
- return MESA_FORMAT_RGB;
+ return MESA_FORMAT_RGB888;
case GL_COMPRESSED_RGBA_ARB:
- return MESA_FORMAT_RGBA;
+ return MESA_FORMAT_RGBA8888;
default:
return _mesa_choose_tex_format(ctx, internalFormat, format, type);
}
},
#endif
- {
- MESA_FORMAT_RGBA,
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- CHAN_BITS, CHAN_BITS, CHAN_BITS, CHAN_BITS,
- 0, 0, 0, 0, 0,
- 1, 1, 4 * CHAN_BITS / 8
- },
- {
- MESA_FORMAT_RGB,
- GL_RGB,
- GL_UNSIGNED_NORMALIZED,
- CHAN_BITS, CHAN_BITS, CHAN_BITS, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 3 * CHAN_BITS / 8
- },
- {
- MESA_FORMAT_ALPHA,
- GL_ALPHA,
- GL_UNSIGNED_NORMALIZED,
- 0, 0, 0, CHAN_BITS,
- 0, 0, 0, 0, 0,
- 1, 1, 1 * CHAN_BITS / 8
- },
- {
- MESA_FORMAT_LUMINANCE,
- GL_LUMINANCE,
- GL_UNSIGNED_NORMALIZED,
- 0, 0, 0, 0,
- CHAN_BITS, 0, 0, 0, 0,
- 1, 1, 1 * CHAN_BITS / 8
- },
- {
- MESA_FORMAT_LUMINANCE_ALPHA,
- GL_LUMINANCE_ALPHA,
- GL_UNSIGNED_NORMALIZED,
- 0, 0, 0, CHAN_BITS,
- CHAN_BITS, 0, 0, 0, 0,
- 1, 1, 2 * CHAN_BITS / 8
- },
- {
- MESA_FORMAT_INTENSITY,
- GL_INTENSITY,
- GL_UNSIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 0, CHAN_BITS, 0, 0, 0,
- 1, 1, 1 * CHAN_BITS / 8
- },
{
MESA_FORMAT_RGBA_FLOAT32,
GL_RGBA,
typedef enum
{
MESA_FORMAT_NONE = 0,
+
/**
* \name Basic hardware formats
*/
#endif
/*@}*/
- /**
- * \name Generic GLchan-based formats. (XXX obsolete!)
- */
- /*@{*/
- MESA_FORMAT_RGBA,
- MESA_FORMAT_RGB,
- MESA_FORMAT_ALPHA,
- MESA_FORMAT_LUMINANCE,
- MESA_FORMAT_LUMINANCE_ALPHA,
- MESA_FORMAT_INTENSITY,
- /*@}*/
-
/**
* \name Floating point texture formats.
*/
texObj->Target == GL_TEXTURE_CUBE_MAP_ARB);
if (srcImage->_BaseFormat == GL_RGB) {
- convertFormat = MESA_FORMAT_RGB;
+ convertFormat = MESA_FORMAT_RGB888;
components = 3;
}
else if (srcImage->_BaseFormat == GL_RGBA) {
- convertFormat = MESA_FORMAT_RGBA;
+ convertFormat = MESA_FORMAT_RGBA8888;
components = 4;
}
else {
}
texfetch_funcs[MESA_FORMAT_COUNT] =
{
- {
- MESA_FORMAT_RGBA,
- fetch_texel_1d_f_rgba,
- fetch_texel_2d_f_rgba,
- fetch_texel_3d_f_rgba,
- store_texel_rgba
- },
- {
- MESA_FORMAT_RGB,
- fetch_texel_1d_f_rgb,
- fetch_texel_2d_f_rgb,
- fetch_texel_3d_f_rgb,
- store_texel_rgb
- },
- {
- MESA_FORMAT_ALPHA,
- fetch_texel_1d_f_alpha,
- fetch_texel_2d_f_alpha,
- fetch_texel_3d_f_alpha,
- store_texel_alpha
- },
- {
- MESA_FORMAT_LUMINANCE,
- fetch_texel_1d_f_luminance,
- fetch_texel_2d_f_luminance,
- fetch_texel_3d_f_luminance,
- store_texel_luminance
- },
- {
- MESA_FORMAT_LUMINANCE_ALPHA,
- fetch_texel_1d_f_luminance_alpha,
- fetch_texel_2d_f_luminance_alpha,
- fetch_texel_3d_f_luminance_alpha,
- store_texel_luminance_alpha
- },
- {
- MESA_FORMAT_INTENSITY,
- fetch_texel_1d_f_intensity,
- fetch_texel_2d_f_intensity,
- fetch_texel_3d_f_intensity,
- store_texel_intensity
- },
{
MESA_FORMAT_SRGB8,
fetch_texel_1d_srgb8,
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- return MESA_FORMAT_RGBA;
case GL_RGBA8:
return MESA_FORMAT_RGBA8888;
case GL_RGB5_A1:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return MESA_FORMAT_RGB;
case GL_RGB8:
return MESA_FORMAT_RGB888;
case GL_R3_G3_B2:
case GL_ALPHA4:
case GL_ALPHA12:
case GL_ALPHA16:
- return MESA_FORMAT_ALPHA;
case GL_ALPHA8:
return MESA_FORMAT_A8;
case GL_LUMINANCE4:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
- return MESA_FORMAT_LUMINANCE;
case GL_LUMINANCE8:
return MESA_FORMAT_L8;
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- return MESA_FORMAT_LUMINANCE_ALPHA;
case GL_LUMINANCE8_ALPHA8:
return MESA_FORMAT_AL88;
case GL_INTENSITY4:
case GL_INTENSITY12:
case GL_INTENSITY16:
- return MESA_FORMAT_INTENSITY;
case GL_INTENSITY8:
return MESA_FORMAT_I8;
switch (internalFormat) {
case GL_COMPRESSED_ALPHA_ARB:
- return MESA_FORMAT_ALPHA;
+ return MESA_FORMAT_A8;
case GL_COMPRESSED_LUMINANCE_ARB:
- return MESA_FORMAT_LUMINANCE;
+ return MESA_FORMAT_L8;
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- return MESA_FORMAT_LUMINANCE_ALPHA;
+ return MESA_FORMAT_AL88;
case GL_COMPRESSED_INTENSITY_ARB:
- return MESA_FORMAT_INTENSITY;
+ return MESA_FORMAT_I8;
case GL_COMPRESSED_RGB_ARB:
#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1)
ctx->Extensions.S3_s3tc)
return MESA_FORMAT_RGB_DXT1;
#endif
- return MESA_FORMAT_RGB;
+ return MESA_FORMAT_RGB888;
case GL_COMPRESSED_RGBA_ARB:
#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1)
ctx->Extensions.S3_s3tc)
return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */
#endif
- return MESA_FORMAT_RGBA;
+ return MESA_FORMAT_RGBA8888;
default:
; /* fallthrough */
}
return;
#endif
- case MESA_FORMAT_RGBA:
- *datatype = CHAN_TYPE;
- *comps = 4;
- return;
- case MESA_FORMAT_RGB:
- *datatype = CHAN_TYPE;
- *comps = 3;
- return;
- case MESA_FORMAT_LUMINANCE_ALPHA:
- *datatype = CHAN_TYPE;
- *comps = 2;
- return;
- case MESA_FORMAT_ALPHA:
- case MESA_FORMAT_LUMINANCE:
- case MESA_FORMAT_INTENSITY:
- *datatype = CHAN_TYPE;
- *comps = 1;
- return;
-
case MESA_FORMAT_RGBA_FLOAT32:
*datatype = GL_FLOAT;
*comps = 4;
#endif
-/* MESA_FORMAT_RGBA **********************************************************/
-
-/* 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 )
-{
- const GLchan *src = TEXEL_ADDR(GLchan, 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]);
-}
-
-#if DIM == 3
-/* Store a GLchan RGBA texel */
-static void store_texel_rgba(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLchan *rgba = (const GLchan *) texel;
- GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 4);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[GCOMP];
- dst[2] = rgba[BCOMP];
- dst[3] = rgba[ACOMP];
-}
-#endif
-
-/* MESA_FORMAT_RGB ***********************************************************/
-
-/* 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 )
-{
- const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 3);
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_rgb(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLchan *rgba = (const GLchan *) texel;
- GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 3);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[GCOMP];
- dst[2] = rgba[BCOMP];
-}
-#endif
-
-/* MESA_FORMAT_ALPHA *********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */
-static void FETCH(f_alpha)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = 0.0F;
- texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
-}
-
-#if DIM == 3
-static void store_texel_alpha(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLchan *rgba = (const GLchan *) texel;
- GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
- dst[0] = rgba[ACOMP];
-}
-#endif
-
-/* MESA_FORMAT_LUMINANCE *****************************************************/
-
-/* 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 )
-{
- const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[ACOMP] = 1.0F;
-}
-
-#if DIM == 3
-static void store_texel_luminance(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLchan *rgba = (const GLchan *) texel;
- GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
- dst[0] = rgba[RCOMP];
-}
-#endif
-
-/* MESA_FORMAT_LUMINANCE_ALPHA ***********************************************/
-
-/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */
-static void FETCH(f_luminance_alpha)(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 2);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[ACOMP] = CHAN_TO_FLOAT(src[1]);
-}
-
-#if DIM == 3
-static void store_texel_luminance_alpha(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLchan *rgba = (const GLchan *) texel;
- GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 2);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[ACOMP];
-}
-#endif
-
-/* MESA_FORMAT_INTENSITY *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */
-static void FETCH(f_intensity)( const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
- texel[BCOMP] =
- texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
-}
-
-#if DIM == 3
-static void store_texel_intensity(struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, const void *texel)
-{
- const GLchan *rgba = (const GLchan *) texel;
- GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
- dst[0] = rgba[RCOMP];
-}
-#endif
-
-
/* MESA_FORMAT_Z32 ***********************************************************/
/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture,
-/**
- * Store an image in any of the formats:
- * _mesa_texformat_rgba
- * _mesa_texformat_rgb
- * _mesa_texformat_alpha
- * _mesa_texformat_luminance
- * _mesa_texformat_luminance_alpha
- * _mesa_texformat_intensity
- *
- */
-static GLboolean
-_mesa_texstore_rgba(TEXSTORE_PARAMS)
-{
- const GLint components = _mesa_components_in_format(baseInternalFormat);
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
- const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA ||
- dstFormat == MESA_FORMAT_RGB ||
- dstFormat == MESA_FORMAT_ALPHA ||
- dstFormat == MESA_FORMAT_LUMINANCE ||
- dstFormat == MESA_FORMAT_LUMINANCE_ALPHA ||
- dstFormat == MESA_FORMAT_INTENSITY);
- ASSERT(baseInternalFormat == GL_RGBA ||
- baseInternalFormat == GL_RGB ||
- baseInternalFormat == GL_ALPHA ||
- baseInternalFormat == GL_LUMINANCE ||
- baseInternalFormat == GL_LUMINANCE_ALPHA ||
- baseInternalFormat == GL_INTENSITY);
- ASSERT(texelBytes == components * sizeof(GLchan));
-
- if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- baseInternalFormat == srcFormat &&
- srcType == CHAN_TYPE) {
- /* simple memcpy path */
- memcpy_texture(ctx, dims,
- dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride,
- dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcFormat, srcType,
- srcAddr, srcPacking);
- }
- else if (!ctx->_ImageTransferState &&
- !srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_RGB &&
- srcFormat == GL_RGBA &&
- srcType == CHAN_TYPE) {
- /* extract RGB from RGBA */
- GLint img, row, col;
- for (img = 0; img < srcDepth; img++) {
- GLchan *dstImage = (GLchan *)
- ((GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes);
-
- const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
- srcWidth, srcFormat, srcType);
- GLchan *srcRow = (GLchan *) _mesa_image_address(dims, srcPacking,
- srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
- GLchan *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- for (col = 0; col < srcWidth; col++) {
- dstRow[col * 3 + RCOMP] = srcRow[col * 4 + RCOMP];
- dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP];
- dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP];
- }
- dstRow += dstRowStride / sizeof(GLchan);
- srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride);
- }
- }
- }
- else if (!ctx->_ImageTransferState &&
- CHAN_TYPE == GL_UNSIGNED_BYTE &&
- (srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_UNSIGNED_INT_8_8_8_8 ||
- srcType == GL_UNSIGNED_INT_8_8_8_8_REV) &&
- can_swizzle(baseInternalFormat) &&
- can_swizzle(srcFormat)) {
-
- const GLubyte *dstmap;
- GLuint components;
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- if (dstFormat == MESA_FORMAT_RGBA) {
- dstmap = mappings[IDX_RGBA].from_rgba;
- components = 4;
- }
- else if (dstFormat == MESA_FORMAT_RGB) {
- dstmap = mappings[IDX_RGB].from_rgba;
- components = 3;
- }
- else if (dstFormat == MESA_FORMAT_ALPHA) {
- dstmap = mappings[IDX_ALPHA].from_rgba;
- components = 1;
- }
- else if (dstFormat == MESA_FORMAT_LUMINANCE) {
- dstmap = mappings[IDX_LUMINANCE].from_rgba;
- components = 1;
- }
- else if (dstFormat == MESA_FORMAT_LUMINANCE_ALPHA) {
- dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba;
- components = 2;
- }
- else if (dstFormat == MESA_FORMAT_INTENSITY) {
- dstmap = mappings[IDX_INTENSITY].from_rgba;
- components = 1;
- }
- else {
- _mesa_problem(ctx, "Unexpected dstFormat in _mesa_texstore_rgba");
- return GL_FALSE;
- }
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- srcFormat,
- srcType,
- baseInternalFormat,
- dstmap, components,
- dstAddr, dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLint bytesPerRow;
- GLint img, row;
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- bytesPerRow = srcWidth * components * sizeof(GLchan);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = (GLubyte *) dstAddr
- + dstImageOffsets[dstZoffset + img] * texelBytes
- + dstYoffset * dstRowStride
- + dstXoffset * texelBytes;
- for (row = 0; row < srcHeight; row++) {
- _mesa_memcpy(dstRow, src, bytesPerRow);
- dstRow += dstRowStride;
- src += srcWidth * components;
- }
- }
-
- _mesa_free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
-
/**
* Store a 32-bit integer depth component texture image.
*/
{ MESA_FORMAT_RGBA_DXT1, _mesa_texstore_rgba_dxt1 },
{ MESA_FORMAT_RGBA_DXT3, _mesa_texstore_rgba_dxt3 },
{ MESA_FORMAT_RGBA_DXT5, _mesa_texstore_rgba_dxt5 },
- { MESA_FORMAT_RGBA, _mesa_texstore_rgba },
- { MESA_FORMAT_RGB, _mesa_texstore_rgba },
- { MESA_FORMAT_ALPHA, _mesa_texstore_rgba },
- { MESA_FORMAT_LUMINANCE, _mesa_texstore_rgba },
- { MESA_FORMAT_LUMINANCE_ALPHA, _mesa_texstore_rgba },
- { MESA_FORMAT_INTENSITY, _mesa_texstore_rgba },
{ MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 },
{ MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 },
{ MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 },
ASSERT(tObj->WrapS==GL_REPEAT);
ASSERT(tObj->WrapT==GL_REPEAT);
ASSERT(img->Border==0);
- ASSERT(img->TexFormat == MESA_FORMAT_RGB);
+ ASSERT(img->TexFormat == MESA_FORMAT_RGB888);
ASSERT(img->_IsPowerOfTwo);
for (k=0; k<n; k++) {
GLint i = IFLOOR(texcoords[k][0] * width) & colMask;
GLint j = IFLOOR(texcoords[k][1] * height) & rowMask;
GLint pos = (j << shift) | i;
- GLchan *texel = ((GLchan *) img->Data) + 3*pos;
- rgba[k][RCOMP] = CHAN_TO_FLOAT(texel[0]);
- rgba[k][GCOMP] = CHAN_TO_FLOAT(texel[1]);
- rgba[k][BCOMP] = CHAN_TO_FLOAT(texel[2]);
+ GLubyte *texel = ((GLubyte *) img->Data) + 3*pos;
+ rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[0]);
+ rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]);
+ rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[2]);
}
}
ASSERT(tObj->WrapS==GL_REPEAT);
ASSERT(tObj->WrapT==GL_REPEAT);
ASSERT(img->Border==0);
- ASSERT(img->TexFormat == MESA_FORMAT_RGBA);
+ ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888);
ASSERT(img->_IsPowerOfTwo);
for (i = 0; i < n; i++) {
const GLint col = IFLOOR(texcoords[i][0] * width) & colMask;
const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask;
const GLint pos = (row << shift) | col;
- const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */
- rgba[i][RCOMP] = CHAN_TO_FLOAT(texel[0]);
- rgba[i][GCOMP] = CHAN_TO_FLOAT(texel[1]);
- rgba[i][BCOMP] = CHAN_TO_FLOAT(texel[2]);
- rgba[i][ACOMP] = CHAN_TO_FLOAT(texel[3]);
+ const GLubyte *texel = ((GLubyte *) img->Data) + (pos << 2); /* pos*4 */
+ rgba[i][RCOMP] = UBYTE_TO_FLOAT(texel[0]);
+ rgba[i][GCOMP] = UBYTE_TO_FLOAT(texel[1]);
+ rgba[i][BCOMP] = UBYTE_TO_FLOAT(texel[2]);
+ rgba[i][ACOMP] = UBYTE_TO_FLOAT(texel[3]);
}
}
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat) {
- case MESA_FORMAT_RGB:
+ case MESA_FORMAT_RGB888:
opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
- case MESA_FORMAT_RGBA:
+ case MESA_FORMAT_RGBA8888:
opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat) {
- case MESA_FORMAT_RGB:
+ case MESA_FORMAT_RGB888:
opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
- case MESA_FORMAT_RGBA:
+ case MESA_FORMAT_RGBA8888:
opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
rgba[i][RCOMP] = 0;
rgba[i][GCOMP] = 0;
rgba[i][BCOMP] = 0;
- rgba[i][ACOMP] = CHAN_MAX;
+ rgba[i][ACOMP] = 1.0;
}
}
t->WrapT == GL_REPEAT &&
img->_IsPowerOfTwo &&
img->Border == 0 &&
- img->TexFormat == MESA_FORMAT_RGB) {
+ img->TexFormat == MESA_FORMAT_RGB888) {
return &opt_sample_rgb_2d;
}
else if (t->WrapS == GL_REPEAT &&
t->WrapT == GL_REPEAT &&
img->_IsPowerOfTwo &&
img->Border == 0 &&
- img->TexFormat == MESA_FORMAT_RGBA) {
+ img->TexFormat == MESA_FORMAT_RGBA8888) {
return &opt_sample_rgba_2d;
}
else {
const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \
- const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \
+ const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \
const GLint smask = obj->Image[0][b]->Width - 1; \
const GLint tmask = obj->Image[0][b]->Height - 1; \
if (!rb || !texture) { \
#define RENDER_SPAN( span ) \
GLuint i; \
- GLchan rgb[MAX_WIDTH][3]; \
+ GLubyte rgb[MAX_WIDTH][3]; \
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
span.intTex[1] -= FIXED_HALF; \
for (i = 0; i < span.end; i++) { \
const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \
const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \
- const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \
+ const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \
const GLint smask = obj->Image[0][b]->Width - 1; \
const GLint tmask = obj->Image[0][b]->Height - 1; \
if (!rb || !texture) { \
#define RENDER_SPAN( span ) \
GLuint i; \
- GLchan rgb[MAX_WIDTH][3]; \
+ GLubyte rgb[MAX_WIDTH][3]; \
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \
span.intTex[1] -= FIXED_HALF; \
for (i = 0; i < span.end; i++) { \
&& texImg->_IsPowerOfTwo
&& texImg->Border == 0
&& texImg->Width == texImg->RowStride
- && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA)
+ && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888)
&& minFilter == magFilter
&& ctx->Light.Model.ColorControl == GL_SINGLE_COLOR
&& !swrast->_FogEnabled
&& ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) {
if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) {
if (minFilter == GL_NEAREST
- && format == MESA_FORMAT_RGB
+ && format == MESA_FORMAT_RGB888
&& (envMode == GL_REPLACE || envMode == GL_DECAL)
&& ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT)
&& ctx->Depth.Func == GL_LESS