From a965ef59b501f0df1417ea0e076a8a0d27dd9d23 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Apr 2010 09:18:57 -0600 Subject: st/mesa: call is_format_supported() for compressed formats These compressed format switch cases shouldn't be hit if we don't support the compressed texture extensions, but let's be safe and ask the driver if they're supported as we do in other cases. --- src/mesa/state_tracker/st_format.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 1e51300bb69..0c3e16631a0 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -524,18 +524,34 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return PIPE_FORMAT_DXT1_RGB; + if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB, + target, tex_usage, geom_flags)) + return PIPE_FORMAT_DXT1_RGB; + else + return PIPE_FORMAT_NONE; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return PIPE_FORMAT_DXT1_RGBA; + if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGBA, + target, tex_usage, geom_flags)) + return PIPE_FORMAT_DXT1_RGBA; + else + return PIPE_FORMAT_NONE; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return PIPE_FORMAT_DXT3_RGBA; + if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA, + target, tex_usage, geom_flags)) + return PIPE_FORMAT_DXT3_RGBA; + else + return PIPE_FORMAT_NONE; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return PIPE_FORMAT_DXT5_RGBA; + if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA, + target, tex_usage, geom_flags)) + return PIPE_FORMAT_DXT5_RGBA; + else + return PIPE_FORMAT_NONE; #if 0 case GL_COMPRESSED_RGB_FXT1_3DFX: -- cgit v1.2.3