diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 4 | ||||
-rw-r--r-- | src/mesa/main/formats.c | 48 | ||||
-rw-r--r-- | src/mesa/main/formats.h | 13 | ||||
-rw-r--r-- | src/mesa/main/mipmap.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texfetch.c | 42 | ||||
-rw-r--r-- | src/mesa/main/texformat.c | 37 | ||||
-rw-r--r-- | src/mesa/main/texformat_tmp.h | 146 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 164 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfilter.c | 36 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 12 |
10 files changed, 35 insertions, 471 deletions
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 5b00b5b82cd..d757e50b5a7 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1025,9 +1025,9 @@ choose_tex_format( GLcontext *ctx, GLint internalFormat, { 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); } diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 2ad5685883e..f915b1da91a 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -402,54 +402,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = #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, GL_FLOAT, diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index dbde28e727a..9235828a0f7 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -43,6 +43,7 @@ typedef enum { MESA_FORMAT_NONE = 0, + /** * \name Basic hardware formats */ @@ -115,18 +116,6 @@ typedef enum /*@}*/ /** - * \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. */ /*@{*/ diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 7e99a5d3de5..ccd153303d4 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1521,11 +1521,11 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, 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 { diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 20ee2527f5f..8149166560e 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -128,48 +128,6 @@ static struct { 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, fetch_texel_2d_srgb8, diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index bee7f583cf9..b1ae3240503 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -69,7 +69,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, 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: @@ -85,7 +84,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, 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: @@ -100,7 +98,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_ALPHA4: case GL_ALPHA12: case GL_ALPHA16: - return MESA_FORMAT_ALPHA; case GL_ALPHA8: return MESA_FORMAT_A8; @@ -110,7 +107,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE4: case GL_LUMINANCE12: case GL_LUMINANCE16: - return MESA_FORMAT_LUMINANCE; case GL_LUMINANCE8: return MESA_FORMAT_L8; @@ -122,7 +118,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, 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; @@ -130,7 +125,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY4: case GL_INTENSITY12: case GL_INTENSITY16: - return MESA_FORMAT_INTENSITY; case GL_INTENSITY8: return MESA_FORMAT_I8; @@ -162,13 +156,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, 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) @@ -179,7 +173,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, 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) @@ -190,7 +184,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, 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 */ } @@ -504,25 +498,6 @@ _mesa_format_to_type_and_comps(gl_format format, 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; diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index cb8386bbc80..939c4d07767 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -70,152 +70,6 @@ #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, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index d5bc16dee41..56d6c639063 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1005,164 +1005,6 @@ memcpy_texture(GLcontext *ctx, /** - * 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. */ static GLboolean @@ -3230,12 +3072,6 @@ texstore_funcs[MESA_FORMAT_COUNT] = { 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 }, diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 11c8f9256a8..6cba8ed34b7 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1343,17 +1343,17 @@ opt_sample_rgb_2d(GLcontext *ctx, 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]); } } @@ -1384,18 +1384,18 @@ opt_sample_rgba_2d(GLcontext *ctx, 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]); } } @@ -1428,11 +1428,11 @@ sample_lambda_2d(GLcontext *ctx, 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; @@ -1485,11 +1485,11 @@ sample_lambda_2d(GLcontext *ctx, 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; @@ -3137,7 +3137,7 @@ null_sample_func( GLcontext *ctx, rgba[i][RCOMP] = 0; rgba[i][GCOMP] = 0; rgba[i][BCOMP] = 0; - rgba[i][ACOMP] = CHAN_MAX; + rgba[i][ACOMP] = 1.0; } } @@ -3189,14 +3189,14 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, 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 { diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 7b59763f110..6a61bec245e 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -140,7 +140,7 @@ _swrast_culltriangle( GLcontext *ctx, 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) { \ @@ -149,7 +149,7 @@ _swrast_culltriangle( GLcontext *ctx, #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++) { \ @@ -192,7 +192,7 @@ _swrast_culltriangle( GLcontext *ctx, 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) { \ @@ -201,7 +201,7 @@ _swrast_culltriangle( GLcontext *ctx, #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++) { \ @@ -1075,7 +1075,7 @@ _swrast_choose_triangle( GLcontext *ctx ) && 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 @@ -1083,7 +1083,7 @@ _swrast_choose_triangle( GLcontext *ctx ) && 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 |