[Mesa-dev] [PATCH v3 07/18] mesa/texcompress: enable translation between MESA and GL ASTC formats

Nanley Chery nanleychery at gmail.com
Mon Jun 22 16:02:13 PDT 2015


From: Nanley Chery <nanley.g.chery at intel.com>

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/mesa/main/texcompress.c | 114 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)

diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 1654fc6..203a065 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -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_ASTC_4x4_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
+      return MESA_FORMAT_ASTC_5x4_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
+      return MESA_FORMAT_ASTC_5x5_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
+      return MESA_FORMAT_ASTC_6x5_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
+      return MESA_FORMAT_ASTC_6x6_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
+      return MESA_FORMAT_ASTC_8x5_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
+      return MESA_FORMAT_ASTC_8x6_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
+      return MESA_FORMAT_ASTC_8x8_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
+      return MESA_FORMAT_ASTC_10x5_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
+      return MESA_FORMAT_ASTC_10x6_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
+      return MESA_FORMAT_ASTC_10x8_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
+      return MESA_FORMAT_ASTC_10x10_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
+      return MESA_FORMAT_ASTC_12x10_RGBA;
+   case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
+      return MESA_FORMAT_ASTC_12x12_RGBA;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+      return MESA_FORMAT_ASTC_4x4_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+      return MESA_FORMAT_ASTC_5x4_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+      return MESA_FORMAT_ASTC_5x5_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+      return MESA_FORMAT_ASTC_6x5_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+      return MESA_FORMAT_ASTC_6x6_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+      return MESA_FORMAT_ASTC_8x5_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+      return MESA_FORMAT_ASTC_8x6_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+      return MESA_FORMAT_ASTC_8x8_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+      return MESA_FORMAT_ASTC_10x5_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+      return MESA_FORMAT_ASTC_10x6_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+      return MESA_FORMAT_ASTC_10x8_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+      return MESA_FORMAT_ASTC_10x10_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+      return MESA_FORMAT_ASTC_12x10_SRGB8_ALPHA8;
+   case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+      return MESA_FORMAT_ASTC_12x12_SRGB8_ALPHA8;
+
    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_ASTC_4x4_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
+   case MESA_FORMAT_ASTC_5x4_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
+   case MESA_FORMAT_ASTC_5x5_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
+   case MESA_FORMAT_ASTC_6x5_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
+   case MESA_FORMAT_ASTC_6x6_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
+   case MESA_FORMAT_ASTC_8x5_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
+   case MESA_FORMAT_ASTC_8x6_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
+   case MESA_FORMAT_ASTC_8x8_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
+   case MESA_FORMAT_ASTC_10x5_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
+   case MESA_FORMAT_ASTC_10x6_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
+   case MESA_FORMAT_ASTC_10x8_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
+   case MESA_FORMAT_ASTC_10x10_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
+   case MESA_FORMAT_ASTC_12x10_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
+   case MESA_FORMAT_ASTC_12x12_RGBA:
+      return GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
+   case MESA_FORMAT_ASTC_4x4_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
+   case MESA_FORMAT_ASTC_5x4_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
+   case MESA_FORMAT_ASTC_5x5_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
+   case MESA_FORMAT_ASTC_6x5_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
+   case MESA_FORMAT_ASTC_6x6_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
+   case MESA_FORMAT_ASTC_8x5_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
+   case MESA_FORMAT_ASTC_8x6_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
+   case MESA_FORMAT_ASTC_8x8_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
+   case MESA_FORMAT_ASTC_10x5_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
+   case MESA_FORMAT_ASTC_10x6_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
+   case MESA_FORMAT_ASTC_10x8_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
+   case MESA_FORMAT_ASTC_10x10_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
+   case MESA_FORMAT_ASTC_12x10_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
+   case MESA_FORMAT_ASTC_12x12_SRGB8_ALPHA8:
+      return GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
+
    default:
       _mesa_problem(ctx, "Unexpected mesa texture format in"
                     " _mesa_compressed_format_to_glenum()");
-- 
2.4.2



More information about the mesa-dev mailing list