diff options
author | Ian Romanick <[email protected]> | 2006-08-24 20:14:45 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2006-08-24 20:14:45 +0000 |
commit | bf83e652f6d023f1cdcf83ec3ebac024dc0032dc (patch) | |
tree | 5821a0bd691b71b989a7e77245ad8ca6e5b22887 /src/mesa/glapi/gl_XML.py | |
parent | 5947f8fd636004aa2f57fb792be0cf737610f2ba (diff) |
Add a new offset mode to the GL API XML. This mode, called "assign,"
tells the scripts to assign an available offset to the function. The
important changes are in src/mesa/glapi/gl_XML.py and
src/mesa/glapi/*.xml.
Since the DRI drivers only depend on functions required by the ABI
(e.g., GL 1.2 + ARB_multitexture) having fixed offsets, all functions
not in the ABI use "assign" mode. This has caused the offset of
basically every function outside the ABI to change. I have verified
that a libGL with this patch works with a DRI driver without the patch.
Futher, several function were removed from the dispatch tables
altogether. These are the functions for the following extensions:
GL_SGIS_texture_filter4
GL_SGIS_texture4D
GL_SGIS_detail_texture
GL_SGIS_sharpen_texture
GL_SGIX_sprite
GL_SGIX_instruments
GL_SGIX_framezoom
GL_SGIX_tag_sample_buffer
GL_SGIX_reference_plane
GL_SGIX_flush_raster
GL_SGIX_list_priority
GL_SGIX_fragment_lighting
GL_PGI_misc_hints
GL_EXT_index_material
GL_EXT_index_func
GL_3DFX_tbuffer
This removes 50 functions from the dispatch table.
Diffstat (limited to 'src/mesa/glapi/gl_XML.py')
-rw-r--r-- | src/mesa/glapi/gl_XML.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py index e1bff79abc0..eef29072572 100644 --- a/src/mesa/glapi/gl_XML.py +++ b/src/mesa/glapi/gl_XML.py @@ -40,6 +40,63 @@ def parse_GL_API( file_name, factory = None ): api = factory.create_item( "api", None, None ) api.process_element( doc ) + # After the XML has been processed, we need to go back and assign + # dispatch offsets to the functions that request that their offsets + # be assigned by the scripts. Typically this means all functions + # that are not part of the ABI. + # + # To bring some sanity to the generated offsets, we group all + # functions into four groups. The groups have offsets assigned to + # their functions in order. The groups are: + # + # 1. Core GL versions, sorted by version number. + # 2. ARB extensions, sorted by extension number. + # 3. Non-ARB extensions, sorted by extension number. + # 4. Un-numbered, non-ARB extensions, sorted by extension name. + + lists = [{}, {}, {}, {}] + + for func in api.functionIterateAll(): + if func.assign_offset: + [cat_name, cat_number] = api.category_dict[func.name] + + try: + core_version = float(cat_name) + except Exception,e: + core_version = 0.0 + + if core_version > 0.0: + func_cat_type = 0 + key = cat_name + elif cat_name.startswith( "GL_ARB_" ): + func_cat_type = 1 + key = int(cat_number) + else: + if cat_number != None: + func_cat_type = 2 + key = int(cat_number) + else: + func_cat_type = 3 + key = cat_name + + if not lists[func_cat_type].has_key(key): + lists[func_cat_type][key] = {} + + lists[func_cat_type][key][func.name] = func + + for func_cat_type in range(0,4): + keys = lists[func_cat_type].keys() + keys.sort() + + for key in keys: + names = lists[func_cat_type][key].keys() + names.sort() + + for name in names: + func = lists[func_cat_type][key][name] + func.offset = api.next_offset; + api.next_offset += 1 + doc.freeDoc() return api @@ -555,6 +612,8 @@ class gl_function( gl_item ): self.initialized = 0 self.images = [] + self.assign_offset = 0 + # Track the parameter string (for the function prototype) # for each entry-point. This is done because some functions # change their prototype slightly when promoted from extension @@ -593,6 +652,8 @@ class gl_function( gl_item ): self.offset = o except Exception, e: self.offset = -1 + if offset == "assign": + self.assign_offset = 1 if not self.name: @@ -698,6 +759,8 @@ class gl_api: self.factory = factory + self.next_offset = 0 + typeexpr.create_initial_types() return @@ -746,6 +809,9 @@ class gl_api: func = self.factory.create_item( "function", child, self ) self.functions_by_name[ func_name ] = func + if func.offset >= self.next_offset: + self.next_offset = func.offset + 1 + elif child.name == "enum": enum = self.factory.create_item( "enum", child, self ) |