diff options
author | Keith Whitwell <[email protected]> | 2006-09-21 10:20:15 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2006-09-21 10:20:15 +0000 |
commit | cac5974bf9385f8c9bd46f9c90bfa8144f0c33d6 (patch) | |
tree | 015582c29fc0a93bafa714ced172047c9404d51b /src/mesa/drivers/dri/i965 | |
parent | afd244d4e8dc36895676c1b3bdbdba59f03a6962 (diff) |
Do a better job of choosing texture formats to avoid image conversions.
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tex.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index 47bd875bb06..8332d869e1d 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -49,12 +49,23 @@ static const struct gl_texture_format * brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat, - GLenum format, GLenum type ) + GLenum srcFormat, GLenum srcType ) { switch ( internalFormat ) { case 4: case GL_RGBA: case GL_COMPRESSED_RGBA: + if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) + return &_mesa_texformat_argb4444; + else if (srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) + return &_mesa_texformat_argb1555; + else if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || + (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) || + (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8)) + return &_mesa_texformat_rgba8888_rev; + else + return &_mesa_texformat_argb8888; + case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: @@ -73,8 +84,8 @@ brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case 3: case GL_COMPRESSED_RGB: case GL_RGB: - if (format == GL_RGB && - type == GL_UNSIGNED_SHORT_5_6_5) + if (srcFormat == GL_RGB && + srcType == GL_UNSIGNED_SHORT_5_6_5) return &_mesa_texformat_rgb565; else return &_mesa_texformat_argb8888; @@ -127,8 +138,8 @@ brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat, return &_mesa_texformat_i8; case GL_YCBCR_MESA: - if (type == GL_UNSIGNED_SHORT_8_8_MESA || - type == GL_UNSIGNED_BYTE) + if (srcType == GL_UNSIGNED_SHORT_8_8_MESA || + srcType == GL_UNSIGNED_BYTE) return &_mesa_texformat_ycbcr; else return &_mesa_texformat_ycbcr_rev; |