OSDN Git Service

intel: Don't depend on context config values when picking texture formats
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 29 Jul 2010 19:39:36 +0000 (15:39 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 29 Jul 2010 19:45:48 +0000 (15:45 -0400)
src/mesa/drivers/dri/intel/intel_tex_format.c

index 5f813c0..e03b203 100644 (file)
@@ -19,7 +19,6 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
                          GLenum format, GLenum type)
 {
    struct intel_context *intel = intel_context(ctx);
-   const GLboolean do32bpt = (intel->ctx.Visual.rgbBits >= 24);
 
 #if 0
    printf("%s intFmt=0x%x format=0x%x type=0x%x\n",
@@ -30,39 +29,28 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
    case 4:
    case GL_RGBA:
    case GL_COMPRESSED_RGBA:
-      if (format == GL_BGRA) {
-         if (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) {
-            return MESA_FORMAT_ARGB8888;
-         }
-         else if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
-            return MESA_FORMAT_ARGB4444;
-         }
-         else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
-            return MESA_FORMAT_ARGB1555;
-         }
-      }
-      return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
+      if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV)
+        return MESA_FORMAT_ARGB4444;
+      else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV)
+        return MESA_FORMAT_ARGB1555;
+      else
+        return MESA_FORMAT_ARGB8888;
 
    case 3:
    case GL_RGB:
    case GL_COMPRESSED_RGB:
-      if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
-         return MESA_FORMAT_RGB565;
-      }
-      if (do32bpt) {
-        if (intel->has_xrgb_textures)
-           return MESA_FORMAT_XRGB8888;
-        else
-           return MESA_FORMAT_ARGB8888;
-      } else {
+      if (type == GL_UNSIGNED_SHORT_5_6_5)
         return MESA_FORMAT_RGB565;
-      }
+      else if (intel->has_xrgb_textures)
+        return MESA_FORMAT_XRGB8888;
+      else
+        return MESA_FORMAT_ARGB8888;
 
    case GL_RGBA8:
    case GL_RGB10_A2:
    case GL_RGBA12:
    case GL_RGBA16:
-      return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
+      return MESA_FORMAT_ARGB8888;
 
    case GL_RGBA4:
    case GL_RGBA2: