diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2004-06-19 17:44:23 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2004-06-19 17:44:23 +0000 |
commit | f252f64430ccb957698fcf85e84c9d64008147eb (patch) | |
tree | 7c1de4462f2a91d6713cb52181f78b00b03211bf /src/mesa/drivers/dri/r200 | |
parent | 07694b8935f69f69352648dd7ebf59a7222f1c8e (diff) |
Big-endian texture fixes from Michel Dänzer.
Diffstat (limited to 'src/mesa/drivers/dri/r200')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_tex.c | 42 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_texstate.c | 10 |
2 files changed, 32 insertions, 20 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index fd326ad959..20febb508f 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -324,15 +324,15 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + return do32bpt ? _dri_texformat_argb8888 : _dri_texformat_argb1555; case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return _dri_texformat_argb4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return _dri_texformat_argb1555; default: - return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444; + return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_argb4444; } case 3: @@ -341,15 +341,15 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return _dri_texformat_argb4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return _dri_texformat_argb1555; case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: - return &_mesa_texformat_rgb565; + return _dri_texformat_rgb565; default: - return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565; + return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565; } case GL_RGBA8: @@ -357,25 +357,25 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGBA12: case GL_RGBA16: return !force16bpt ? - &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444; + _dri_texformat_rgba8888 : _dri_texformat_argb4444; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return _dri_texformat_argb4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return _dri_texformat_argb1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return !force16bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565; + return !force16bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565; case GL_RGB5: case GL_RGB4: case GL_R3_G3_B2: - return &_mesa_texformat_rgb565; + return _dri_texformat_rgb565; case GL_ALPHA: case GL_ALPHA4: @@ -383,7 +383,7 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return _dri_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_l8; + return _dri_texformat_l8; case 2: case GL_LUMINANCE_ALPHA: @@ -403,7 +403,7 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return _dri_texformat_al88; case GL_INTENSITY: case GL_INTENSITY4: @@ -411,11 +411,11 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return _dri_texformat_i8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || - type == GL_UNSIGNED_BYTE) + type == GL_UNSIGNED_BYTE) return &_mesa_texformat_ycbcr; else return &_mesa_texformat_ycbcr_rev; @@ -461,7 +461,7 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target, switch ( internalFormat ) { case GL_RGBA: if ( format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV ) { - texImage->TexFormat = &_mesa_texformat_argb8888; + texImage->TexFormat = _dri_texformat_argb8888; } else return 0; @@ -469,7 +469,7 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target, case GL_RGB: if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) { - texImage->TexFormat = &_mesa_texformat_rgb565; + texImage->TexFormat = _dri_texformat_rgb565; } else return 0; @@ -1034,6 +1034,8 @@ void r200InitTextureFuncs( struct dd_function_table *functions ) functions->TexParameter = r200TexParameter; functions->TexGen = r200TexGen; + driInitTextureFormats(); + #if 000 /* moved or obsolete code */ r200ContextPtr rmesa = R200_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 08791ff788..cde801b0ab 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -56,8 +56,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define _COLOR(f) \ [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, 0 } +#define _COLOR_REV(f) \ + [ MESA_FORMAT_ ## f ## _REV ] = { R200_TXFORMAT_ ## f, 0 } #define _ALPHA(f) \ [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 } +#define _ALPHA_REV(f) \ + [ MESA_FORMAT_ ## f ## _REV ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 } #define _YUV(f) \ [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB } #define _INVALID(f) \ @@ -71,12 +75,18 @@ static const struct { tx_table[] = { _ALPHA(RGBA8888), + _ALPHA_REV(RGBA8888), _ALPHA(ARGB8888), + _ALPHA_REV(ARGB8888), _INVALID(RGB888), _COLOR(RGB565), + _COLOR_REV(RGB565), _ALPHA(ARGB4444), + _ALPHA_REV(ARGB4444), _ALPHA(ARGB1555), + _ALPHA_REV(ARGB1555), _ALPHA(AL88), + _ALPHA_REV(AL88), _ALPHA(A8), _COLOR(L8), _ALPHA(I8), |