2004-05-18 19:33:40 +01:00
|
|
|
|
2005-01-07 02:39:09 +00:00
|
|
|
# (C) Copyright IBM Corporation 2004, 2005
|
2004-05-18 19:33:40 +01:00
|
|
|
# All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
# copy of this software and associated documentation files (the "Software"),
|
|
|
|
# to deal in the Software without restriction, including without limitation
|
|
|
|
# on the rights to use, copy, modify, merge, publish, distribute, sub
|
|
|
|
# license, and/or sell copies of the Software, and to permit persons to whom
|
|
|
|
# the Software is furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice (including the next
|
|
|
|
# paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
# Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
# IN THE SOFTWARE.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Ian Romanick <idr@us.ibm.com>
|
|
|
|
|
2018-06-27 11:37:38 +01:00
|
|
|
from collections import OrderedDict
|
2012-10-11 00:48:08 +01:00
|
|
|
from decimal import Decimal
|
2014-03-24 15:41:08 +00:00
|
|
|
import xml.etree.ElementTree as ET
|
2018-07-05 14:17:36 +01:00
|
|
|
import re, sys
|
2014-03-24 15:41:08 +00:00
|
|
|
import os.path
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
import typeexpr
|
2015-05-09 02:50:11 +01:00
|
|
|
import static_data
|
2004-05-18 19:33:40 +01:00
|
|
|
|
|
|
|
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
def parse_GL_API( file_name, factory = None ):
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if not factory:
|
|
|
|
factory = gl_item_factory()
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
api = factory.create_api()
|
|
|
|
api.parse_file( file_name )
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
# 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.
|
2006-08-24 21:14:45 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
for func in api.functionIterateByCategory():
|
2019-06-05 16:45:03 +01:00
|
|
|
if func.assign_offset and func.offset < 0:
|
2012-10-10 15:20:57 +01:00
|
|
|
func.offset = api.next_offset;
|
|
|
|
api.next_offset += 1
|
2006-08-24 21:14:45 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return api
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
def is_attr_true( element, name, default = "false" ):
|
2012-10-10 15:20:57 +01:00
|
|
|
"""Read a name value from an element's attributes.
|
|
|
|
|
|
|
|
The value read from the attribute list must be either 'true' or
|
|
|
|
'false'. If the value is 'false', zero will be returned. If the
|
|
|
|
value is 'true', non-zero will be returned. An exception will be
|
|
|
|
raised for any other value."""
|
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
value = element.get( name, default )
|
2012-10-10 15:20:57 +01:00
|
|
|
if value == "true":
|
|
|
|
return 1
|
|
|
|
elif value == "false":
|
|
|
|
return 0
|
|
|
|
else:
|
|
|
|
raise RuntimeError('Invalid value "%s" for boolean "%s".' % (value, name))
|
2005-04-15 00:00:34 +01:00
|
|
|
|
|
|
|
|
2012-10-10 19:01:35 +01:00
|
|
|
class gl_print_base(object):
|
2012-10-10 15:20:57 +01:00
|
|
|
"""Base class of all API pretty-printers.
|
|
|
|
|
|
|
|
In the model-view-controller pattern, this is the view. Any derived
|
|
|
|
class will want to over-ride the printBody, printRealHader, and
|
|
|
|
printRealFooter methods. Some derived classes may want to over-ride
|
|
|
|
printHeader and printFooter, or even Print (though this is unlikely).
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
# Name of the script that is generating the output file.
|
|
|
|
# Every derived class should set this to the name of its
|
|
|
|
# source file.
|
2005-04-18 20:42:23 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.name = "a"
|
2005-04-18 22:30:20 +01:00
|
|
|
|
2005-04-18 20:42:23 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
# License on the *generated* source file. This may differ
|
|
|
|
# from the license on the script that is generating the file.
|
|
|
|
# Every derived class should set this to some reasonable
|
|
|
|
# value.
|
|
|
|
#
|
|
|
|
# See license.py for an example of a reasonable value.
|
2005-04-18 22:30:20 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.license = "The license for this file is unspecified."
|
2005-04-18 20:42:23 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
# The header_tag is the name of the C preprocessor define
|
|
|
|
# used to prevent multiple inclusion. Typically only
|
|
|
|
# generated C header files need this to be set. Setting it
|
|
|
|
# causes code to be generated automatically in printHeader
|
|
|
|
# and printFooter.
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.header_tag = None
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
# List of file-private defines that must be undefined at the
|
|
|
|
# end of the file. This can be used in header files to define
|
|
|
|
# names for use in the file, then undefine them at the end of
|
|
|
|
# the header file.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.undef_list = []
|
|
|
|
return
|
2004-05-18 19:33:40 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def Print(self, api):
|
|
|
|
self.printHeader()
|
|
|
|
self.printBody(api)
|
|
|
|
self.printFooter()
|
|
|
|
return
|
2004-05-18 19:33:40 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def printHeader(self):
|
|
|
|
"""Print the header associated with all files and call the printRealHeader method."""
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2018-07-05 14:17:32 +01:00
|
|
|
print('/* DO NOT EDIT - This file generated automatically by %s script */' \
|
|
|
|
% (self.name))
|
|
|
|
print('')
|
|
|
|
print('/*')
|
|
|
|
print((' * ' + self.license.replace('\n', '\n * ')).replace(' \n', '\n'))
|
|
|
|
print(' */')
|
|
|
|
print('')
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.header_tag:
|
2018-07-05 14:17:32 +01:00
|
|
|
print('#if !defined( %s )' % (self.header_tag))
|
|
|
|
print('# define %s' % (self.header_tag))
|
|
|
|
print('')
|
2012-10-10 15:20:57 +01:00
|
|
|
self.printRealHeader();
|
|
|
|
return
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def printFooter(self):
|
|
|
|
"""Print the header associated with all files and call the printRealFooter method."""
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.printRealFooter()
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.undef_list:
|
2018-07-05 14:17:32 +01:00
|
|
|
print('')
|
2012-10-10 15:20:57 +01:00
|
|
|
for u in self.undef_list:
|
2018-07-05 14:17:32 +01:00
|
|
|
print("# undef %s" % (u))
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.header_tag:
|
2018-07-05 14:17:32 +01:00
|
|
|
print('')
|
|
|
|
print('#endif /* !defined( %s ) */' % (self.header_tag))
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def printRealHeader(self):
|
|
|
|
"""Print the "real" header for the created file.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
In the base class, this function is empty. All derived
|
|
|
|
classes should over-ride this function."""
|
|
|
|
return
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def printRealFooter(self):
|
|
|
|
"""Print the "real" footer for the created file.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
In the base class, this function is empty. All derived
|
|
|
|
classes should over-ride this function."""
|
|
|
|
return
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def printPure(self):
|
|
|
|
"""Conditionally define `PURE' function attribute.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
Conditionally defines a preprocessor macro `PURE' that wraps
|
|
|
|
GCC's `pure' function attribute. The conditional code can be
|
|
|
|
easilly adapted to other compilers that support a similar
|
|
|
|
feature.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
The name is also added to the file's undef_list.
|
|
|
|
"""
|
|
|
|
self.undef_list.append("PURE")
|
2018-07-05 14:17:32 +01:00
|
|
|
print("""# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
# define PURE __attribute__((pure))
|
|
|
|
# else
|
|
|
|
# define PURE
|
2018-07-05 14:17:32 +01:00
|
|
|
# endif""")
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def printFastcall(self):
|
|
|
|
"""Conditionally define `FASTCALL' function attribute.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
Conditionally defines a preprocessor macro `FASTCALL' that
|
|
|
|
wraps GCC's `fastcall' function attribute. The conditional
|
|
|
|
code can be easilly adapted to other compilers that support a
|
|
|
|
similar feature.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
The name is also added to the file's undef_list.
|
|
|
|
"""
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.undef_list.append("FASTCALL")
|
2018-07-05 14:17:32 +01:00
|
|
|
print("""# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
|
2005-10-20 23:51:50 +01:00
|
|
|
# define FASTCALL __attribute__((fastcall))
|
|
|
|
# else
|
|
|
|
# define FASTCALL
|
2018-07-05 14:17:32 +01:00
|
|
|
# endif""")
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def printVisibility(self, S, s):
|
|
|
|
"""Conditionally define visibility function attribute.
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
Conditionally defines a preprocessor macro name S that wraps
|
|
|
|
GCC's visibility function attribute. The visibility used is
|
|
|
|
the parameter s. The conditional code can be easilly adapted
|
|
|
|
to other compilers that support a similar feature.
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
The name is also added to the file's undef_list.
|
|
|
|
"""
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.undef_list.append(S)
|
2018-07-05 14:17:32 +01:00
|
|
|
print("""# if defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
# define %s __attribute__((visibility("%s")))
|
|
|
|
# else
|
|
|
|
# define %s
|
2018-07-05 14:17:32 +01:00
|
|
|
# endif""" % (S, s, S))
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def printNoinline(self):
|
|
|
|
"""Conditionally define `NOINLINE' function attribute.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
Conditionally defines a preprocessor macro `NOINLINE' that
|
|
|
|
wraps GCC's `noinline' function attribute. The conditional
|
|
|
|
code can be easilly adapted to other compilers that support a
|
|
|
|
similar feature.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
The name is also added to the file's undef_list.
|
|
|
|
"""
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.undef_list.append("NOINLINE")
|
2018-07-05 14:17:32 +01:00
|
|
|
print("""# if defined(__GNUC__)
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
# define NOINLINE __attribute__((noinline))
|
|
|
|
# else
|
|
|
|
# define NOINLINE
|
2018-07-05 14:17:32 +01:00
|
|
|
# endif""")
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
def real_function_name(element):
|
2014-03-24 15:41:08 +00:00
|
|
|
name = element.get( "name" )
|
|
|
|
alias = element.get( "alias" )
|
2012-10-10 15:20:57 +01:00
|
|
|
|
|
|
|
if alias:
|
|
|
|
return alias
|
|
|
|
else:
|
|
|
|
return name
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2005-06-24 19:35:31 +01:00
|
|
|
def real_category_name(c):
|
2012-10-10 15:20:57 +01:00
|
|
|
if re.compile("[1-9][0-9]*[.][0-9]+").match(c):
|
|
|
|
return "GL_VERSION_" + c.replace(".", "_")
|
|
|
|
else:
|
|
|
|
return c
|
2005-06-24 19:35:31 +01:00
|
|
|
|
|
|
|
|
2006-10-04 21:45:59 +01:00
|
|
|
def classify_category(name, number):
|
2012-10-10 15:20:57 +01:00
|
|
|
"""Based on the category name and number, select a numerical class for it.
|
|
|
|
|
|
|
|
Categories are divided into four classes numbered 0 through 3. The
|
|
|
|
classes are:
|
|
|
|
|
|
|
|
0. Core GL versions, sorted by version number.
|
|
|
|
1. ARB extensions, sorted by extension number.
|
|
|
|
2. Non-ARB extensions, sorted by extension number.
|
|
|
|
3. Un-numbered extensions, sorted by extension name.
|
|
|
|
"""
|
|
|
|
|
|
|
|
try:
|
|
|
|
core_version = float(name)
|
2018-07-06 11:13:36 +01:00
|
|
|
except Exception:
|
2012-10-10 15:20:57 +01:00
|
|
|
core_version = 0.0
|
|
|
|
|
|
|
|
if core_version > 0.0:
|
|
|
|
cat_type = 0
|
|
|
|
key = name
|
|
|
|
elif name.startswith("GL_ARB_") or name.startswith("GLX_ARB_") or name.startswith("WGL_ARB_"):
|
|
|
|
cat_type = 1
|
|
|
|
key = int(number)
|
|
|
|
else:
|
|
|
|
if number != None:
|
|
|
|
cat_type = 2
|
|
|
|
key = int(number)
|
|
|
|
else:
|
|
|
|
cat_type = 3
|
|
|
|
key = name
|
|
|
|
|
|
|
|
|
|
|
|
return [cat_type, key]
|
2006-10-04 21:45:59 +01:00
|
|
|
|
|
|
|
|
2005-07-02 09:29:57 +01:00
|
|
|
def create_parameter_string(parameters, include_names):
|
2012-10-10 15:20:57 +01:00
|
|
|
"""Create a parameter string from a list of gl_parameters."""
|
2005-06-24 19:35:31 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
list = []
|
|
|
|
for p in parameters:
|
|
|
|
if p.is_padding:
|
|
|
|
continue
|
2008-12-09 22:43:09 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if include_names:
|
|
|
|
list.append( p.string() )
|
|
|
|
else:
|
|
|
|
list.append( p.type_string() )
|
2005-06-24 19:35:31 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if len(list) == 0: list = ["void"]
|
2005-06-24 19:35:31 +01:00
|
|
|
|
2018-07-05 14:17:36 +01:00
|
|
|
return ", ".join(list)
|
2005-06-24 19:35:31 +01:00
|
|
|
|
|
|
|
|
2012-10-10 19:01:35 +01:00
|
|
|
class gl_item(object):
|
2014-03-24 15:41:08 +00:00
|
|
|
def __init__(self, element, context, category):
|
2012-10-10 15:20:57 +01:00
|
|
|
self.context = context
|
2014-03-24 15:41:08 +00:00
|
|
|
self.name = element.get( "name" )
|
|
|
|
self.category = real_category_name( category )
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
2005-01-25 01:20:11 +00:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
class gl_type( gl_item ):
|
2014-03-24 15:41:08 +00:00
|
|
|
def __init__(self, element, context, category):
|
|
|
|
gl_item.__init__(self, element, context, category)
|
|
|
|
self.size = int( element.get( "size" ), 0 )
|
2012-10-10 15:20:57 +01:00
|
|
|
|
|
|
|
te = typeexpr.type_expression( None )
|
|
|
|
tn = typeexpr.type_node()
|
2014-03-24 15:41:08 +00:00
|
|
|
tn.size = int( element.get( "size" ), 0 )
|
2012-10-10 15:20:57 +01:00
|
|
|
tn.integer = not is_attr_true( element, "float" )
|
|
|
|
tn.unsigned = is_attr_true( element, "unsigned" )
|
|
|
|
tn.pointer = is_attr_true( element, "pointer" )
|
|
|
|
tn.name = "GL" + self.name
|
|
|
|
te.set_base_type_node( tn )
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.type_expr = te
|
|
|
|
return
|
2005-01-24 21:29:13 +00:00
|
|
|
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def get_type_expression(self):
|
|
|
|
return self.type_expr
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
class gl_enum( gl_item ):
|
2014-03-24 15:41:08 +00:00
|
|
|
def __init__(self, element, context, category):
|
|
|
|
gl_item.__init__(self, element, context, category)
|
|
|
|
self.value = int( element.get( "value" ), 0 )
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
temp = element.get( "count" )
|
2012-10-10 15:20:57 +01:00
|
|
|
if not temp or temp == "?":
|
|
|
|
self.default_count = -1
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
c = int(temp)
|
2018-07-06 11:13:36 +01:00
|
|
|
except Exception:
|
2012-10-10 15:20:57 +01:00
|
|
|
raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n))
|
2005-01-25 01:20:11 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.default_count = c
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
2005-01-24 21:29:13 +00:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def priority(self):
|
|
|
|
"""Calculate a 'priority' for this enum name.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
When an enum is looked up by number, there may be many
|
|
|
|
possible names, but only one is the 'prefered' name. The
|
|
|
|
priority is used to select which name is the 'best'.
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
Highest precedence is given to core GL name. ARB extension
|
|
|
|
names have the next highest, followed by EXT extension names.
|
|
|
|
Vendor extension names are the lowest.
|
|
|
|
"""
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.name.endswith( "_BIT" ):
|
|
|
|
bias = 1
|
|
|
|
else:
|
|
|
|
bias = 0
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.category.startswith( "GL_VERSION_" ):
|
|
|
|
priority = 0
|
|
|
|
elif self.category.startswith( "GL_ARB_" ):
|
|
|
|
priority = 2
|
|
|
|
elif self.category.startswith( "GL_EXT_" ):
|
|
|
|
priority = 4
|
|
|
|
else:
|
|
|
|
priority = 6
|
|
|
|
|
|
|
|
return priority + bias
|
2004-05-18 19:33:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-10 19:01:35 +01:00
|
|
|
class gl_parameter(object):
|
2012-10-10 15:20:57 +01:00
|
|
|
def __init__(self, element, context):
|
2014-03-24 15:41:08 +00:00
|
|
|
self.name = element.get( "name" )
|
2012-10-10 15:20:57 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
ts = element.get( "type" )
|
2012-10-10 15:20:57 +01:00
|
|
|
self.type_expr = typeexpr.type_expression( ts, context )
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
temp = element.get( "variable_param" )
|
2012-10-10 15:20:57 +01:00
|
|
|
if temp:
|
|
|
|
self.count_parameter_list = temp.split( ' ' )
|
|
|
|
else:
|
|
|
|
self.count_parameter_list = []
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
# The count tag can be either a numeric string or the name of
|
|
|
|
# a variable. If it is the name of a variable, the int(c)
|
|
|
|
# statement will throw an exception, and the except block will
|
|
|
|
# take over.
|
2005-02-01 00:13:04 +00:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
c = element.get( "count" )
|
2012-10-10 15:20:57 +01:00
|
|
|
try:
|
|
|
|
count = int(c)
|
|
|
|
self.count = count
|
|
|
|
self.counter = None
|
2018-07-06 11:13:36 +01:00
|
|
|
except Exception:
|
2012-10-10 15:20:57 +01:00
|
|
|
count = 1
|
|
|
|
self.count = 0
|
|
|
|
self.counter = c
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2020-02-20 01:28:01 +00:00
|
|
|
self.marshal_count = element.get("marshal_count")
|
2014-03-24 15:41:08 +00:00
|
|
|
self.count_scale = int(element.get( "count_scale", "1" ))
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
elements = (count * self.count_scale)
|
|
|
|
if elements == 1:
|
|
|
|
elements = 0
|
2005-04-18 20:16:07 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
#if ts == "GLdouble":
|
|
|
|
# print '/* stack size -> %s = %u (before)*/' % (self.name, self.type_expr.get_stack_size())
|
|
|
|
# print '/* # elements = %u */' % (elements)
|
|
|
|
self.type_expr.set_elements( elements )
|
|
|
|
#if ts == "GLdouble":
|
|
|
|
# print '/* stack size -> %s = %u (after) */' % (self.name, self.type_expr.get_stack_size())
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.is_client_only = is_attr_true( element, 'client_only' )
|
|
|
|
self.is_counter = is_attr_true( element, 'counter' )
|
|
|
|
self.is_output = is_attr_true( element, 'output' )
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2005-01-07 02:39:09 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
# Pixel data has special parameters.
|
2005-01-07 02:39:09 +00:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
self.width = element.get('img_width')
|
|
|
|
self.height = element.get('img_height')
|
|
|
|
self.depth = element.get('img_depth')
|
|
|
|
self.extent = element.get('img_extent')
|
2005-01-07 02:39:09 +00:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
self.img_xoff = element.get('img_xoff')
|
|
|
|
self.img_yoff = element.get('img_yoff')
|
|
|
|
self.img_zoff = element.get('img_zoff')
|
|
|
|
self.img_woff = element.get('img_woff')
|
2005-01-07 02:39:09 +00:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
self.img_format = element.get('img_format')
|
|
|
|
self.img_type = element.get('img_type')
|
|
|
|
self.img_target = element.get('img_target')
|
2005-01-07 02:39:09 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.img_pad_dimensions = is_attr_true( element, 'img_pad_dimensions' )
|
|
|
|
self.img_null_flag = is_attr_true( element, 'img_null_flag' )
|
|
|
|
self.img_send_null = is_attr_true( element, 'img_send_null' )
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.is_padding = is_attr_true( element, 'padding' )
|
|
|
|
return
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def compatible(self, other):
|
|
|
|
return 1
|
2004-05-18 19:33:40 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def is_array(self):
|
|
|
|
return self.is_pointer()
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def is_pointer(self):
|
|
|
|
return self.type_expr.is_pointer()
|
2004-05-20 00:33:08 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def is_image(self):
|
|
|
|
if self.width:
|
|
|
|
return 1
|
|
|
|
else:
|
|
|
|
return 0
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def is_variable_length(self):
|
2020-02-20 01:28:01 +00:00
|
|
|
return len(self.count_parameter_list) or self.counter or self.marshal_count
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def is_64_bit(self):
|
|
|
|
count = self.type_expr.get_element_count()
|
|
|
|
if count:
|
|
|
|
if (self.size() / count) == 8:
|
|
|
|
return 1
|
|
|
|
else:
|
|
|
|
if self.size() == 8:
|
|
|
|
return 1
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return 0
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def string(self):
|
|
|
|
return self.type_expr.original_string + " " + self.name
|
2004-12-01 00:29:48 +00:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def type_string(self):
|
|
|
|
return self.type_expr.original_string
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def get_base_type_string(self):
|
|
|
|
return self.type_expr.get_base_name()
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2005-03-03 21:21:59 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def get_dimensions(self):
|
|
|
|
if not self.width:
|
|
|
|
return [ 0, "0", "0", "0", "0" ]
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
dim = 1
|
|
|
|
w = self.width
|
|
|
|
h = "1"
|
|
|
|
d = "1"
|
|
|
|
e = "1"
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.height:
|
|
|
|
dim = 2
|
|
|
|
h = self.height
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.depth:
|
|
|
|
dim = 3
|
|
|
|
d = self.depth
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.extent:
|
|
|
|
dim = 4
|
|
|
|
e = self.extent
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return [ dim, w, h, d, e ]
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2005-03-03 21:21:59 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def get_stack_size(self):
|
|
|
|
return self.type_expr.get_stack_size()
|
2005-03-03 21:21:59 +00:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def size(self):
|
|
|
|
if self.is_image():
|
|
|
|
return 0
|
|
|
|
else:
|
|
|
|
return self.type_expr.get_element_size()
|
2005-03-03 21:21:59 +00:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def get_element_count(self):
|
|
|
|
c = self.type_expr.get_element_count()
|
|
|
|
if c == 0:
|
|
|
|
return 1
|
2005-01-07 02:39:09 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return c
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2005-03-03 21:21:59 +00:00
|
|
|
|
2020-02-20 01:28:01 +00:00
|
|
|
def size_string(self, use_parens = 1, marshal = 0):
|
2019-11-17 18:12:04 +00:00
|
|
|
base_size_str = ""
|
|
|
|
|
|
|
|
count = self.get_element_count()
|
|
|
|
if count:
|
|
|
|
base_size_str = "%d * " % count
|
|
|
|
|
|
|
|
base_size_str += "sizeof(%s)" % ( self.get_base_type_string() )
|
|
|
|
|
2020-02-20 01:28:01 +00:00
|
|
|
if self.counter or self.count_parameter_list or (self.marshal_count and marshal):
|
2012-10-10 15:20:57 +01:00
|
|
|
list = [ "compsize" ]
|
2005-03-03 21:21:59 +00:00
|
|
|
|
2020-02-20 01:28:01 +00:00
|
|
|
if self.marshal_count and marshal:
|
|
|
|
list = [ self.marshal_count ]
|
|
|
|
elif self.counter and self.count_parameter_list:
|
2012-10-10 15:20:57 +01:00
|
|
|
list.append( self.counter )
|
|
|
|
elif self.counter:
|
|
|
|
list = [ self.counter ]
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2019-11-17 18:12:04 +00:00
|
|
|
if self.size() > 1:
|
|
|
|
list.append( base_size_str )
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if len(list) > 1 and use_parens :
|
2018-07-05 14:17:36 +01:00
|
|
|
return "safe_mul(%s)" % ", ".join(list)
|
2012-10-10 15:20:57 +01:00
|
|
|
else:
|
2018-07-05 14:17:36 +01:00
|
|
|
return " * ".join(list)
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
elif self.is_image():
|
|
|
|
return "compsize"
|
|
|
|
else:
|
2019-11-17 18:12:04 +00:00
|
|
|
return base_size_str
|
2004-05-18 19:33:40 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def format_string(self):
|
|
|
|
if self.type_expr.original_string == "GLenum":
|
|
|
|
return "0x%x"
|
|
|
|
else:
|
|
|
|
return self.type_expr.format_string()
|
2005-01-25 23:53:13 +00:00
|
|
|
|
|
|
|
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
class gl_function( gl_item ):
|
2012-10-10 15:20:57 +01:00
|
|
|
def __init__(self, element, context):
|
|
|
|
self.context = context
|
|
|
|
self.name = None
|
|
|
|
|
|
|
|
self.entry_points = []
|
|
|
|
self.return_type = "void"
|
|
|
|
self.parameters = []
|
|
|
|
self.offset = -1
|
|
|
|
self.initialized = 0
|
|
|
|
self.images = []
|
2012-10-30 23:21:18 +00:00
|
|
|
self.exec_flavor = 'mesa'
|
|
|
|
self.desktop = True
|
|
|
|
self.deprecated = None
|
2017-04-27 04:32:43 +01:00
|
|
|
self.has_no_error_variant = False
|
2006-08-26 22:26:55 +01:00
|
|
|
|
2012-10-30 23:21:18 +00:00
|
|
|
# self.api_map[api] is a decimal value indicating the earliest
|
|
|
|
# version of the given API in which ANY alias for the function
|
|
|
|
# exists. The map only lists APIs which contain the function
|
|
|
|
# in at least one version. For example, for the ClipPlanex
|
2018-11-21 05:21:58 +00:00
|
|
|
# function, self.api_map == { 'es1':
|
2012-10-30 23:21:18 +00:00
|
|
|
# Decimal('1.1') }.
|
|
|
|
self.api_map = {}
|
|
|
|
|
2015-05-09 03:33:13 +01:00
|
|
|
self.assign_offset = False
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.static_entry_points = []
|
2005-06-24 19:35:31 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
# 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
|
|
|
|
# to ARB extension to core. glTexImage3DEXT and glTexImage3D
|
|
|
|
# are good examples of this. Scripts that need to generate
|
|
|
|
# code for these differing aliases need to real prototype
|
|
|
|
# for each entry-point. Otherwise, they may generate code
|
|
|
|
# that won't compile.
|
|
|
|
|
|
|
|
self.entry_point_parameters = {}
|
|
|
|
|
|
|
|
self.process_element( element )
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def process_element(self, element):
|
2014-03-24 15:41:08 +00:00
|
|
|
name = element.get( "name" )
|
|
|
|
alias = element.get( "alias" )
|
2012-10-10 15:20:57 +01:00
|
|
|
|
2021-01-28 04:12:54 +00:00
|
|
|
# marshal isn't allowed with alias
|
|
|
|
assert not alias or not element.get('marshal')
|
|
|
|
assert not alias or not element.get('marshal_count')
|
|
|
|
assert not alias or not element.get('marshal_sync')
|
|
|
|
assert not alias or not element.get('marshal_call_after')
|
|
|
|
|
2015-05-12 23:11:09 +01:00
|
|
|
if name in static_data.functions:
|
2012-10-10 15:20:57 +01:00
|
|
|
self.static_entry_points.append(name)
|
|
|
|
|
|
|
|
self.entry_points.append( name )
|
2012-10-11 00:48:08 +01:00
|
|
|
|
|
|
|
for api in ('es1', 'es2'):
|
2014-03-24 15:41:08 +00:00
|
|
|
version_str = element.get(api, 'none')
|
2012-10-11 00:48:08 +01:00
|
|
|
assert version_str is not None
|
|
|
|
if version_str != 'none':
|
2012-10-30 23:21:18 +00:00
|
|
|
version_decimal = Decimal(version_str)
|
|
|
|
if api not in self.api_map or \
|
|
|
|
version_decimal < self.api_map[api]:
|
|
|
|
self.api_map[api] = version_decimal
|
2012-10-11 00:48:08 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
exec_flavor = element.get('exec')
|
2012-10-30 23:21:18 +00:00
|
|
|
if exec_flavor:
|
|
|
|
self.exec_flavor = exec_flavor
|
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
deprecated = element.get('deprecated', 'none')
|
2012-10-30 23:21:18 +00:00
|
|
|
if deprecated != 'none':
|
|
|
|
self.deprecated = Decimal(deprecated)
|
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
if not is_attr_true(element, 'desktop', 'true'):
|
2012-10-30 23:21:18 +00:00
|
|
|
self.desktop = False
|
|
|
|
|
2017-04-27 04:32:43 +01:00
|
|
|
if self.has_no_error_variant or is_attr_true(element, 'no_error'):
|
|
|
|
self.has_no_error_variant = True
|
|
|
|
else:
|
|
|
|
self.has_no_error_variant = False
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if alias:
|
|
|
|
true_name = alias
|
|
|
|
else:
|
|
|
|
true_name = name
|
|
|
|
|
2012-11-07 17:29:20 +00:00
|
|
|
# Only try to set the offset when a non-alias entry-point
|
|
|
|
# is being processed.
|
2005-06-24 19:35:31 +01:00
|
|
|
|
2018-11-19 14:08:15 +00:00
|
|
|
if name in static_data.offsets and static_data.offsets[name] <= static_data.MAX_OFFSETS:
|
2015-05-09 03:33:13 +01:00
|
|
|
self.offset = static_data.offsets[name]
|
2019-06-05 16:45:03 +01:00
|
|
|
elif name in static_data.offsets and static_data.offsets[name] > static_data.MAX_OFFSETS:
|
|
|
|
self.offset = static_data.offsets[name]
|
|
|
|
self.assign_offset = True
|
2015-05-09 02:50:11 +01:00
|
|
|
else:
|
2019-06-05 16:45:03 +01:00
|
|
|
if self.exec_flavor != "skip":
|
|
|
|
raise RuntimeError("Entry-point %s is missing offset in static_data.py. Add one at the bottom of the list." % (name))
|
2015-05-09 03:33:13 +01:00
|
|
|
self.assign_offset = self.exec_flavor != "skip" or name in static_data.unused_functions
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if not self.name:
|
|
|
|
self.name = true_name
|
|
|
|
elif self.name != true_name:
|
|
|
|
raise RuntimeError("Function true name redefined. Was %s, now %s." % (self.name, true_name))
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
# There are two possible cases. The first time an entry-point
|
|
|
|
# with data is seen, self.initialized will be 0. On that
|
|
|
|
# pass, we just fill in the data. The next time an
|
|
|
|
# entry-point with data is seen, self.initialized will be 1.
|
|
|
|
# On that pass we have to make that the new values match the
|
|
|
|
# valuse from the previous entry-point.
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
parameters = []
|
|
|
|
return_type = "void"
|
2020-06-05 00:05:46 +01:00
|
|
|
for child in element:
|
2014-03-24 15:41:08 +00:00
|
|
|
if child.tag == "return":
|
|
|
|
return_type = child.get( "type", "void" )
|
|
|
|
elif child.tag == "param":
|
|
|
|
param = self.context.factory.create_parameter(child, self.context)
|
|
|
|
parameters.append( param )
|
2005-01-25 23:53:13 +00:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if self.initialized:
|
|
|
|
if self.return_type != return_type:
|
|
|
|
raise RuntimeError( "Return type changed in %s. Was %s, now %s." % (name, self.return_type, return_type))
|
2011-08-07 15:19:51 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if len(parameters) != len(self.parameters):
|
|
|
|
raise RuntimeError( "Parameter count mismatch in %s. Was %d, now %d." % (name, len(self.parameters), len(parameters)))
|
2011-08-07 15:19:51 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
for j in range(0, len(parameters)):
|
|
|
|
p1 = parameters[j]
|
|
|
|
p2 = self.parameters[j]
|
|
|
|
if not p1.compatible( p2 ):
|
|
|
|
raise RuntimeError( 'Parameter type mismatch in %s. "%s" was "%s", now "%s".' % (name, p2.name, p2.type_expr.original_string, p1.type_expr.original_string))
|
2011-08-07 15:19:51 +01:00
|
|
|
|
2005-01-25 23:53:13 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if true_name == name or not self.initialized:
|
|
|
|
self.return_type = return_type
|
|
|
|
self.parameters = parameters
|
2005-01-25 23:53:13 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
for param in self.parameters:
|
|
|
|
if param.is_image():
|
|
|
|
self.images.append( param )
|
2005-01-25 23:53:13 +00:00
|
|
|
|
2020-06-05 00:05:46 +01:00
|
|
|
if list(element):
|
2012-10-10 15:20:57 +01:00
|
|
|
self.initialized = 1
|
|
|
|
self.entry_point_parameters[name] = parameters
|
|
|
|
else:
|
|
|
|
self.entry_point_parameters[name] = []
|
2005-01-25 23:53:13 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
2005-01-25 23:53:13 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def filter_entry_points(self, entry_point_list):
|
|
|
|
"""Filter out entry points not in entry_point_list."""
|
|
|
|
if not self.initialized:
|
|
|
|
raise RuntimeError('%s is not initialized yet' % self.name)
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
entry_points = []
|
|
|
|
for ent in self.entry_points:
|
|
|
|
if ent not in entry_point_list:
|
|
|
|
if ent in self.static_entry_points:
|
|
|
|
self.static_entry_points.remove(ent)
|
|
|
|
self.entry_point_parameters.pop(ent)
|
|
|
|
else:
|
|
|
|
entry_points.append(ent)
|
2006-10-11 23:37:14 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if not entry_points:
|
|
|
|
raise RuntimeError('%s has no entry point after filtering' % self.name)
|
2006-10-11 23:37:14 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
self.entry_points = entry_points
|
|
|
|
if self.name not in entry_points:
|
|
|
|
# use the first remaining entry point
|
|
|
|
self.name = entry_points[0]
|
|
|
|
self.parameters = self.entry_point_parameters[entry_points[0]]
|
2006-10-11 23:37:14 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def get_images(self):
|
|
|
|
"""Return potentially empty list of input images."""
|
|
|
|
return self.images
|
2006-10-11 23:37:14 +01:00
|
|
|
|
2009-10-20 07:32:39 +01:00
|
|
|
|
dispatch: properly handle parameter name mismatches in glapitemp.h.
Previously, when code-generating aliased functions in glapitemp.h, we
weren't consistent about which function alias we used to obtain the
parameter names, with the risk that we would generate incorrect code
like this:
KEYWORD1 void KEYWORD2 NAME(Foo)(GLint x)
{
(void) x;
DISPATCH(Foo, (x), (F, "glFoo(%d);\n", x));
}
KEYWORD1 void KEYWORD2 NAME(FooEXT)(GLint y)
{
(void) x;
DISPATCH(Foo, (x), (F, "glFooEXT(%d);\n", x));
}
At the moment there are no aliased functions with mismatched parameter
names, so this isn't the problem. But when we introduce GLES1
functions into the dispatch table, there will be
(MapBufferRange/MapBufferRangeEXT). This patch paves the way for that
by fixing the code generation script to handle the mismatch correctly.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2012-10-30 15:45:29 +00:00
|
|
|
def parameterIterator(self, name = None):
|
|
|
|
if name is not None:
|
2018-07-05 14:17:39 +01:00
|
|
|
return iter(self.entry_point_parameters[name]);
|
dispatch: properly handle parameter name mismatches in glapitemp.h.
Previously, when code-generating aliased functions in glapitemp.h, we
weren't consistent about which function alias we used to obtain the
parameter names, with the risk that we would generate incorrect code
like this:
KEYWORD1 void KEYWORD2 NAME(Foo)(GLint x)
{
(void) x;
DISPATCH(Foo, (x), (F, "glFoo(%d);\n", x));
}
KEYWORD1 void KEYWORD2 NAME(FooEXT)(GLint y)
{
(void) x;
DISPATCH(Foo, (x), (F, "glFooEXT(%d);\n", x));
}
At the moment there are no aliased functions with mismatched parameter
names, so this isn't the problem. But when we introduce GLES1
functions into the dispatch table, there will be
(MapBufferRange/MapBufferRangeEXT). This patch paves the way for that
by fixing the code generation script to handle the mismatch correctly.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2012-10-30 15:45:29 +00:00
|
|
|
else:
|
2018-07-05 14:17:39 +01:00
|
|
|
return iter(self.parameters);
|
2006-08-26 22:26:55 +01:00
|
|
|
|
2006-08-28 18:40:45 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def get_parameter_string(self, entrypoint = None):
|
|
|
|
if entrypoint:
|
|
|
|
params = self.entry_point_parameters[ entrypoint ]
|
|
|
|
else:
|
|
|
|
params = self.parameters
|
|
|
|
|
|
|
|
return create_parameter_string( params, 1 )
|
|
|
|
|
|
|
|
def get_called_parameter_string(self):
|
|
|
|
p_string = ""
|
|
|
|
comma = ""
|
|
|
|
|
|
|
|
for p in self.parameterIterator():
|
2012-11-07 21:49:41 +00:00
|
|
|
if p.is_padding:
|
|
|
|
continue
|
2012-10-10 15:20:57 +01:00
|
|
|
p_string = p_string + comma + p.name
|
|
|
|
comma = ", "
|
|
|
|
|
|
|
|
return p_string
|
|
|
|
|
|
|
|
|
|
|
|
def is_abi(self):
|
|
|
|
return (self.offset >= 0 and not self.assign_offset)
|
|
|
|
|
|
|
|
def is_static_entry_point(self, name):
|
|
|
|
return name in self.static_entry_points
|
|
|
|
|
|
|
|
def dispatch_name(self):
|
|
|
|
if self.name in self.static_entry_points:
|
|
|
|
return self.name
|
|
|
|
else:
|
|
|
|
return "_dispatch_stub_%u" % (self.offset)
|
|
|
|
|
|
|
|
def static_name(self, name):
|
|
|
|
if name in self.static_entry_points:
|
|
|
|
return name
|
|
|
|
else:
|
|
|
|
return "_dispatch_stub_%u" % (self.offset)
|
2006-08-28 18:40:45 +01:00
|
|
|
|
2012-10-10 19:01:35 +01:00
|
|
|
class gl_item_factory(object):
|
2012-10-10 15:20:57 +01:00
|
|
|
"""Factory to create objects derived from gl_item."""
|
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
def create_function(self, element, context):
|
|
|
|
return gl_function(element, context)
|
|
|
|
|
|
|
|
def create_type(self, element, context, category):
|
|
|
|
return gl_type(element, context, category)
|
|
|
|
|
|
|
|
def create_enum(self, element, context, category):
|
|
|
|
return gl_enum(element, context, category)
|
|
|
|
|
|
|
|
def create_parameter(self, element, context):
|
|
|
|
return gl_parameter(element, context)
|
|
|
|
|
|
|
|
def create_api(self):
|
|
|
|
return gl_api(self)
|
2005-01-25 23:53:13 +00:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 19:01:35 +01:00
|
|
|
class gl_api(object):
|
2012-10-10 15:20:57 +01:00
|
|
|
def __init__(self, factory):
|
2018-06-27 11:37:38 +01:00
|
|
|
self.functions_by_name = OrderedDict()
|
2012-10-10 15:20:57 +01:00
|
|
|
self.enums_by_name = {}
|
|
|
|
self.types_by_name = {}
|
|
|
|
|
|
|
|
self.category_dict = {}
|
|
|
|
self.categories = [{}, {}, {}, {}]
|
|
|
|
|
|
|
|
self.factory = factory
|
|
|
|
|
|
|
|
self.next_offset = 0
|
|
|
|
|
|
|
|
typeexpr.create_initial_types()
|
|
|
|
return
|
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
def parse_file(self, file_name):
|
|
|
|
doc = ET.parse( file_name )
|
|
|
|
self.process_element(file_name, doc)
|
2006-08-24 21:14:45 +01:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
def process_element(self, file_name, doc):
|
|
|
|
element = doc.getroot()
|
|
|
|
if element.tag == "OpenGLAPI":
|
|
|
|
self.process_OpenGLAPI(file_name, element)
|
|
|
|
return
|
|
|
|
|
2011-08-07 15:19:51 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
def process_OpenGLAPI(self, file_name, element):
|
2020-06-05 00:05:46 +01:00
|
|
|
for child in element:
|
2014-03-24 15:41:08 +00:00
|
|
|
if child.tag == "category":
|
|
|
|
self.process_category( child )
|
|
|
|
elif child.tag == "OpenGLAPI":
|
|
|
|
self.process_OpenGLAPI( file_name, child )
|
|
|
|
elif child.tag == '{http://www.w3.org/2001/XInclude}include':
|
|
|
|
href = child.get('href')
|
|
|
|
href = os.path.join(os.path.dirname(file_name), href)
|
|
|
|
self.parse_file(href)
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def process_category(self, cat):
|
2014-03-24 15:41:08 +00:00
|
|
|
cat_name = cat.get( "name" )
|
|
|
|
cat_number = cat.get( "number" )
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
[cat_type, key] = classify_category(cat_name, cat_number)
|
|
|
|
self.categories[cat_type][key] = [cat_name, cat_number]
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2020-06-05 00:05:46 +01:00
|
|
|
for child in cat:
|
2014-03-24 15:41:08 +00:00
|
|
|
if child.tag == "function":
|
|
|
|
func_name = real_function_name( child )
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
temp_name = child.get( "name" )
|
|
|
|
self.category_dict[ temp_name ] = [cat_name, cat_number]
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2018-07-05 14:17:35 +01:00
|
|
|
if func_name in self.functions_by_name:
|
2014-03-24 15:41:08 +00:00
|
|
|
func = self.functions_by_name[ func_name ]
|
|
|
|
func.process_element( child )
|
|
|
|
else:
|
|
|
|
func = self.factory.create_function( child, self )
|
|
|
|
self.functions_by_name[ func_name ] = func
|
2006-10-04 21:45:59 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
if func.offset >= self.next_offset:
|
|
|
|
self.next_offset = func.offset + 1
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2005-06-24 19:35:31 +01:00
|
|
|
|
2014-03-24 15:41:08 +00:00
|
|
|
elif child.tag == "enum":
|
|
|
|
enum = self.factory.create_enum( child, self, cat_name )
|
|
|
|
self.enums_by_name[ enum.name ] = enum
|
|
|
|
elif child.tag == "type":
|
|
|
|
t = self.factory.create_type( child, self, cat_name )
|
|
|
|
self.types_by_name[ "GL" + t.name ] = t
|
2005-03-17 20:56:13 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
return
|
2006-08-24 21:14:45 +01:00
|
|
|
|
2005-03-17 20:56:13 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def functionIterateByCategory(self, cat = None):
|
|
|
|
"""Iterate over functions by category.
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
If cat is None, all known functions are iterated in category
|
|
|
|
order. See classify_category for details of the ordering.
|
|
|
|
Within a category, functions are sorted by name. If cat is
|
|
|
|
not None, then only functions in that category are iterated.
|
|
|
|
"""
|
|
|
|
lists = [{}, {}, {}, {}]
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
for func in self.functionIterateAll():
|
|
|
|
[cat_name, cat_number] = self.category_dict[func.name]
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
if (cat == None) or (cat == cat_name):
|
|
|
|
[func_cat_type, key] = classify_category(cat_name, cat_number)
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2018-07-05 14:17:35 +01:00
|
|
|
if key not in lists[func_cat_type]:
|
2012-10-10 15:20:57 +01:00
|
|
|
lists[func_cat_type][key] = {}
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
lists[func_cat_type][key][func.name] = func
|
2006-10-04 21:45:59 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
functions = []
|
|
|
|
for func_cat_type in range(0,4):
|
2018-07-06 11:17:50 +01:00
|
|
|
keys = sorted(lists[func_cat_type].keys())
|
2006-10-04 21:45:59 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
for key in keys:
|
2018-07-06 11:17:50 +01:00
|
|
|
names = sorted(lists[func_cat_type][key].keys())
|
2006-10-04 21:45:59 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
for name in names:
|
|
|
|
functions.append(lists[func_cat_type][key][name])
|
2006-10-04 21:45:59 +01:00
|
|
|
|
2018-07-05 14:17:39 +01:00
|
|
|
return iter(functions)
|
2006-10-04 21:45:59 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def functionIterateByOffset(self):
|
|
|
|
max_offset = -1
|
2018-07-06 11:20:26 +01:00
|
|
|
for func in self.functions_by_name.values():
|
2012-10-10 15:20:57 +01:00
|
|
|
if func.offset > max_offset:
|
|
|
|
max_offset = func.offset
|
2006-10-04 21:45:59 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
temp = [None for i in range(0, max_offset + 1)]
|
2018-07-06 11:20:26 +01:00
|
|
|
for func in self.functions_by_name.values():
|
2012-10-10 15:20:57 +01:00
|
|
|
if func.offset != -1:
|
|
|
|
temp[ func.offset ] = func
|
2006-10-04 21:45:59 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
list = []
|
|
|
|
for i in range(0, max_offset + 1):
|
|
|
|
if temp[i]:
|
|
|
|
list.append(temp[i])
|
2005-02-08 02:11:14 +00:00
|
|
|
|
2018-07-05 14:17:39 +01:00
|
|
|
return iter(list);
|
2005-02-08 02:11:14 +00:00
|
|
|
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def functionIterateAll(self):
|
2018-07-06 11:20:26 +01:00
|
|
|
return self.functions_by_name.values()
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2005-02-01 00:28:47 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def enumIterateByName(self):
|
2018-07-06 11:17:50 +01:00
|
|
|
keys = sorted(self.enums_by_name.keys())
|
2005-02-01 00:28:47 +00:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
list = []
|
|
|
|
for enum in keys:
|
|
|
|
list.append( self.enums_by_name[ enum ] )
|
2005-02-01 00:28:47 +00:00
|
|
|
|
2018-07-05 14:17:39 +01:00
|
|
|
return iter(list)
|
2005-02-01 00:28:47 +00:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def categoryIterate(self):
|
|
|
|
"""Iterate over categories.
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
Iterate over all known categories in the order specified by
|
|
|
|
classify_category. Each iterated value is a tuple of the
|
|
|
|
name and number (which may be None) of the category.
|
|
|
|
"""
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
list = []
|
|
|
|
for cat_type in range(0,4):
|
2018-07-06 11:17:50 +01:00
|
|
|
keys = sorted(self.categories[cat_type].keys())
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
for key in keys:
|
|
|
|
list.append(self.categories[cat_type][key])
|
2006-10-04 21:45:59 +01:00
|
|
|
|
2018-07-05 14:17:39 +01:00
|
|
|
return iter(list)
|
2006-10-04 21:45:59 +01:00
|
|
|
|
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def get_category_for_name( self, name ):
|
2018-07-05 14:17:35 +01:00
|
|
|
if name in self.category_dict:
|
2012-10-10 15:20:57 +01:00
|
|
|
return self.category_dict[name]
|
|
|
|
else:
|
|
|
|
return ["<unknown category>", None]
|
2004-05-18 19:33:40 +01:00
|
|
|
|
2004-05-20 00:33:08 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def typeIterate(self):
|
2018-07-06 11:20:26 +01:00
|
|
|
return self.types_by_name.values()
|
2004-05-20 00:33:08 +01:00
|
|
|
|
Mammoth update to the Python code generator scripts that live in
src/mesa/glapi. Basically, the scripts that did simple things (like
gl_offsets.py) were simple, and the scripts that did more complicated things
(like glX_proto_send.py) were getting progressively more and more out of
control. So, I re-write the foundation classes on which everything is based.
One problem with the existing code is that the division between the GL API
database representation and the way the output code is generated was either
blury or nonexistant. The new code somewhat follows the
Model-View-Controller pattern, minus the Controller. There is a distinct
set of classes that model the API data, and there is a distinct set of
classes that generate code from that data.
One big change is in the class that represents GL functions (was glFunction,
is now gl_function). There used to be an instance of this calls for each
function and for each alias to that function. For example, there was an
instance for PointParameterivSGIS, PointParameterivEXT, PointParameterivARB,
and PointParameteriv. In the new code, there is one instance. Each
instance has a list of entrypoint names for the function. In the next
revision, this will allow a couple useful things. The script will be able
to verify that the parameters, return type, and GLX protocol for a function
and all it's aliases match.
It will also allow aliases to be represented in the XML more compactly.
Instead of repeating all the information, an alias can be listed as:
<function name="PointParameterivARB" alias="PointParameterivEXT"/>
Because the data representation was changed, the order that the alias
functions are processed by the scripts also changed. This accounts for at
least 2,700 of the ~3,600 lines of diffs in the generated code.
Most of the remaining ~900 lines of diffs are the result of bugs *fixed* by
the new scripts. The old scripts also generated code with some bugs in it.
These bugs were discovered while the new code was being written.
These changes were discussed on the mesa3d-dev mailing list back at the end
of May:
http://marc.theaimsgroup.com/?t=111714569000004&r=1&w=2
Xorg bug: 3197, 3208
2005-06-22 00:42:43 +01:00
|
|
|
|
2012-10-10 15:20:57 +01:00
|
|
|
def find_type( self, type_name ):
|
|
|
|
if type_name in self.types_by_name:
|
|
|
|
return self.types_by_name[ type_name ].type_expr
|
|
|
|
else:
|
2018-07-05 14:17:32 +01:00
|
|
|
print("Unable to find base type matching \"%s\"." % (type_name))
|
2012-10-10 15:20:57 +01:00
|
|
|
return None
|