[Mesa-dev] [PATCH] mesa/formatquery: remove online compression check on is_resource_supported

Alejandro PiƱeiro apinheiro at igalia.com
Sun May 6 09:40:28 UTC 2018

is_resource_supported returns if the combination of
target/internalformat is supported in at least one operation. Online
compression is only mandatory for glTexImage2D. Some formats doesn't
support online compression, but can be used in any case, with
glCompressed*D methods.

Without this commit, ETC2 internalformats were returning FALSE, even
for the drivers supporting it. So any other query (like
TEXTURE_COMPRESSED) was returning FALSE/NONE instead of the proper

This was not detected until now because most of the formats that
doesn't support online compression were added with
GL_ARB_ES3_compatibility, that was not core until 4.3. The base for
GL_ARB_internalformat_query2 is 4.2, and the piglit tests were based
on it.

When we tried to test those formats on piglit (I'm sending a series
soon) we found that they were found as not supported, even if they can
be used with CompressedTexture*D.

Note to Eleni: all this was mentioned on a review of some of your
patches, specifically in relation to TEXTURE_COMPRESSED. The issue is
that without this patch, all the queries with those internalformats
were affected, not only TEXTURE_COMPRESSED. If the specific value for
TEXTURE_COMPRESSED needs to be different (example: the current one),
would be as part of a different patch for that specific query.

 src/mesa/main/formatquery.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 3b000fac5c4..84b5f512ba5 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -501,8 +501,7 @@ _is_resource_supported(struct gl_context *ctx, GLenum target,
       /* additional checks for compressed textures */
       if (_mesa_is_compressed_format(ctx, internalformat) &&
-          (!_mesa_target_can_be_compressed(ctx, target, internalformat, NULL) ||
-           _mesa_format_no_online_compression(internalformat)))
+          !_mesa_target_can_be_compressed(ctx, target, internalformat, NULL))
          return false;

More information about the mesa-dev mailing list