<div dir="ltr"><div>Looks good. Feel free to push this.</div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Dec 3, 2018 at 5:05 AM Erik Faye-Lund <<a href="mailto:erik.faye-lund@collabora.com">erik.faye-lund@collabora.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, 2018-11-30 at 18:15 -0500, Marek Olšák wrote:<br>
> On Fri, Nov 30, 2018 at 5:57 PM Ian Romanick <<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>><br>
> wrote:<br>
> > On 11/30/2018 02:17 PM, Marek Olšák wrote:<br>
> > > <br>
> > > <br>
> > > On Fri, Nov 23, 2018 at 5:54 AM Erik Faye-Lund<br>
> > > <<a href="mailto:erik.faye-lund@collabora.com" target="_blank">erik.faye-lund@collabora.com</a> <mailto:<br>
> > <a href="mailto:erik.faye-lund@collabora.com" target="_blank">erik.faye-lund@collabora.com</a>>> wrote:<br>
> > > <br>
> > > S3_s3tc is the extension that enables this functionality on<br>
> > desktop, so<br>
> > > let's check for that one. The _mesa_has_S3_s3tc() helper<br>
> > already<br>
> > > verifies the API according to the extension-table.<br>
> > > <br>
> > > Signed-off-by: Erik Faye-Lund <<a href="mailto:erik.faye-lund@collabora.com" target="_blank">erik.faye-lund@collabora.com</a><br>
> > > <mailto:<a href="mailto:erik.faye-lund@collabora.com" target="_blank">erik.faye-lund@collabora.com</a>>><br>
> > > ---<br>
> > > src/mesa/main/glformats.c | 8 +++-----<br>
> > > 1 file changed, 3 insertions(+), 5 deletions(-)<br>
> > > <br>
> > > diff --git a/src/mesa/main/glformats.c<br>
> > b/src/mesa/main/glformats.c<br>
> > > index 9a507d11b96..b2c18aa6d94 100644<br>
> > > --- a/src/mesa/main/glformats.c<br>
> > > +++ b/src/mesa/main/glformats.c<br>
> > > @@ -1352,8 +1352,7 @@ _mesa_is_compressed_format(const struct<br>
> > > gl_context *ctx, GLenum format)<br>
> > > case GL_RGB4_S3TC:<br>
> > > case GL_RGBA_S3TC:<br>
> > > case GL_RGBA4_S3TC:<br>
> > > - return _mesa_is_desktop_gl(ctx) &&<br>
> > > - ctx->Extensions.ANGLE_texture_compression_dxt;<br>
> > > + return _mesa_has_S3_s3tc(ctx);<br>
> > > case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:<br>
> > > return ctx->API == API_OPENGL_COMPAT<br>
> > > && ctx->Extensions.ATI_texture_compression_3dc;<br>
> > > @@ -1378,9 +1377,8 @@ _mesa_is_compressed_format(const struct<br>
> > > gl_context *ctx, GLenum format)<br>
> > > */<br>
> > > return ctx-<br>
> > >Extensions.ANGLE_texture_compression_dxt;<br>
> > > } else {<br>
> > > - return _mesa_is_desktop_gl(ctx)<br>
> > > - && ctx->Extensions.EXT_texture_sRGB<br>
> > > - && ctx->Extensions.EXT_texture_compression_s3tc;<br>
> > > + return _mesa_has_EXT_texture_sRGB(ctx) &&<br>
> > > + _mesa_has_S3_s3tc(ctx);<br>
> > > <br>
> > > This looks like it should be<br>
> > _mesa_has_EXT_texture_compression_s3tc.<br>
> > <br>
> > I haven't looked at the code to verify, but I think<br>
> > _mesa_has_EXT_texture_compression_s3tc can be true in OpenGL ES,<br>
> > but<br>
> > _mesa_has_S3_s3tc cannot. The original code has<br>
> > _mesa_is_desktop_gl, so<br>
> > we don't want to allow ES. But I also thought _mesa_has_S3_s3tc<br>
> > wasn't<br>
> > allowed in core profile, so that might not be right either?<br>
> <br>
> They are all allowed by core & compat. EXT_texture_sRGB is only<br>
> available in desktop GL, so any s3tc extension should work, but<br>
> EXT_texture_sRGB defines interactions with<br>
> EXT_texture_compression_s3tc, not S3_s3tc.<br>
> <br>
<br>
Hmm, good catch! I've fixed this up locally, and amended the commit<br>
message to point this out:<br>
<br>
---8<---<br>
commit f86fc25d5ad8afb434f14d07ccf78598e40ec700<br>
Author: Erik Faye-Lund <<a href="mailto:erik.faye-lund@collabora.com" target="_blank">erik.faye-lund@collabora.com</a>><br>
Date: Thu Nov 15 16:01:49 2018 +0100<br>
<br>
mesa/main: clean up S3_s3tc check<br>
<br>
S3_s3tc is the extension that enables this functionality on<br>
desktop, so<br>
let's check for that one. The _mesa_has_S3_s3tc() helper already<br>
verifies the API according to the extension-table.<br>
<br>
As for the second hunk, we currently already only expose<br>
EXT_texture_compression_s3tc on desktop so by using the helper<br>
instead,<br>
we get rid of this detail here, and once we enable it for GLES<br>
we'll<br>
automaticall get the interaction right.<br>
<br>
Signed-off-by: Erik Faye-Lund <<a href="mailto:erik.faye-lund@collabora.com" target="_blank">erik.faye-lund@collabora.com</a>><br>
<br>
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c<br>
index 9a507d11b96..a4db1ed16d4 100644<br>
--- a/src/mesa/main/glformats.c<br>
+++ b/src/mesa/main/glformats.c<br>
@@ -1352,8 +1352,7 @@ _mesa_is_compressed_format(const struct<br>
gl_context *ctx, GLenum format)<br>
case GL_RGB4_S3TC:<br>
case GL_RGBA_S3TC:<br>
case GL_RGBA4_S3TC:<br>
- return _mesa_is_desktop_gl(ctx) &&<br>
- ctx->Extensions.ANGLE_texture_compression_dxt;<br>
+ return _mesa_has_S3_s3tc(ctx);<br>
case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:<br>
return ctx->API == API_OPENGL_COMPAT<br>
&& ctx->Extensions.ATI_texture_compression_3dc;<br>
@@ -1378,9 +1377,8 @@ _mesa_is_compressed_format(const struct<br>
gl_context *ctx, GLenum format)<br>
*/<br>
return ctx->Extensions.ANGLE_texture_compression_dxt;<br>
} else {<br>
- return _mesa_is_desktop_gl(ctx)<br>
- && ctx->Extensions.EXT_texture_sRGB<br>
- && ctx->Extensions.EXT_texture_compression_s3tc;<br>
+ return _mesa_has_EXT_texture_sRGB(ctx) &&<br>
+ _mesa_has_EXT_texture_compression_s3tc(ctx);<br>
}<br>
case MESA_FORMAT_LAYOUT_FXT1:<br>
return _mesa_is_desktop_gl(ctx)<br>
---8<---<br>
<br>
</blockquote></div>