- def startElement(self, name, attrs):
- """Process elements within a function that are specific to GLX."""
-
- if name == "glx":
- self.glx_rop = int(attrs.get('rop', "0"))
- self.glx_sop = int(attrs.get('sop', "0"))
- self.glx_vendorpriv = int(attrs.get('vendorpriv', "0"))
-
- if attrs.get('handcode', "false") == "true":
- self.handcode = 1
- else:
- self.handcode = 0
-
- if attrs.get('ignore', "false") == "true":
- self.ignore = 1
- else:
- self.ignore = 0
-
- if attrs.get('large', "false") == "true":
- self.can_be_large = 1
- else:
- self.can_be_large = 0
-
- if attrs.get('doubles_in_order', "false") == "true":
- self.glx_doubles_in_order = 1
- else:
- self.glx_doubles_in_order = 0
-
- if attrs.get('always_array', "false") == "true":
- self.reply_always_array = 1
- else:
- self.reply_always_array = 0
-
- else:
- gl_XML.glFunction.startElement(self, name, attrs)
-
-
- def append(self, tag_name, p):
- gl_XML.glFunction.append(self, tag_name, p)
-
- if p.is_variable_length_array():
- p.order = 2;
- elif not self.glx_doubles_in_order and p.p_type.size == 8:
- p.order = 0;
-
- if p.p_count_parameters != None:
- self.count_parameters = p.p_count_parameters
-
- if p.is_counter:
- self.counter = p.name
-
- if p.is_output:
- self.output = p
-
- return
-
- def variable_length_parameter(self):
- for param in self.fn_parameters:
- if param.is_variable_length_array():
- return param
-
- return None
-
-
- def command_payload_length(self):
- size = 0
- size_string = ""
- for p in self:
- if p.is_output: continue
- temp = p.size_string()
- try:
- s = int(temp)
- size += s
- except Exception,e:
- size_string = size_string + " + __GLX_PAD(%s)" % (temp)
-
- return [size, size_string]
-
- def command_length(self):
- [size, size_string] = self.command_payload_length()
-
- if self.glx_rop != 0:
- size += 4
-
- size = ((size + 3) & ~3)
- return "%u%s" % (size, size_string)
-
-
- def opcode_real_value(self):
- if self.glx_vendorpriv != 0:
- if self.needs_reply():
- return 17
- else:
- return 16
- else:
- return self.opcode_value()
-
- def opcode_value(self):
- if self.glx_rop != 0:
- return self.glx_rop
- elif self.glx_sop != 0:
- return self.glx_sop
- elif self.glx_vendorpriv != 0:
- return self.glx_vendorpriv
- else:
- return -1
-
- def opcode_rop_basename(self):
- if self.vectorequiv == None:
- return self.name
- else:
- return self.vectorequiv
-
- def opcode_name(self):
- if self.glx_rop != 0:
- return "X_GLrop_%s" % (self.opcode_rop_basename())
- elif self.glx_sop != 0:
- return "X_GLsop_%s" % (self.name)
- elif self.glx_vendorpriv != 0:
- return "X_GLvop_%s" % (self.name)
- else:
- return "ERROR"
-
- def opcode_real_name(self):
- if self.glx_vendorpriv != 0:
- if self.needs_reply():
- return "X_GLXVendorPrivateWithReply"
- else:
- return "X_GLXVendorPrivate"
- else:
- return self.opcode_name()
-
-
- def return_string(self):
- if self.fn_return_type != 'void':
- return "return retval;"
- else:
- return "return;"
-
-
- def needs_reply(self):
- return self.fn_return_type != 'void' or self.output != None
-
-
-class GlxProto(gl_XML.FilterGLAPISpecBase):
- name = "glX_proto_send.py (from Mesa)"