Mesa (9.2): mesa: Don't choose S3TC for generic compression if we can' t compress.
Ian Romanick
idr at kemper.freedesktop.org
Wed Sep 11 19:09:07 UTC 2013
Module: Mesa
Branch: 9.2
Commit: fbbe25ef26b4d9cc39fe0b898b7d2824b7159ec8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fbbe25ef26b4d9cc39fe0b898b7d2824b7159ec8
Author: Eric Anholt <eric at anholt.net>
Date: Thu Aug 29 08:09:05 2013 -0700
mesa: Don't choose S3TC for generic compression if we can't compress.
If the app is asking us to do GL_COMPRESSED_RGBA, then the app obviously
doesn't have pre-compressed data to hand us. So don't choose a storage
format that we won't actually be able to compress and store.
Fixes black screen in warzone2100 when libtxc_dxtn is not present. Also
66 piglit tests.
NOTE: This is a candidate for the 9.2 branch.
Reported-by: Paul Wise <pabs at debian.org>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit bdf3f50e9a85e4c063b46ceaf23bceb07b06b82e)
---
src/mesa/main/texformat.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index fdbf695..d3aa477 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -239,7 +239,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
* 1D ARRAY textures in S3TC format.
*/
if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+ if (ctx->Mesa_DXTn)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
}
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
@@ -249,7 +250,8 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
case GL_COMPRESSED_RGBA_ARB:
/* We don't use texture compression for 1D and 1D array textures. */
if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
+ if (ctx->Mesa_DXTn)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
}
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
@@ -547,12 +549,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
case GL_COMPRESSED_SRGB_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
+ if (ctx->Mesa_DXTn)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
case GL_COMPRESSED_SRGB_ALPHA_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
+ if (ctx->Mesa_DXTn)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
More information about the mesa-commit
mailing list