From 5fe52044efec0506eb2ce05ccdc9e5ce53941538 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 13 Feb 2018 17:37:56 +0100 Subject: [PATCH] st/mesa: add ETC2 & ASTC fast path for GetTex(Sub)Image MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Not sure if GL/GLES can hit this path, but it's just decompression. Tested-by: Mike Lothian Tested-By: Gert Wollny Tested-by: Dieter Nützel Reviewed-By: Gert Wollny --- src/mesa/state_tracker/st_cb_texture.c | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index ecd1f4ef339..80eb171dfd8 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1967,6 +1967,23 @@ st_GetTexSubImage(struct gl_context * ctx, case PIPE_FORMAT_RGTC1_UNORM: case PIPE_FORMAT_RGTC2_UNORM: case PIPE_FORMAT_ETC1_RGB8: + case PIPE_FORMAT_ETC2_RGB8: + case PIPE_FORMAT_ETC2_RGB8A1: + case PIPE_FORMAT_ETC2_RGBA8: + case PIPE_FORMAT_ASTC_4x4: + case PIPE_FORMAT_ASTC_5x4: + case PIPE_FORMAT_ASTC_5x5: + case PIPE_FORMAT_ASTC_6x5: + case PIPE_FORMAT_ASTC_6x6: + case PIPE_FORMAT_ASTC_8x5: + case PIPE_FORMAT_ASTC_8x6: + case PIPE_FORMAT_ASTC_8x8: + case PIPE_FORMAT_ASTC_10x5: + case PIPE_FORMAT_ASTC_10x6: + case PIPE_FORMAT_ASTC_10x8: + case PIPE_FORMAT_ASTC_10x10: + case PIPE_FORMAT_ASTC_12x10: + case PIPE_FORMAT_ASTC_12x12: case PIPE_FORMAT_BPTC_RGBA_UNORM: dst_glformat = GL_RGBA8; break; @@ -1982,6 +1999,30 @@ st_GetTexSubImage(struct gl_context * ctx, goto fallback; dst_glformat = GL_RGBA32F; break; + case PIPE_FORMAT_ETC2_R11_UNORM: + if (!screen->is_format_supported(screen, PIPE_FORMAT_R16_UNORM, + pipe_target, 0, bind)) + goto fallback; + dst_glformat = GL_R16; + break; + case PIPE_FORMAT_ETC2_R11_SNORM: + if (!screen->is_format_supported(screen, PIPE_FORMAT_R16_SNORM, + pipe_target, 0, bind)) + goto fallback; + dst_glformat = GL_R16_SNORM; + break; + case PIPE_FORMAT_ETC2_RG11_UNORM: + if (!screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM, + pipe_target, 0, bind)) + goto fallback; + dst_glformat = GL_RG16; + break; + case PIPE_FORMAT_ETC2_RG11_SNORM: + if (!screen->is_format_supported(screen, PIPE_FORMAT_R16G16_SNORM, + pipe_target, 0, bind)) + goto fallback; + dst_glformat = GL_RG16_SNORM; + break; default: assert(0); goto fallback; -- 2.30.2