Add and clean up some more comments in the python.

Fixes #8
macos/v1.5.9
Eric Anholt 11 years ago
parent 7a8553f799
commit 920543faa4
  1. 31
      src/gen_dispatch.py

@ -380,8 +380,8 @@ class Generator(object):
self.supported_extensions.add(extname) self.supported_extensions.add(extname)
# 'supported' is a set of strings like gl, gles1, gles2, or glx, which are # 'supported' is a set of strings like gl, gles1, gles2,
# separated by '|' # or glx, which are separated by '|'
apis = extension.get('supported').split('|') apis = extension.get('supported').split('|')
if 'glx' in apis: if 'glx' in apis:
human_name = 'GLX extension \\"{0}\\"'.format(extname) human_name = 'GLX extension \\"{0}\\"'.format(extname)
@ -405,9 +405,10 @@ class Generator(object):
self.process_require_statements(extension, condition, loader, human_name) self.process_require_statements(extension, condition, loader, human_name)
def fixup_bootstrap_function(self, name, loader): def fixup_bootstrap_function(self, name, loader):
# We handle glGetString() and glGetIntegerv() specially, because we # We handle glGetString(), glGetIntegerv(), and
# need to use them in the process of deciding on loaders for # glXGetProcAddressARB() specially, because we need to use
# resolving, and the naive code generation would result in their # them in the process of deciding on loaders for resolving,
# and the naive code generation would result in their
# resolvers calling their own resolvers. # resolvers calling their own resolvers.
if name not in self.functions: if name not in self.functions:
return return
@ -575,7 +576,9 @@ class Generator(object):
self.outln('') self.outln('')
def write_dispatch_table_thunk(self, func): def write_dispatch_table_thunk(self, func):
# Writes out the thunk that calls through our dispatch table. # Writes out the thunk that fetches the (win32) dispatch table
# and calls through its entrypoint.
dispatch_table_entry = 'dispatch_table->p{0}'.format(func.alias_name) dispatch_table_entry = 'dispatch_table->p{0}'.format(func.alias_name)
self.outln('{0}{1}'.format(func.public, func.ret_type)) self.outln('{0}{1}'.format(func.public, func.ret_type))
@ -591,9 +594,9 @@ class Generator(object):
self.outln('') self.outln('')
def write_dispatch_table_rewrite_stub(self, func): def write_dispatch_table_rewrite_stub(self, func):
# Writes out the stub entrypoint that resolves, writes the # Writes out the initial dispatch table function pointer value
# resolved value into the dispatch table, and calls down to # that that resolves, writes the resolved value into the
# it. # dispatch table, and calls down to it.
dispatch_table_entry = 'dispatch_table->p{0}'.format(func.name) dispatch_table_entry = 'dispatch_table->p{0}'.format(func.name)
@ -613,6 +616,10 @@ class Generator(object):
self.outln('') self.outln('')
def write_function_pointer(self, func): def write_function_pointer(self, func):
# Writes out the function for resolving and updating the
# global function pointer, plus the actual global function
# pointer initializer.
self.outln('static {0}'.format(func.ret_type)) self.outln('static {0}'.format(func.ret_type))
self.outln('epoxy_{0}_rewrite_ptr({1})'.format(func.wrapped_name, self.outln('epoxy_{0}_rewrite_ptr({1})'.format(func.wrapped_name,
func.args_decl)) func.args_decl))
@ -635,6 +642,9 @@ class Generator(object):
self.outln('') self.outln('')
def write_provider_enums(self): def write_provider_enums(self):
# Writes the enum declaration for the list of providers
# supported by gl_provider_resolver()
self.outln('enum {0}_provider {{'.format(self.target)) self.outln('enum {0}_provider {{'.format(self.target))
sorted_providers = sorted(self.provider_enum.keys()) sorted_providers = sorted(self.provider_enum.keys())
@ -650,6 +660,9 @@ class Generator(object):
self.outln('') self.outln('')
def write_provider_enum_strings(self): def write_provider_enum_strings(self):
# Writes the mapping from enums to the strings describing them
# for epoxy_print_failure_reasons().
self.outln('static const char *enum_strings[] = {') self.outln('static const char *enum_strings[] = {')
sorted_providers = sorted(self.provider_enum.keys()) sorted_providers = sorted(self.provider_enum.keys())

Loading…
Cancel
Save