diff options
author | Brian Paul <[email protected]> | 2010-04-27 09:11:36 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-04-27 09:11:53 -0600 |
commit | 29edc2a8b5be7df46f29493bb8ae2fb2c8be8ef3 (patch) | |
tree | 6d828a8f9fa3812720235921e10b859638547604 /src/mesa | |
parent | 7567f05199f1ca114cc57e3a11ac101d3707f819 (diff) |
st/mesa: try to get actual compressed format for GL_COMPRESSED_RGB[A] formats
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_format.c | 22 |
1 files changed, 20 insertions, 2 deletions
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: |