mesa: for ARB_fbo, lift restriction that all FBO attachments are same size and color...
[mesa.git] / src / mesa / main / texcompress.c
index 2516339e1127e1c6aee580a4ad975c1f534191ff..3ff633acd2bd1d0a03c2c1eb2d49c2e83ee97ff9 100644 (file)
@@ -34,6 +34,7 @@
 #include "colormac.h"
 #include "context.h"
 #include "image.h"
+#include "mipmap.h"
 #include "texcompress.h"
 #include "texformat.h"
 #include "texstore.h"
@@ -95,6 +96,19 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all)
             n += 4;
          }
       }
+#if FEATURE_EXT_texture_sRGB
+      if (ctx->Extensions.EXT_texture_sRGB) {
+         if (formats) {
+            formats[n++] = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
+            formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
+            formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
+            formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
+         }
+         else {
+            n += 4;
+         }
+      }
+#endif /* FEATURE_EXT_texture_sRGB */
    }
    return n;
 }
@@ -135,8 +149,6 @@ _mesa_compressed_texture_size( GLcontext *ctx,
       /* Textures smaller than 8x4 will effectively be made into 8x4 and
        * take 16 bytes.
        */
-      if (size < 16)
-         size = 16;
       return size;
    case MESA_FORMAT_RGB_DXT1:
    case MESA_FORMAT_RGBA_DXT1:
@@ -148,8 +160,6 @@ _mesa_compressed_texture_size( GLcontext *ctx,
       /* Textures smaller than 4x4 will effectively be made into 4x4 and
        * take 8 bytes.
        */
-      if (size < 8)
-         size = 8;
       return size;
    case MESA_FORMAT_RGBA_DXT3:
    case MESA_FORMAT_RGBA_DXT5:
@@ -161,8 +171,6 @@ _mesa_compressed_texture_size( GLcontext *ctx,
       /* Textures smaller than 4x4 will effectively be made into 4x4 and
        * take 16 bytes.
        */
-      if (size < 16)
-         size = 16;
       return size;
    default:
       _mesa_problem(ctx, "bad mesaFormat in _mesa_compressed_texture_size");