<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 22, 2015 at 11:30 AM, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@intel.com" target="_blank">chad.versace@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Mon 19 Oct 2015, Nanley Chery wrote:<br>
> From: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com" target="_blank">nanley.g.chery@intel.com</a>><br>
><br>
> Generate functions which determine if an extension is supported in the<br>
> current context. Initially, enums were going to be explicitly used with<br>
> _mesa_extension_supported(). The idea to embed the function and enums<br>
> into generated helper functions was suggested by Kristian Høgsberg.<br>
><br>
> For performance, the function body no longer uses<br>
> _mesa_extension_supported() and, as suggested by Chad Versace, the<br>
> functions are also declared static inline.<br>
><br>
> Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com" target="_blank">nanley.g.chery@intel.com</a>><br>
> ---<br>
>  src/mesa/main/context.h    |  1 +<br>
>  src/mesa/main/extensions.c | 22 +---------------------<br>
>  src/mesa/main/extensions.h | 39 +++++++++++++++++++++++++++++++++++++++<br>
>  3 files changed, 41 insertions(+), 21 deletions(-)<br>
<br>
</span>[...]<br>
<span><br>
> diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h<br>
> index 595512a..24cc04d 100644<br>
> --- a/src/mesa/main/extensions.h<br>
> +++ b/src/mesa/main/extensions.h<br>
> @@ -55,6 +55,45 @@ _mesa_get_extension_count(struct gl_context *ctx);<br>
>  extern const GLubyte *<br>
>  _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);<br>
><br>
> +<br>
> +/**<br>
> + * \brief An element of the \c extension_table.<br>
> + */<br>
> +struct extension {<br>
<br>
</span>In addition to Marek's comment, the struct should be prefixed too.<br>
<span><br></span></blockquote><div><br></div><div>After rereading the coding style guidelines, I've found that it only says that<br>functions need to be prefixed. Should these two suggestions be added?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
> +   /** Name of extension, such as "GL_ARB_depth_clamp". */<br>
> +   const char *name;<br>
> +<br>
> +   /** Offset (in bytes) of the corresponding member in struct gl_extensions. */<br>
> +   size_t offset;<br>
> +<br>
> +   /** Minimum version the extension requires for the given API<br>
> +    * (see gl_api defined in mtypes.h)<br>
> +    */<br>
> +   GLuint version[API_OPENGL_LAST + 1];<br>
> +<br>
> +   /** Year the extension was proposed or approved.  Used to sort the<br>
> +    * extension string chronologically. */<br>
> +   uint16_t year;<br>
> +} extern const extension_table[];<br>
<br>
</span>[...]<br>
<span><br>
> +/** Checks if the context suports a user-facing extension */<br>
> +#define EXT(name_str, driver_cap, ...) \<br>
> +static inline bool _mesa_has_##name_str(const struct gl_context *ctx) { \<br>
> +      return ctx->Extensions.driver_cap && (ctx->Version >= \<br>
> +             extension_table[MESA_EXTENSION_##name_str].version[ctx->API]); \<br>
> +}<br>
> +#include "extensions_table.h"<br>
> +#undef EXT<br>
<br>
</span>The function should be formatted like this, to follow Mesa style:<br>
<br>
  |static inline bool<br>
  |_mesa_has_foo(...)<br>
  |{<br>
  |   ...<br>
  |}<br></blockquote><div><br></div><div>Will do.<br></div></div><br></div></div>