<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 13, 2016 at 9:16 AM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Jun 13, 2016 at 12:11 PM, Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com">emil.l.velikov@gmail.com</a>> wrote:<br>
> Hi Ilia,<br>
><br>
> On 13 June 2016 at 00:23, Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br>
><br>
>> @@ -81,6 +81,7 @@ MAIN_FILES = \<br>
>> main/execmem.c \<br>
>> main/extensions.c \<br>
>> main/extensions.h \<br>
>> + main/extensions_table.c \<br>
> From a build perspective everything looks amazing. Thank you !<br>
<br>
</span>Thanks for checking.<br>
<div><div class="h5"><br>
><br>
><br>
>> --- a/src/mesa/main/extensions.c<br>
>> +++ b/src/mesa/main/extensions.c<br>
>> @@ -49,25 +49,15 @@ static char *extra_extensions = NULL;<br>
>> #define o(x) offsetof(struct gl_extensions, x)<br>
>><br>
>><br>
>> -/**<br>
>> - * \brief Table of supported OpenGL extensions for all API's.<br>
>> - */<br>
>> -const struct mesa_extension _mesa_extension_table[] = {<br>
>> +static bool extension_table_size[] = {<br>
>> #define EXT(name_str, driver_cap, gll_ver, glc_ver, gles_ver, gles2_ver, yyyy) \<br>
>> - { .name = "GL_" #name_str, .offset = o(driver_cap), \<br>
>> - .version = { \<br>
>> - [API_OPENGL_COMPAT] = gll_ver, \<br>
>> - [API_OPENGL_CORE] = glc_ver, \<br>
>> - [API_OPENGLES] = gles_ver, \<br>
>> - [API_OPENGLES2] = gles2_ver, \<br>
>> - }, \<br>
>> - .year = yyyy \<br>
>> - },<br>
>> + 0,<br>
>> +<br>
>> #include "extensions_table.h"<br>
>> #undef EXT<br>
>> };<br>
>><br>
> An alternative idea to the one proposed by Eric:<br>
> Explicitly set the array size (ideally as a macro in the relevant<br>
> header) and use that instead of having a dummy array, only to know the<br>
> array size.<br>
<br>
</div></div>I couldn't come up with a non-horrible way of doing that. Are you<br>
basically suggesting I add a<br>
<br>
#define EXTENSIONS_COUNT 10000<br>
<br>
in extensions_table.h, and expect someone to increment it every time<br>
an extension was being added?<br>
<br>
I guess it could be enforced via a STATIC_ASSERT in the new<br>
extensions_table.c, but it feels really dirty. I guess a cleverer<br>
thing would be to count by doing something horrible for the compiler,<br>
e.g.<br>
<br>
static const int foo = 0 +1+1+1+1+1+1......<br>
<br>
Probably nicer than my array of 0's though. Open to other ideas.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>You can add an entry to the end of the enum defined in extensions.h called</div><div>"MESA_EXTENSION_COUNT" or similar.</div><div><br></div><div>- Nanley</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
-ilia<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>