summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-04-27 09:18:57 -0600
committerBrian Paul <[email protected]>2010-04-27 09:19:02 -0600
commita965ef59b501f0df1417ea0e076a8a0d27dd9d23 (patch)
tree2290612b3e90552d2cc8e3a1fb654f9a63753222
parent85d3687ee78d25c0305caee5e672f9ee799a6ae6 (diff)
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.
-rw-r--r--src/mesa/state_tracker/st_format.c24
1 files changed, 20 insertions, 4 deletions
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: