summaryrefslogtreecommitdiff
path: root/xc/lib/GL/mesa/src/drv/r200
diff options
context:
space:
mode:
authorfxkuehl <fxkuehl>2003-10-25 14:40:54 +0000
committerfxkuehl <fxkuehl>2003-10-25 14:40:54 +0000
commit649709fecaa54b93b9f15c654a55be3829b1a2f8 (patch)
treeaf6575b1076c68f976c94c2d71a88cbac13d0963 /xc/lib/GL/mesa/src/drv/r200
parentf806a37ba0ad8b43326cb69ee9b84b23f76b3160 (diff)
Improved internal texture format selection in mga, r128, r200 and radeon:
- try to choose a texture format with same color depths as application supplied data in order to avoid loss of color information (mga, r200 and radeon only) - don't override application's choice of internal color depth unless force16bpt is GL_TRUE. For now it is always GL_FALSE, but will be configurable soon
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/r200')
-rw-r--r--xc/lib/GL/mesa/src/drv/r200/r200_tex.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_tex.c b/xc/lib/GL/mesa/src/drv/r200/r200_tex.c
index 8554a5fdc..02110a361 100644
--- a/xc/lib/GL/mesa/src/drv/r200/r200_tex.c
+++ b/xc/lib/GL/mesa/src/drv/r200/r200_tex.c
@@ -296,37 +296,50 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
const GLboolean do32bpt = rmesa->default32BitTextures;
+ const GLboolean force16bpt = GL_FALSE;
+ (void) format;
switch ( internalFormat ) {
case 4:
case GL_RGBA:
case GL_COMPRESSED_RGBA:
- if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return &_mesa_texformat_argb8888;
- }
- else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
+ 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;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ return &_mesa_texformat_argb4444;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ return &_mesa_texformat_argb1555;
+ default:
+ return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444;
}
- return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444;
case 3:
case GL_RGB:
case GL_COMPRESSED_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
+ switch ( type ) {
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ return &_mesa_texformat_argb4444;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ return &_mesa_texformat_argb1555;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
return &_mesa_texformat_rgb565;
+ default:
+ return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565;
}
- return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565;
case GL_RGBA8:
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444;
+ return !force16bpt ?
+ &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444;
case GL_RGBA4:
case GL_RGBA2:
@@ -339,7 +352,7 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565;
+ return !force16bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565;
case GL_RGB5:
case GL_RGB4: