From e519b8a9af0f994d6b33e748ada463ff19df7ab8 Mon Sep 17 00:00:00 2001 From: Anuj Phogat Date: Mon, 5 Nov 2012 17:45:18 -0800 Subject: mesa: Add new MESA_FORMATs for ETC2 compressed textures It is required by OpenGL ES 3.0 to support ETC2 textures. This patch adds new MESA_FORMATs for following etc2 texture formats: GL_COMPRESSED_RGB8_ETC2 GL_COMPRESSED_SRGB8_ETC2 GL_COMPRESSED_RGBA8_ETC2_EAC GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC GL_COMPRESSED_R11_EAC GL_COMPRESSED_RG11_EAC GL_COMPRESSED_SIGNED_R11_EAC GL_COMPRESSED_SIGNED_RG11_EAC MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1 MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1 Above formats are currently available in only gles 3.0. v2: Add entries in texfetch_funcs[] array. Signed-off-by: Anuj Phogat Reviewed-by: Brian Paul v3 (Paul Berry ): comment out symbols that are not implemented yet, so that this commit compiles on its own; future commits will uncomment the symbols as they become available. --- src/mesa/main/texformat.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index f0bc7fdb93b..b3ffc6c51bc 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -972,6 +972,43 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, } } + if (_mesa_is_gles3(ctx)) { + switch (internalFormat) { + case GL_COMPRESSED_RGB8_ETC2: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_RGB8); + break; + case GL_COMPRESSED_SRGB8_ETC2: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SRGB8); + break; + case GL_COMPRESSED_RGBA8_ETC2_EAC: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_RGBA8_EAC); + break; + case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC); + break; + case GL_COMPRESSED_R11_EAC: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_R11_EAC); + break; + case GL_COMPRESSED_RG11_EAC: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_RG11_EAC); + break; + case GL_COMPRESSED_SIGNED_R11_EAC: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SIGNED_R11_EAC); + break; + case GL_COMPRESSED_SIGNED_RG11_EAC: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SIGNED_RG11_EAC); + break; + case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1); + break; + case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: + RETURN_IF_SUPPORTED(MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1); + break; + default: + ; /* fallthrough */ + } + } + _mesa_problem(ctx, "unexpected format %s in _mesa_choose_tex_format()", _mesa_lookup_enum_by_nr(internalFormat)); return MESA_FORMAT_NONE; -- cgit v1.2.3