On Wed, 2012-10-10 at 12:25 +0100, jfons...@vmware.com wrote: > From: José Fonseca <jfons...@vmware.com> > > Not supported by MSVC. > > Just compiled tested. > ---
My mistake, I wasn't aware of such limitations and I haven't checked whether things work with MSVC. In any case it looks ok: Reviewed-by: Imre Deak <imre.d...@intel.com> > src/mesa/main/get_hash_generator.py | 31 ++++++++++++++++++++++++++----- > src/mesa/main/mtypes.h | 3 +++ > 2 files changed, 29 insertions(+), 5 deletions(-) > > diff --git a/src/mesa/main/get_hash_generator.py > b/src/mesa/main/get_hash_generator.py > index 770093c..4b3f5f4 100644 > --- a/src/mesa/main/get_hash_generator.py > +++ b/src/mesa/main/get_hash_generator.py > @@ -61,16 +61,32 @@ def print_params(params): > def api_name(api): > return "API_OPEN%s" % api > > +# This must match gl_api enum in src/mesa/main/mtypes.h > +api_enum = [ > + 'GL', > + 'GLES', > + 'GLES2', > + 'GL_CORE', > +] > + > +def api_index(api): > + return api_enum.index(api) > + > def table_name(api): > return "table_" + api_name(api) > > def print_table(api, table): > print "static table_t %s = {" % (table_name(api)) > > + # convert sparse (index, value) table into a dense table > + dense_table = [0] * hash_table_size > + for i, v in table: > + dense_table[i] = v > + > row_size = 4 > - for i in range(0, len(table), row_size): > - row = table[i : i + row_size] > - idx_val = ["[%4d] = %4d" % iv for iv in row] > + for i in range(0, hash_table_size, row_size): > + row = dense_table[i : i + row_size] > + idx_val = ["%4d" % v for v in row] > print " " * 4 + ", ".join(idx_val) + "," > > print "};\n" > @@ -79,11 +95,16 @@ def print_tables(tables): > for table in tables: > print_table(table["apis"][0], table["indices"]) > > - print "static table_t *table_set[] = {" > + dense_tables = ['NULL'] * len(api_enum) > for table in tables: > tname = table_name(table["apis"][0]) > for api in table["apis"]: > - print " [%s] = &%s," % (api_name(api), tname) > + i = api_index(api) > + dense_tables[i] = "&%s" % (tname) > + > + print "static table_t *table_set[] = {" > + for expr in dense_tables: > + print " %s," % expr > print "};\n" > > print "#define table(api) (*table_set[api])" > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > index 40a802f..b154b95 100644 > --- a/src/mesa/main/mtypes.h > +++ b/src/mesa/main/mtypes.h > @@ -3334,6 +3334,9 @@ struct gl_debug_state > > /** > * Enum for the OpenGL APIs we know about and may support. > + * > + * NOTE: This must match the api_enum table in > + * src/mesa/main/get_hash_generator.py > */ > typedef enum > { _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev