diff options
author | Marek Olšák <[email protected]> | 2011-03-07 02:24:43 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-03-08 23:52:37 +0100 |
commit | 384845f335d1fbe6766673b988b23a003e104e7b (patch) | |
tree | 1a228763d5525a874a8adf49f9110f43860e3286 /src | |
parent | 23f92c20d721aa373d91a949586fd93a92d9f275 (diff) |
st/mesa: add LATC and 3DC support
softpipe passes all tests.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 21 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.c | 54 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_gen_mipmap.c | 4 |
3 files changed, 76 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 6bbf68accdd..d96985a3747 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -432,6 +432,27 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE; } + if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_UNORM, + PIPE_TEXTURE_2D, 0, + PIPE_BIND_SAMPLER_VIEW, 0) && + screen->is_format_supported(screen, PIPE_FORMAT_LATC1_SNORM, + PIPE_TEXTURE_2D, 0, + PIPE_BIND_SAMPLER_VIEW, 0) && + screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM, + PIPE_TEXTURE_2D, 0, + PIPE_BIND_SAMPLER_VIEW, 0) && + screen->is_format_supported(screen, PIPE_FORMAT_LATC2_SNORM, + PIPE_TEXTURE_2D, 0, + PIPE_BIND_SAMPLER_VIEW, 0)) { + ctx->Extensions.EXT_texture_compression_latc = GL_TRUE; + } + + if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM, + PIPE_TEXTURE_2D, 0, + PIPE_BIND_SAMPLER_VIEW, 0)) { + ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE; + } + /* ycbcr support */ if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY, PIPE_TEXTURE_2D, 0, diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 22a1450cfe7..6b89bae7d16 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -249,6 +249,16 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) return PIPE_FORMAT_RGTC2_UNORM; case MESA_FORMAT_SIGNED_RG_RGTC2: return PIPE_FORMAT_RGTC2_SNORM; + + case MESA_FORMAT_L_LATC1: + return PIPE_FORMAT_LATC1_UNORM; + case MESA_FORMAT_SIGNED_L_LATC1: + return PIPE_FORMAT_LATC1_SNORM; + case MESA_FORMAT_LA_LATC2: + return PIPE_FORMAT_LATC2_UNORM; + case MESA_FORMAT_SIGNED_LA_LATC2: + return PIPE_FORMAT_LATC2_SNORM; + default: assert(0); return PIPE_FORMAT_NONE; @@ -397,6 +407,15 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_RGTC2_SNORM: return MESA_FORMAT_SIGNED_RG_RGTC2; + case PIPE_FORMAT_LATC1_UNORM: + return MESA_FORMAT_L_LATC1; + case PIPE_FORMAT_LATC1_SNORM: + return MESA_FORMAT_SIGNED_L_LATC1; + case PIPE_FORMAT_LATC2_UNORM: + return MESA_FORMAT_LA_LATC2; + case PIPE_FORMAT_LATC2_SNORM: + return MESA_FORMAT_SIGNED_LA_LATC2; + default: assert(0); return MESA_FORMAT_NONE; @@ -612,7 +631,6 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: - case GL_COMPRESSED_LUMINANCE: if (screen->is_format_supported( screen, PIPE_FORMAT_L8_UNORM, target, sample_count, bindings, geom_flags )) return PIPE_FORMAT_L8_UNORM; @@ -630,7 +648,6 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE_ALPHA: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: - case GL_COMPRESSED_LUMINANCE_ALPHA: if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target, sample_count, bindings, geom_flags )) return PIPE_FORMAT_L8A8_UNORM; @@ -901,6 +918,39 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, return PIPE_FORMAT_RGTC2_SNORM; return PIPE_FORMAT_NONE; + case GL_COMPRESSED_LUMINANCE: + case GL_COMPRESSED_LUMINANCE_LATC1_EXT: + if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_LATC1_UNORM; + if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_L8_UNORM; + return PIPE_FORMAT_NONE; + + case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: + if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_SNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_LATC1_SNORM; + return PIPE_FORMAT_NONE; + + case GL_COMPRESSED_LUMINANCE_ALPHA: + case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: + case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: + if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_LATC2_UNORM; + if (screen->is_format_supported(screen, PIPE_FORMAT_L8A8_UNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_L8A8_UNORM; + return PIPE_FORMAT_NONE; + + case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: + if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_SNORM, target, + sample_count, bindings, geom_flags)) + return PIPE_FORMAT_LATC2_SNORM; + return PIPE_FORMAT_NONE; + /* signed/unsigned integer formats. * XXX Mesa only has formats for RGBA signed/unsigned integer formats. * If/when new formats are added this code should be updated. diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index a12a32e1148..f8b23d11d03 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -205,7 +205,9 @@ fallback_generate_mipmap(struct gl_context *ctx, GLenum target, if (compressed) { if (texObj->Image[face][baseLevel]->TexFormat == MESA_FORMAT_SIGNED_RED_RGTC1 || - texObj->Image[face][baseLevel]->TexFormat == MESA_FORMAT_SIGNED_RG_RGTC2) + texObj->Image[face][baseLevel]->TexFormat == MESA_FORMAT_SIGNED_RG_RGTC2 || + texObj->Image[face][baseLevel]->TexFormat == MESA_FORMAT_SIGNED_L_LATC1 || + texObj->Image[face][baseLevel]->TexFormat == MESA_FORMAT_SIGNED_LA_LATC2) datatype = GL_FLOAT; else datatype = GL_UNSIGNED_BYTE; |