mesa/texcompress: enable translation between MESA and GL ASTC formats
authorNanley Chery <nanley.g.chery@intel.com>
Tue, 28 Apr 2015 22:08:32 +0000 (15:08 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Wed, 26 Aug 2015 21:36:43 +0000 (14:36 -0700)
v3. conform the ASTC MESA_FORMAT enums to the existing naming convention.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
src/mesa/main/texcompress.c

index c028daa46e4dea7e5a183268ce953a301f71f34c..bb94137a940ca4bee681951c8a145364d023ab6a 100644 (file)
@@ -471,6 +471,63 @@ _mesa_glenum_to_compressed_format(GLenum format)
    case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
       return MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT;
 
+   case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
+      return MESA_FORMAT_RGBA_ASTC_4x4;
+   case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
+      return MESA_FORMAT_RGBA_ASTC_5x4;
+   case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
+      return MESA_FORMAT_RGBA_ASTC_5x5;
+   case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
+      return MESA_FORMAT_RGBA_ASTC_6x5;
+   case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
+      return MESA_FORMAT_RGBA_ASTC_6x6;
+   case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
+      return MESA_FORMAT_RGBA_ASTC_8x5;
+   case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
+      return MESA_FORMAT_RGBA_ASTC_8x6;
+   case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
+      return MESA_FORMAT_RGBA_ASTC_8x8;
+   case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
+      return MESA_FORMAT_RGBA_ASTC_10x5;
+   case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
+      return MESA_FORMAT_RGBA_ASTC_10x6;
+   case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
+      return MESA_FORMAT_RGBA_ASTC_10x8;
+   case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
+      return MESA_FORMAT_RGBA_ASTC_10x10;
+   case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
+      return MESA_FORMAT_RGBA_ASTC_12x10;
+   case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
+      return MESA_FORMAT_RGBA_ASTC_12x12;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x5;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x6;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x5;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x6;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x10;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x10;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+      return MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x12;
+
    default:
       return MESA_FORMAT_NONE;
    }
@@ -561,6 +618,63 @@ _mesa_compressed_format_to_glenum(struct gl_context *ctx, mesa_format mesaFormat
    case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT:
       return GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT;
 
+   case MESA_FORMAT_RGBA_ASTC_4x4:
+      return GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
+   case MESA_FORMAT_RGBA_ASTC_5x4:
+      return GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
+   case MESA_FORMAT_RGBA_ASTC_5x5:
+      return GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
+   case MESA_FORMAT_RGBA_ASTC_6x5:
+      return GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
+   case MESA_FORMAT_RGBA_ASTC_6x6:
+      return GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
+   case MESA_FORMAT_RGBA_ASTC_8x5:
+      return GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
+   case MESA_FORMAT_RGBA_ASTC_8x6:
+      return GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
+   case MESA_FORMAT_RGBA_ASTC_8x8:
+      return GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
+   case MESA_FORMAT_RGBA_ASTC_10x5:
+      return GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
+   case MESA_FORMAT_RGBA_ASTC_10x6:
+      return GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
+   case MESA_FORMAT_RGBA_ASTC_10x8:
+      return GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
+   case MESA_FORMAT_RGBA_ASTC_10x10:
+      return GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
+   case MESA_FORMAT_RGBA_ASTC_12x10:
+      return GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
+   case MESA_FORMAT_RGBA_ASTC_12x12:
+      return GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x5:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x6:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x5:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x6:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x10:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x10:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
+   case MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x12:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
+
    default:
       _mesa_problem(ctx, "Unexpected mesa texture format in"
                     " _mesa_compressed_format_to_glenum()");