From c37e283423a33ce870e865e9adeca7f4eddf4b5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 1 Mar 2011 21:15:38 +0100 Subject: [PATCH] st/mesa: use RGTC for GL_COMPRESSED_RED/RG if possible With proper fallback formats. --- src/mesa/state_tracker/st_format.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index c58ec9267dc..22a1450cfe7 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -674,8 +674,6 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, } return PIPE_FORMAT_NONE; - case GL_COMPRESSED_RED: - case GL_COMPRESSED_RG: case GL_COMPRESSED_RGB: /* can only sample from compressed formats */ if (bindings & ~PIPE_BIND_SAMPLER_VIEW) @@ -871,10 +869,14 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, return PIPE_FORMAT_R16G16_UNORM; return PIPE_FORMAT_NONE; + case GL_COMPRESSED_RED: case GL_COMPRESSED_RED_RGTC1: if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_UNORM, target, sample_count, bindings, geom_flags)) return PIPE_FORMAT_RGTC1_UNORM; + if (screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_R8_UNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_SIGNED_RED_RGTC1: @@ -883,10 +885,14 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, return PIPE_FORMAT_RGTC1_SNORM; return PIPE_FORMAT_NONE; + case GL_COMPRESSED_RG: case GL_COMPRESSED_RG_RGTC2: if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_UNORM, target, sample_count, bindings, geom_flags)) return PIPE_FORMAT_RGTC2_UNORM; + if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_R8G8_UNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_SIGNED_RG_RGTC2: -- 2.30.2