r300: Initial work on merging radeon_lock.[ch].
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_tex.c
index c466af868c4981ba79553763914a8b31e57121d0..edaea6c209c2bad950df07599e45d9ad04b274e7 100644 (file)
@@ -174,7 +174,24 @@ static void radeonSetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf )
 
    t->pp_txfilter &= ~(RADEON_MIN_FILTER_MASK | RADEON_MAG_FILTER_MASK);
 
-   if ( anisotropy == RADEON_MAX_ANISO_1_TO_1 ) {
+   /* r100 chips can't handle mipmaps/aniso for cubemap/volume textures */
+   if ( t->base.tObj->Target == GL_TEXTURE_CUBE_MAP ) {
+      switch ( minf ) {
+      case GL_NEAREST:
+      case GL_NEAREST_MIPMAP_NEAREST:
+      case GL_NEAREST_MIPMAP_LINEAR:
+        t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST;
+        break;
+      case GL_LINEAR:
+      case GL_LINEAR_MIPMAP_NEAREST:
+      case GL_LINEAR_MIPMAP_LINEAR:
+        t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR;
+        break;
+      default:
+        break;
+      }
+   }
+   else if ( anisotropy == RADEON_MAX_ANISO_1_TO_1 ) {
       switch ( minf ) {
       case GL_NEAREST:
         t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST;
@@ -294,7 +311,7 @@ radeonChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
       case GL_UNSIGNED_SHORT_1_5_5_5_REV:
         return _dri_texformat_argb1555;
       default:
-         return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_argb4444;
+         return do32bpt ? _dri_texformat_argb8888 : _dri_texformat_argb4444;
       }
 
    case 3:
@@ -311,7 +328,7 @@ radeonChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
       case GL_UNSIGNED_SHORT_5_6_5_REV:
         return _dri_texformat_rgb565;
       default:
-         return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565;
+         return do32bpt ? _dri_texformat_argb8888 : _dri_texformat_rgb565;
       }
 
    case GL_RGBA8:
@@ -319,7 +336,7 @@ radeonChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
    case GL_RGBA12:
    case GL_RGBA16:
       return !force16bpt ?
-         _dri_texformat_rgba8888 : _dri_texformat_argb4444;
+         _dri_texformat_argb8888 : _dri_texformat_argb4444;
 
    case GL_RGBA4:
    case GL_RGBA2:
@@ -332,7 +349,7 @@ radeonChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
    case GL_RGB10:
    case GL_RGB12:
    case GL_RGB16:
-      return !force16bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565;
+      return !force16bpt ? _dri_texformat_argb8888 : _dri_texformat_rgb565;
 
    case GL_RGB5:
    case GL_RGB4:
@@ -774,7 +791,7 @@ static void radeonBindTexture( GLcontext *ctx, GLenum target,
    }
 
    assert( (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D &&
-            target != GL_TEXTURE_RECTANGLE_NV) ||
+            target != GL_TEXTURE_RECTANGLE_NV && target != GL_TEXTURE_CUBE_MAP) ||
            (texObj->DriverData != NULL) );
 }