summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress.c
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2015-04-28 15:08:32 -0700
committerNanley Chery <[email protected]>2015-08-26 14:36:43 -0700
commit23c9cd5a9613ad07bdbe55708a56562ee23f25d5 (patch)
tree9a803e441e63275ea68547448ea02bf6fa16e9f5 /src/mesa/main/texcompress.c
parent692578ed134bacff1a315489ad47514450b3387f (diff)
mesa/texcompress: enable translation between MESA and GL ASTC formats
v3. conform the ASTC MESA_FORMAT enums to the existing naming convention. Reviewed-by: Anuj Phogat <[email protected]> Signed-off-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src/mesa/main/texcompress.c')
-rw-r--r--src/mesa/main/texcompress.c114
1 files changed, 114 insertions, 0 deletions
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index c028daa46e4..bb94137a940 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_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()");