[Mesa-dev] [PATCH v2 03/29] mesa/main: clean up S3_s3tc check

Erik Faye-Lund erik.faye-lund at collabora.com
Mon Dec 3 17:17:24 UTC 2018


On Mon, 2018-12-03 at 12:15 -0500, Marek Olšák wrote:
> Looks good. Feel free to push this.

Thanks, pushed :)

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



More information about the mesa-dev mailing list