self.glx_sop = 0
self.glx_vendorpriv = 0
+ self.glx_vendorpriv_names = []
+
# If this is set to true, it means that GLdouble parameters should be
# written to the GLX protocol packet in the order they appear in the
# prototype. This is different from the "classic" ordering. In the
def process_element(self, element):
gl_XML.gl_function.process_element(self, element)
- self.vectorequiv = element.nsProp( "vectorequiv", None )
+ # If the function already has a vector equivalent set, don't
+ # set it again. This can happen if an alias to a function
+ # appears after the function that it aliases.
+
+ if not self.vectorequiv:
+ self.vectorequiv = element.nsProp("vectorequiv", None)
- if element.nsProp( "name", None ) == self.name:
+ name = element.nsProp("name", None)
+ if name == self.name:
for param in self.parameters:
self.parameters_by_name[ param.name ] = param
child = element.children
while child:
- if child.type == "element":
- if child.name == "glx":
- rop = child.nsProp( 'rop', None )
- sop = child.nsProp( 'sop', None )
- vop = child.nsProp( 'vendorpriv', None )
-
- if rop:
- self.glx_rop = int(rop)
- else:
- self.glx_rop = 0
-
- if sop:
- self.glx_sop = int(sop)
- else:
- self.glx_sop = 0
-
- if vop:
- self.glx_vendorpriv = int(vop)
- else:
- self.glx_vendorpriv = 0
-
- self.img_reset = child.nsProp( 'img_reset', None )
-
- # The 'handcode' attribute can be one of 'true',
- # 'false', 'client', or 'server'.
-
- handcode = child.nsProp( 'handcode', None )
- if handcode == "false":
- self.server_handcode = 0
- self.client_handcode = 0
- elif handcode == "true":
- self.server_handcode = 1
- self.client_handcode = 1
- elif handcode == "client":
- self.server_handcode = 0
- self.client_handcode = 1
- elif handcode == "server":
- self.server_handcode = 1
- self.client_handcode = 0
- else:
- raise RuntimeError('Invalid handcode mode "%s" in function "%s".' % (handcode, self.name))
-
- self.ignore = gl_XML.is_attr_true( child, 'ignore' )
- self.can_be_large = gl_XML.is_attr_true( child, 'large' )
- self.glx_doubles_in_order = gl_XML.is_attr_true( child, 'doubles_in_order' )
- self.reply_always_array = gl_XML.is_attr_true( child, 'always_array' )
- self.dimensions_in_reply = gl_XML.is_attr_true( child, 'dimensions_in_reply' )
+ if child.type == "element" and child.name == "glx":
+ rop = child.nsProp( 'rop', None )
+ sop = child.nsProp( 'sop', None )
+ vop = child.nsProp( 'vendorpriv', None )
+
+ if rop:
+ self.glx_rop = int(rop)
+
+ if sop:
+ self.glx_sop = int(sop)
+
+ if vop:
+ self.glx_vendorpriv = int(vop)
+ self.glx_vendorpriv_names.append(name)
+
+ self.img_reset = child.nsProp( 'img_reset', None )
+
+ # The 'handcode' attribute can be one of 'true',
+ # 'false', 'client', or 'server'.
+
+ handcode = child.nsProp( 'handcode', None )
+ if handcode == "false":
+ self.server_handcode = 0
+ self.client_handcode = 0
+ elif handcode == "true":
+ self.server_handcode = 1
+ self.client_handcode = 1
+ elif handcode == "client":
+ self.server_handcode = 0
+ self.client_handcode = 1
+ elif handcode == "server":
+ self.server_handcode = 1
+ self.client_handcode = 0
+ else:
+ raise RuntimeError('Invalid handcode mode "%s" in function "%s".' % (handcode, self.name))
+
+ self.ignore = gl_XML.is_attr_true( child, 'ignore' )
+ self.can_be_large = gl_XML.is_attr_true( child, 'large' )
+ self.glx_doubles_in_order = gl_XML.is_attr_true( child, 'doubles_in_order' )
+ self.reply_always_array = gl_XML.is_attr_true( child, 'always_array' )
+ self.dimensions_in_reply = gl_XML.is_attr_true( child, 'dimensions_in_reply' )
child = child.next
if param.name != self.img_reset:
param.offset = offset
- if not param.is_variable_length():
+ if not param.is_variable_length() and not param.is_client_only:
offset += param.size()
if self.pad_after( param ):
size = 0
for param in self.parameterIterateGlxSend(0):
- if param.name != self.img_reset:
+ if param.name != self.img_reset and not param.is_client_only:
if size == 0:
size = param.offset + param.size()
else:
raise RuntimeError('Function "%s" has no opcode.' % (self.name))
+ def opcode_vendor_name(self, name):
+ if name in self.glx_vendorpriv_names:
+ return "X_GLvop_%s" % (name)
+ else:
+ raise RuntimeError('Function "%s" has no VendorPrivate opcode.' % (name))
+
+
def opcode_real_name(self):
"""Get the true protocol enum name for the GLX opcode
return None
+ def has_different_protocol(self, name):
+ """Returns true if the named version of the function uses different protocol from the other versions.
+
+ Some functions, such as glDeleteTextures and
+ glDeleteTexturesEXT are functionally identical, but have
+ different protocol. This function returns true if the
+ named function is an alias name and that named version uses
+ different protocol from the function that is aliased.
+ """
+
+ return (name in self.glx_vendorpriv_names) and self.glx_sop
+
+
+ def static_glx_name(self, name):
+ if self.has_different_protocol(name):
+ for n in self.glx_vendorpriv_names:
+ if n in self.static_entry_points:
+ return n
+
+ return self.static_name(name)
+
+
+ def client_supported_for_indirect(self):
+ """Returns true if the function is supported on the client
+ side for indirect rendering."""
+
+ return not self.ignore and (self.offset != -1) and (self.glx_rop or self.glx_sop or self.glx_vendorpriv or self.vectorequiv or self.client_handcode)
+
+
class glx_function_iterator:
"""Class to iterate over a list of glXFunctions"""
def next(self):
f = self.iterator.next()
- if f.ignore or not (f.glx_rop or f.glx_sop or f.glx_vendorpriv or f.vectorequiv or f.client_handcode):
- return self.next()
- else:
+
+ if f.client_supported_for_indirect():
return f
+ else:
+ return self.next()
class glx_api(gl_XML.gl_api):