On Thu, Oct 22, 2015 at 11:08 AM, Chad Versace <chad.vers...@intel.com> wrote:
> On Thu 22 Oct 2015, Emil Velikov wrote: > > On 19 October 2015 at 23:36, Nanley Chery <nanleych...@gmail.com> wrote: > > > From: Nanley Chery <nanley.g.ch...@intel.com> > > > > > > Create a function which determines if an extension is supported in the > > > current context. > > > > > > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com> > > > --- > > > src/mesa/main/extensions.c | 17 +++++++++++++++++ > > > 1 file changed, 17 insertions(+) > > > > > > diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c > > > index 390e026..7137bc9 100644 > > > --- a/src/mesa/main/extensions.c > > > +++ b/src/mesa/main/extensions.c > > > @@ -423,6 +423,23 @@ typedef unsigned short extension_index; > > > > > > > > > /** > > > + * Given an extension enum, return whether or not the extension is > supported > > > + * dependent on the following factors: > > > + * There's driver support and the OpenGL/ES version is at least that > > > + * specified in the extension_table. > > > + */ > > > +static inline bool > > > +_mesa_extension_supported(const struct gl_context *ctx, > extension_index ei) > > > +{ > > > + const bool *base = (bool *) &ctx->Extensions; > > > + const struct extension *i = extension_table + ei; > > > + const uint8_t api_set = 1 << ctx->API; > > > + return (i->api_set & api_set) && > > > + (ctx->Version >= i->version[ctx->API]) && > > > + base[i->offset]; > > Bikeshed: I realise that you're copying most of these, but wouldn't it > > be better if we use more common/intuitive variable names ? > > > > ei -> i or idx > > i -> ext > > I second Emil's suggestion. > > Please insert an empty line between the block of variable declarations > and the return statement. > > Also, it improves the readability if you rename the local variable > 'api_set' to 'api_bit', because it's not really a set. It's just one > bit. > I'll incorporate both changes.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev