X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fglapi%2FglX_XML.py;h=4c2e0f95bf4ff3a7763cd94a5725b2b172b94d02;hb=8398535331dae39ff5f52e94a69abdbf7507a343;hp=7cc9d8d6649313e309ea50bad21f6a527d3b1d5e;hpb=8ef0519bbe0318920170e82b6b52853920a897c4;p=mesa.git diff --git a/src/mesa/glapi/glX_XML.py b/src/mesa/glapi/glX_XML.py index 7cc9d8d6649..4c2e0f95bf4 100644 --- a/src/mesa/glapi/glX_XML.py +++ b/src/mesa/glapi/glX_XML.py @@ -81,6 +81,8 @@ class glx_function(gl_XML.gl_function): 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 @@ -113,10 +115,16 @@ class glx_function(gl_XML.gl_function): 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 @@ -129,53 +137,47 @@ class glx_function(gl_XML.gl_function): 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 @@ -264,7 +266,7 @@ class glx_function(gl_XML.gl_function): 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 ): @@ -333,7 +335,7 @@ class glx_function(gl_XML.gl_function): 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: @@ -447,6 +449,13 @@ class glx_function(gl_XML.gl_function): 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 @@ -505,6 +514,35 @@ class glx_function(gl_XML.gl_function): 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""" @@ -519,10 +557,11 @@ class glx_function_iterator: 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):