From: Brian Paul Date: Tue, 27 Apr 2010 15:11:36 +0000 (-0600) Subject: st/mesa: try to get actual compressed format for GL_COMPRESSED_RGB[A] formats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=29edc2a8b5be7df46f29493bb8ae2fb2c8be8ef3;p=mesa.git st/mesa: try to get actual compressed format for GL_COMPRESSED_RGB[A] formats --- diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index c149c5cf0b8..c423e54f274 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -402,14 +402,12 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, switch (internalFormat) { case 4: case GL_RGBA: - case GL_COMPRESSED_RGBA: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: return default_rgba_format( screen, target, tex_usage, geom_flags ); case 3: case GL_RGB: - case GL_COMPRESSED_RGB: return default_rgb_format( screen, target, tex_usage, geom_flags ); case GL_RGBA16: return default_rgba_format( screen, target, tex_usage, geom_flags ); @@ -495,6 +493,26 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, } return PIPE_FORMAT_NONE; + case GL_COMPRESSED_RGB: + /* can only sample from compressed formats */ + if (tex_usage & ~PIPE_BIND_SAMPLER_VIEW) + return PIPE_FORMAT_NONE; + else if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB, + target, tex_usage, geom_flags)) + return PIPE_FORMAT_DXT1_RGB; + else + return default_rgb_format(screen, target, tex_usage, geom_flags); + + case GL_COMPRESSED_RGBA: + /* can only sample from compressed formats */ + if (tex_usage & ~PIPE_BIND_SAMPLER_VIEW) + return PIPE_FORMAT_NONE; + else if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA, + target, tex_usage, geom_flags)) + return PIPE_FORMAT_DXT3_RGBA; + else + return default_rgba_format(screen, target, tex_usage, geom_flags); + case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: