[Mesa-dev] [PATCH 1/2] main: add _mesa_is_gles1() and _mesa_is_gles2() inline functions.

Oliver McFadden oliver.mcfadden at linux.intel.com
Wed Sep 5 02:29:34 PDT 2012


On Tue, Sep 04, 2012 at 10:37:58AM -0700, Matt Turner wrote:
> On Tue, Sep 4, 2012 at 4:53 AM, Oliver McFadden
> <oliver.mcfadden at linux.intel.com> wrote:
> > From: Oliver McFadden <oliver.mcfadden at intel.com>
> >
> > Signed-off-by: Oliver McFadden <oliver.mcfadden at intel.com>
> > ---
> >  src/mesa/main/context.h |   20 ++++++++++++++++++++
> >  1 files changed, 20 insertions(+), 0 deletions(-)
> >
> > diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
> > index e238752..b37ddc7 100644
> > --- a/src/mesa/main/context.h
> > +++ b/src/mesa/main/context.h
> > @@ -311,6 +311,26 @@ _mesa_is_gles(const struct gl_context *ctx)
> >
> >
> >  /**
> > + * Checks if the context is for GLES 1.x
> > + */
> > +static inline GLboolean
> > +_mesa_is_gles1(const struct gl_context *ctx)
> > +{
> > +   return ctx->API == API_OPENGLES && (ctx->Version / 10 == 1);
> > +}
> > +
> > +
> > +/**
> > + * Checks if the context is for GLES 2.x
> > + */
> > +static inline GLboolean
> > +_mesa_is_gles2(const struct gl_context *ctx)
> > +{
> > +   return ctx->API == API_OPENGLES2 && (ctx->Version / 10 == 2);
> > +}
> > +
> > +
> > +/**
> >   * Checks if the context is for GLES 3.x
> >   */
> >  static inline GLboolean
> > --
> > 1.7.8.6
> 
> Why are the ctx->Version checks needed? Isn't checking ctx->API ==
> API_OPENGLES{,2} sufficient? From looking at patch 2, the extension
> won't be exposed under a GLES3 context. Is that what you want?

Yes, the ANGLE specification says:

Dependencies
Requires OpenGL ES 2.0.
The extension is written against the OpenGL ES 2.0 specification.

I am unsure whether that means "equal to" or "greater than equal to"

-- 
Oliver McFadden.


More information about the mesa-dev mailing list