mesa: generate glGetInteger/Boolean/Float/Doublev() code for all APIs

No longer pass -a flag to the get_hash_generate.py script to specify
OpenGL, ES1, ES2, etc.  This updates the autoconf, scons and android
build files too (so we can bisect).

This is the last of the API-dependent conditional compilation in
core Mesa.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Brian Paul
2013-04-17 09:49:39 -06:00
parent 9835d90596
commit 815ca0bf38
4 changed files with 7 additions and 35 deletions

View File

@@ -111,8 +111,7 @@ $(intermediates)/main/api_exec.c: $(dispatch_deps)
$(call es-gen) $(call es-gen)
GET_HASH_GEN := $(LOCAL_PATH)/main/get_hash_generator.py GET_HASH_GEN := $(LOCAL_PATH)/main/get_hash_generator.py
GET_HASH_GEN_FLAGS := $(patsubst %,-a %,$(MESA_ENABLED_APIS))
$(intermediates)/main/get_hash.h: $(glapi)/gl_and_es_API.xml \ $(intermediates)/main/get_hash.h: $(glapi)/gl_and_es_API.xml \
$(LOCAL_PATH)/main/get_hash_params.py $(GET_HASH_GEN) $(LOCAL_PATH)/main/get_hash_params.py $(GET_HASH_GEN)
@$(MESA_PYTHON2) $(GET_HASH_GEN) $(GET_HASH_GEN_FLAGS) -f $< > $@ @$(MESA_PYTHON2) $(GET_HASH_GEN) -f $< > $@

View File

@@ -71,14 +71,12 @@ CLEANFILES = \
git_sha1.h.tmp git_sha1.h.tmp
GET_HASH_GEN = main/get_hash_generator.py GET_HASH_GEN = main/get_hash_generator.py
GET_HASH_GEN_FLAGS := $(patsubst -DFEATURE_%=1,-a %, \
$(patsubst -DFEATURE_%=0,,$(API_DEFINES)))
main/get_hash.h: $(GLAPI)/gl_and_es_API.xml main/get_hash_params.py \ main/get_hash.h: $(GLAPI)/gl_and_es_API.xml main/get_hash_params.py \
$(GET_HASH_GEN) Makefile $(GET_HASH_GEN) Makefile
$(AM_V_GEN)set -e; \ $(AM_V_GEN)set -e; \
$(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN) \ $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN) \
$(GET_HASH_GEN_FLAGS) -f $< > $@.tmp; \ -f $< > $@.tmp; \
mv $@.tmp $@; mv $@.tmp $@;
noinst_LTLIBRARIES = noinst_LTLIBRARIES =

View File

@@ -341,16 +341,11 @@ if env['gles']:
enabled_apis += ['ES1', 'ES2'] enabled_apis += ['ES1', 'ES2']
env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis])
get_hash_gen_opts = ' '.join(["-a %s" % api for api in enabled_apis])
get_hash_header = env.CodeGenerate( get_hash_header = env.CodeGenerate(
target = 'main/get_hash.h', target = 'main/get_hash.h',
script = 'main/get_hash_generator.py', script = 'main/get_hash_generator.py',
source = GLAPI + 'gen/gl_and_es_API.xml', source = GLAPI + 'gen/gl_and_es_API.xml',
command = python_cmd + ' $SCRIPT ' + get_hash_gen_opts + command = python_cmd + ' $SCRIPT ' + ' -f $SOURCE > $TARGET'
' -f $SOURCE > $TARGET'
) )
# #

View File

@@ -179,54 +179,34 @@ def generate_hash_tables(enum_list, enabled_apis, param_descriptors):
return params, merge_tables(sorted_tables) 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(): def show_usage():
sys.stderr.write( sys.stderr.write(
"""Usage: %s [OPTIONS] """Usage: %s [OPTIONS]
-f <file> specify GL API XML file -f <file> specify GL API XML file
-a [GL|ES1|ES2] specify APIs to generate hash tables for
""" % (program)) """ % (program))
exit(1) exit(1)
if __name__ == '__main__': if __name__ == '__main__':
try: try:
(opts, args) = getopt.getopt(sys.argv[1:], "f:a:") (opts, args) = getopt.getopt(sys.argv[1:], "f:")
except Exception,e: except Exception,e:
show_usage() show_usage()
if len(args) != 0: if len(args) != 0:
show_usage() show_usage()
enabled_apis = set([])
api_desc_file = "" api_desc_file = ""
for opt_name, opt_val in opts: for opt_name, opt_val in opts:
if opt_name == "-f": if opt_name == "-f":
api_desc_file = opt_val 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: if not api_desc_file:
die("missing descriptor file (-f)\n") die("missing descriptor file (-f)\n")
if len(enabled_apis) == 0: # generate the code for all APIs
die("need at least a single enabled API\n") enabled_apis = set(["GLES", "GLES2", "GLES3", "GL", "GL_CORE"])
try: try:
api_desc = gl_XML.parse_GL_API(api_desc_file) api_desc = gl_XML.parse_GL_API(api_desc_file)