X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fget_hash_generator.py;h=c777b7824429e6024a5317031b64a2cfbd113eec;hb=a2dc11a7818c04d8dc0324e8fcba98d60baea529;hp=04bf9ffe6cfecd71acdfcaab0b0cd77333e233c1;hpb=0cc018526f610deb4990587a6d1ac73d5d71bc90;p=mesa.git diff --git a/src/mesa/main/get_hash_generator.py b/src/mesa/main/get_hash_generator.py index 04bf9ffe6cf..c777b782442 100644 --- a/src/mesa/main/get_hash_generator.py +++ b/src/mesa/main/get_hash_generator.py @@ -44,7 +44,7 @@ prime_factor = 89 prime_step = 281 hash_table_size = 1024 -gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3"]) +gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3", "GLES31"]) def print_header(): print "typedef const unsigned short table_t[%d];\n" % (hash_table_size) @@ -52,7 +52,7 @@ def print_header(): (prime_factor, prime_step) def print_params(params): - print "static struct value_desc values[] = {" + print "static const struct value_desc values[] = {" for p in params: print " { %s, %s }," % (p[0], p[1]) @@ -68,6 +68,7 @@ api_enum = [ 'GLES2', 'GL_CORE', 'GLES3', # Not in gl_api enum in mtypes.h + 'GLES31', # Not in gl_api enum in mtypes.h ] def api_index(api): @@ -167,10 +168,13 @@ def generate_hash_tables(enum_list, enabled_apis, param_descriptors): for api in valid_apis: add_to_hash_table(tables[api], hash_val, len(params)) - # Also add GLES2 items to the GLES3 hash table + # Also add GLES2 items to the GLES3 and GLES31 hash table if api == "GLES2": add_to_hash_table(tables["GLES3"], hash_val, len(params)) - + add_to_hash_table(tables["GLES31"], hash_val, len(params)) + # Also add GLES3 items to the GLES31 hash table + if api == "GLES3": + add_to_hash_table(tables["GLES31"], hash_val, len(params)) params.append(["GL_" + enum_name, param[1]]) sorted_tables={} @@ -179,54 +183,34 @@ def generate_hash_tables(enum_list, enabled_apis, param_descriptors): return params, merge_tables(sorted_tables) -def opt_to_apis(feature): - _map = {"ES1": "GLES", "ES2": "GLES2", "GL": "GL"} - if feature not in _map: - return None - - apis = set([_map[feature]]) - if "GL" in apis: - apis.add("GL_CORE") - if "GLES2" in apis: - apis.add("GLES3") - - return apis def show_usage(): sys.stderr.write( """Usage: %s [OPTIONS] -f specify GL API XML file - -a [GL|ES1|ES2] specify APIs to generate hash tables for """ % (program)) exit(1) if __name__ == '__main__': try: - (opts, args) = getopt.getopt(sys.argv[1:], "f:a:") + (opts, args) = getopt.getopt(sys.argv[1:], "f:") except Exception,e: show_usage() if len(args) != 0: show_usage() - enabled_apis = set([]) api_desc_file = "" for opt_name, opt_val in opts: if opt_name == "-f": api_desc_file = opt_val - if opt_name == "-a": - apis = opt_to_apis(opt_val.upper()) - if not apis: - die("invalid API %s\n" % opt_val) - - enabled_apis |= apis if not api_desc_file: die("missing descriptor file (-f)\n") - if len(enabled_apis) == 0: - die("need at least a single enabled API\n") + # generate the code for all APIs + enabled_apis = set(["GLES", "GLES2", "GLES3", "GLES31", "GL", "GL_CORE"]) try: api_desc = gl_XML.parse_GL_API(api_desc_file)