[Mesa-dev] [RFC 09/21] mesa: Generate a helper function for each extension
Chad Versace
chad.versace at intel.com
Mon Oct 26 13:29:01 PDT 2015
On Fri 23 Oct 2015, Nanley Chery wrote:
> On Thu, Oct 22, 2015 at 11:30 AM, Chad Versace <chad.versace at intel.com>
> wrote:
>
> > On Mon 19 Oct 2015, Nanley Chery wrote:
> > > From: Nanley Chery <nanley.g.chery at intel.com>
> > >
> > > Generate functions which determine if an extension is supported in the
> > > current context. Initially, enums were going to be explicitly used with
> > > _mesa_extension_supported(). The idea to embed the function and enums
> > > into generated helper functions was suggested by Kristian Høgsberg.
> > >
> > > For performance, the function body no longer uses
> > > _mesa_extension_supported() and, as suggested by Chad Versace, the
> > > functions are also declared static inline.
> > >
> > > Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> > > ---
> > > src/mesa/main/context.h | 1 +
> > > src/mesa/main/extensions.c | 22 +---------------------
> > > src/mesa/main/extensions.h | 39 +++++++++++++++++++++++++++++++++++++++
> > > 3 files changed, 41 insertions(+), 21 deletions(-)
> >
> > [...]
> > > @@ -55,6 +55,45 @@ _mesa_get_extension_count(struct gl_context *ctx);
> > > extern const GLubyte *
> > > _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);
> > >
> > > +
> > > +/**
> > > + * \brief An element of the \c extension_table.
> > > + */
> > > +struct extension {
> >
> > In addition to Marek's comment, the struct should be prefixed too.
> >
> >
> After rereading the coding style guidelines, I've found that it only says
> that
> functions need to be prefixed. Should these two suggestions be added?
Personally, I would avoid placing such a rule in the style guide,
because there is no hard, absolute rule that dictates when a symbol
should be prefixed. For example, many of the global symbols in
src/util/*.h are not prefixed.
If you examine the symbols in src/mesa/main/mtypes.h, though, nearly
everything is prefixed. And I view src/mesa/main/extensions.h as a file
that belongs in the same family as mtypes.h.
More information about the mesa-dev
mailing list