From 8ad28091aef4e98916e3ae45de5e405dc0988904 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 17 Jun 2004 21:19:21 +0000 Subject: [PATCH] use I8 internal format for GL_INTENSITY, GL_ALPHA and GL_LUMINANCE texture formats. Fix various small bugs with tex env combine mode GL_DOT3_RGB(A)/GL_DOT3_RGB(A)_EXT --- src/mesa/drivers/dri/r200/r200_tex.c | 10 +++------ src/mesa/drivers/dri/r200/r200_texstate.c | 25 +++++++++++------------ 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 810607c3538..fd326ad959f 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -383,7 +383,7 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_al88; + return &_mesa_texformat_a8; case 1: case GL_LUMINANCE: @@ -392,7 +392,7 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_al88; + return &_mesa_texformat_l8; case 2: case GL_LUMINANCE_ALPHA: @@ -411,11 +411,7 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - /* At the moment, glean & conform both fail using the i8 internal - * format. - */ - return &_mesa_texformat_al88; -/* return &_mesa_texformat_i8; */ + return &_mesa_texformat_i8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 586a6df61c4..08791ff7881 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -48,6 +48,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_tcl.h" +#define R200_TXFORMAT_A8 R200_TXFORMAT_I8 +#define R200_TXFORMAT_L8 R200_TXFORMAT_I8 #define R200_TXFORMAT_AL88 R200_TXFORMAT_AI88 #define R200_TXFORMAT_YCBCR R200_TXFORMAT_YVYU422 #define R200_TXFORMAT_YCBCR_REV R200_TXFORMAT_VYUY422 @@ -75,9 +77,9 @@ tx_table[] = _ALPHA(ARGB4444), _ALPHA(ARGB1555), _ALPHA(AL88), - _INVALID(A8), - _INVALID(L8), - _COLOR(I8), + _ALPHA(A8), + _COLOR(L8), + _ALPHA(I8), _INVALID(CI8), _YUV(YCBCR), _YUV(YCBCR_REV), @@ -427,8 +429,10 @@ static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit ) r200ContextPtr rmesa = R200_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLuint color_combine, alpha_combine; - GLuint color_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2]; - GLuint alpha_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2]; + GLuint color_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] & + ~(R200_TXC_SCALE_MASK); + GLuint alpha_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] & + ~(R200_TXA_DOT_ALPHA | R200_TXA_SCALE_MASK); /* texUnit->_Current can be NULL if and only if the texture unit is * not actually enabled. @@ -592,7 +596,6 @@ static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit ) * 1.3) does. */ RGBshift = 0; - Ashift = 0; /* FALLTHROUGH */ case GL_DOT3_RGB: @@ -605,9 +608,6 @@ static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit ) * normally. */ - RGBshift++; - Ashift = RGBshift; - color_combine = (R200_TXC_ARG_C_ZERO | R200_TXC_OP_DOT3 | R200_TXC_BIAS_ARG_A | @@ -709,16 +709,15 @@ static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit ) return GL_FALSE; } - if ( (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGB_EXT) - || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGB) ) { + if ( (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT) + || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA) ) { alpha_scale |= R200_TXA_DOT_ALPHA; + Ashift = RGBshift; } /* Step 3: * Apply the scale factor. */ - color_scale &= ~R200_TXC_SCALE_MASK; - alpha_scale &= ~R200_TXA_SCALE_MASK; color_scale |= (RGBshift << R200_TXC_SCALE_SHIFT); alpha_scale |= (Ashift << R200_TXA_SCALE_SHIFT); -- 2.30.2