[Mesa-dev] [PATCH] mesa/teximage: Fix ASTC-caused S3TC regression

Nanley Chery nanleychery at gmail.com
Wed Oct 28 09:52:48 PDT 2015


From: Nanley Chery <nanley.g.chery at intel.com>

The ASTC spec forbids other compressed formats from being used against
the targets: TEXTURE_CUBE_MAP_ARRAY and TEXTURE_3D. Because other
compressed formats were previously supported for these targets in
desktop GL, it's considered to be a spec bug and Mesa will diverge from
this behavior for desktop GL.

Fixes the following Piglit tests on Gen9:
piglit.spec.arb_direct_state_access.getcompressedtextureimage
piglit.spec.arb_get_texture_sub_image.arb_get_texture_sub_image-getcompressed
piglit.spec.arb_texture_cube_map_array.fbo-generatemipmap-cubemap array s3tc_dxt1
piglit.spec.ext_texture_compression_s3tc.getteximage-targets cube_array s3tc

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91927
Suggested-by: Neil Roberts <neil at linux.intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/mesa/main/teximage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d9453e3..eccf009 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1373,7 +1373,8 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
       /* Throw an INVALID_OPERATION error if the target is
        * TEXTURE_CUBE_MAP_ARRAY and the format is not ASTC.
        */
-      if (target_can_be_compresed &&
+      /* FIXME: Correct the spec to restrict this behavior to GLES as well. */
+      if (target_can_be_compresed && _mesa_is_gles(ctx) &&
           ctx->Extensions.KHR_texture_compression_astc_ldr &&
           layout != MESA_FORMAT_LAYOUT_ASTC)
          return write_error(error, GL_INVALID_OPERATION);
@@ -1405,7 +1406,9 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
           * the format is not ASTC.
           * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info.
           */
-         if (ctx->Extensions.KHR_texture_compression_astc_ldr)
+         /* FIXME: Correct the spec to restrict this behavior to GLES as well. */
+         if (_mesa_is_gles(ctx) &&
+             ctx->Extensions.KHR_texture_compression_astc_ldr)
             return write_error(error, GL_INVALID_OPERATION);
          break;
       }
-- 
2.6.2



More information about the mesa-dev mailing list