From: Nanley Chery Date: Tue, 28 Apr 2015 22:08:32 +0000 (-0700) Subject: mesa/texcompress: enable translation between MESA and GL ASTC formats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=23c9cd5a9613ad07bdbe55708a56562ee23f25d5;p=mesa.git 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 Signed-off-by: Nanley Chery --- 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()");