summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2004-12-01 00:29:48 +0000
committerIan Romanick <[email protected]>2004-12-01 00:29:48 +0000
commit4f0a75e7241ca1545b67ccabe007b94c8cf9b429 (patch)
tree1c20d488c79ee8e45d379f8fc172adb9eedb8453
parent9001d673094b884e91a65389699b104a715f8203 (diff)
Added the ability to get the size of a parameter as a string. Changed the
meaning of "variable length array" to include variables that are "counted" instead of just ones that use an enum to map to a count. Added glParameter to the glItemFactory.
-rw-r--r--src/mesa/glapi/gl_XML.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py
index 55bbddafa5b..79da5abab9b 100644
--- a/src/mesa/glapi/gl_XML.py
+++ b/src/mesa/glapi/gl_XML.py
@@ -193,7 +193,7 @@ class glParameter( glItem ):
to glCallLists, are not variable length arrays in this
sense."""
- return self.p_count_parameters != None
+ return (self.p_count_parameters != None) or (self.counter != None)
def is_array(self):
@@ -211,7 +211,7 @@ class glParameter( glItem ):
glDeleteTextures), or a general variable length vector."""
if self.is_array():
- if self.is_variable_length_array():
+ if self.p_count_parameters != None:
return "compsize"
elif self.counter != None:
return self.counter
@@ -222,13 +222,32 @@ class glParameter( glItem ):
def size(self):
- if self.is_variable_length_array():
+ if self.p_count_parameters != None or self.counter != None or self.is_output:
return 0
elif self.p_count == 0:
return self.p_type.size
else:
return self.p_type.size * self.p_count
+ def size_string(self):
+ s = self.size()
+ if s == 0:
+ a_prod = "compsize"
+ b_prod = self.p_type.size
+
+ if self.p_count_parameters == None and self.counter != None:
+ a_prod = self.counter
+ elif self.p_count_parameters != None and self.counter == None:
+ pass
+ elif self.p_count_parameters != None and self.counter != None:
+ b_prod = self.counter
+ else:
+ raise RuntimeError("Parameter '%s' to function '%s' has size 0." % (self.name, self.context.name))
+
+ return "(%s * %s)" % (a_prod, b_prod)
+ else:
+ return str(s)
+
class glParameterIterator:
"""Class to iterate over a list of glParameters.
@@ -283,7 +302,7 @@ class glFunction( glItem ):
def startElement(self, name, attrs):
if name == "param":
try:
- glParameter(self, name, attrs)
+ self.context.factory.create(self, name, attrs)
except RuntimeError:
print "Error with parameter '%s' in function '%s'." \
% (attrs.get('name','(unknown)'), self.name)
@@ -326,6 +345,8 @@ class glItemFactory:
return glType(context, name, attrs)
elif name == "enum":
return glEnum(context, name, attrs)
+ elif name == "param":
+ return glParameter(context, name, attrs)
else:
return None