mesa: Move api_exec_es*.c into mesa/main
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 23 Apr 2010 00:26:51 +0000 (20:26 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 27 Apr 2010 23:27:49 +0000 (19:27 -0400)
This requires renaming a few functions to have unique names so that
they can all live within the same driver.

17 files changed:
src/mesa/Makefile
src/mesa/es/Makefile
src/mesa/es/main/APIspec.dtd [deleted file]
src/mesa/es/main/APIspec.py [deleted file]
src/mesa/es/main/APIspec.xml [deleted file]
src/mesa/es/main/APIspecutil.py [deleted file]
src/mesa/es/main/es_generator.py [deleted file]
src/mesa/es/sources.mak
src/mesa/main/APIspec.dtd [new file with mode: 0644]
src/mesa/main/APIspec.py [new file with mode: 0644]
src/mesa/main/APIspec.xml [new file with mode: 0644]
src/mesa/main/APIspecutil.py [new file with mode: 0644]
src/mesa/main/api_exec.h
src/mesa/main/context.c
src/mesa/main/es_generator.py [new file with mode: 0644]
src/mesa/main/remap.h
src/mesa/sources.mak

index 8c0ebf84c4b2122f3931bb141d2604246853dc98..7dcde5275e01f516cab028d2af3aa927a9bb8341 100644 (file)
@@ -24,6 +24,12 @@ default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
        libglapi.a driver_subdirs
 
 
+main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
+       $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
+
+main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
+       $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
+
 
 ######################################################################
 # Helper libraries used by many drivers:
index 8b484853afe7bb8be785e19a1cf30823d5dbf432..b095620c9dab57be4e9aa1cd322394b41341ba51 100644 (file)
@@ -83,17 +83,9 @@ libes2api.a: $(ES2_API_OBJECTS)
        @$(MKLIB) -o es2api -static $(ES2_API_OBJECTS)
 
 GENERATED_SOURCES :=           \
-       main/api_exec_es1.c     \
-       main/api_exec_es2.c     \
        main/get_es1.c          \
        main/get_es2.c
 
-main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
-       $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
-
-main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
-       $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
-
 main/get_es1.c: main/get_gen.py
        $(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
 
diff --git a/src/mesa/es/main/APIspec.dtd b/src/mesa/es/main/APIspec.dtd
deleted file mode 100644 (file)
index efcfa31..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<!ELEMENT apispec (template|api)+>
-
-<!ELEMENT api (category*, function*)>
-<!ELEMENT category EMPTY>
-<!ELEMENT function EMPTY>
-
-<!ELEMENT template (proto, desc*)>
-<!ELEMENT proto (return, (param|vector)*)>
-<!ELEMENT return EMPTY>
-<!ELEMENT param EMPTY>
-<!ELEMENT vector (param*)>
-<!ELEMENT desc ((value|range)*, desc*)>
-<!ELEMENT value EMPTY>
-<!ELEMENT range EMPTY>
-
-<!ATTLIST api      name                NMTOKEN #REQUIRED
-                   implementation      (true | false) "false">
-<!ATTLIST category name                NMTOKEN #REQUIRED>
-<!ATTLIST function name                NMTOKEN #REQUIRED
-                   default_prefix      NMTOKEN "_mesa_"
-                   external            (true | false) "false"
-                   template            NMTOKEN #REQUIRED
-                   gltype              CDATA #IMPLIED
-                   vector_size         NMTOKEN #IMPLIED
-                   expand_vector       (true | false) "false"
-                   skip_desc           (true | false) "false">
-
-<!ATTLIST template name                NMTOKEN #REQUIRED
-                   direction           (set | get) "set">
-
-<!ATTLIST return   type                CDATA #REQUIRED>
-<!ATTLIST param    name                NMTOKEN #REQUIRED
-                   type                CDATA #REQUIRED
-                   hide_if_expanded    (true | false) "false"
-                   category            NMTOKEN #IMPLIED>
-<!ATTLIST vector   name                NMTOKEN #REQUIRED
-                   type                CDATA #REQUIRED
-                   size                NMTOKEN #REQUIRED
-                   category            NMTOKEN #IMPLIED>
-
-<!ATTLIST desc     name                NMTOKEN #REQUIRED
-                   vector_size         CDATA #IMPLIED
-                   convert             (true | false) #IMPLIED
-                   error               NMTOKEN "GL_INVALID_ENUM"
-                   category            NMTOKEN #IMPLIED>
-
-<!ATTLIST value    name                CDATA #REQUIRED
-                   category            NMTOKEN #IMPLIED>
-<!ATTLIST range    from                NMTOKEN #REQUIRED
-                   to                  NMTOKEN #REQUIRED
-                   base                NMTOKEN #IMPLIED
-                   category            NMTOKEN #IMPLIED>
diff --git a/src/mesa/es/main/APIspec.py b/src/mesa/es/main/APIspec.py
deleted file mode 100644 (file)
index 6947f73..0000000
+++ /dev/null
@@ -1,617 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
-#
-# 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.
-"""
-A parser for APIspec.
-"""
-
-class SpecError(Exception):
-    """Error in the spec file."""
-
-
-class Spec(object):
-    """A Spec is an abstraction of the API spec."""
-
-    def __init__(self, doc):
-        self.doc = doc
-
-        self.spec_node = doc.getRootElement()
-        self.tmpl_nodes = {}
-        self.api_nodes = {}
-        self.impl_node = None
-
-        # parse <apispec>
-        node = self.spec_node.children
-        while node:
-            if node.type == "element":
-                if node.name == "template":
-                    self.tmpl_nodes[node.prop("name")] = node
-                elif node.name == "api":
-                    self.api_nodes[node.prop("name")] = node
-                else:
-                    raise SpecError("unexpected node %s in apispec" %
-                            node.name)
-            node = node.next
-
-        # find an implementation
-        for name, node in self.api_nodes.iteritems():
-            if node.prop("implementation") == "true":
-                self.impl_node = node
-                break
-        if not self.impl_node:
-            raise SpecError("unable to find an implementation")
-
-    def get_impl(self):
-        """Return the implementation."""
-        return API(self, self.impl_node)
-
-    def get_api(self, name):
-        """Return an API."""
-        return API(self, self.api_nodes[name])
-
-
-class API(object):
-    """An API consists of categories and functions."""
-
-    def __init__(self, spec, api_node):
-        self.name = api_node.prop("name")
-        self.is_impl = (api_node.prop("implementation") == "true")
-
-        self.categories = []
-        self.functions = []
-
-        # parse <api>
-        func_nodes = []
-        node = api_node.children
-        while node:
-            if node.type == "element":
-                if node.name == "category":
-                    cat = node.prop("name")
-                    self.categories.append(cat)
-                elif node.name == "function":
-                    func_nodes.append(node)
-                else:
-                    raise SpecError("unexpected node %s in api" % node.name)
-            node = node.next
-
-        # realize functions
-        for func_node in func_nodes:
-            tmpl_node = spec.tmpl_nodes[func_node.prop("template")]
-            try:
-                func = Function(tmpl_node, func_node, self.is_impl,
-                                self.categories)
-            except SpecError, e:
-                func_name = func_node.prop("name")
-                raise SpecError("failed to parse %s: %s" % (func_name, e))
-            self.functions.append(func)
-
-    def match(self, func, conversions={}):
-        """Find a matching function in the API."""
-        match = None
-        need_conv = False
-        for f in self.functions:
-            matched, conv = f.match(func, conversions)
-            if matched:
-                match = f
-                need_conv = conv
-                # exact match
-                if not need_conv:
-                    break
-        return (match, need_conv)
-
-
-class Function(object):
-    """Parse and realize a <template> node."""
-
-    def __init__(self, tmpl_node, func_node, force_skip_desc=False, categories=[]):
-        self.tmpl_name = tmpl_node.prop("name")
-        self.direction = tmpl_node.prop("direction")
-
-        self.name = func_node.prop("name")
-        self.prefix = func_node.prop("default_prefix")
-        self.is_external = (func_node.prop("external") == "true")
-
-        if force_skip_desc:
-            self._skip_desc = True
-        else:
-            self._skip_desc = (func_node.prop("skip_desc") == "true")
-
-        self._categories = categories
-
-        # these attributes decide how the template is realized
-        self._gltype = func_node.prop("gltype")
-        if func_node.hasProp("vector_size"):
-            self._vector_size = int(func_node.prop("vector_size"))
-        else:
-            self._vector_size = 0
-        self._expand_vector = (func_node.prop("expand_vector") == "true")
-
-        self.return_type = "void"
-        param_nodes = []
-
-        # find <proto>
-        proto_node = tmpl_node.children
-        while proto_node:
-            if proto_node.type == "element" and proto_node.name == "proto":
-                break
-            proto_node = proto_node.next
-        if not proto_node:
-            raise SpecError("no proto")
-        # and parse it
-        node = proto_node.children
-        while node:
-            if node.type == "element":
-                if node.name == "return":
-                    self.return_type = node.prop("type")
-                elif node.name == "param" or node.name == "vector":
-                    if self.support_node(node):
-                        # make sure the node is not hidden
-                        if not (self._expand_vector and
-                                (node.prop("hide_if_expanded") == "true")):
-                            param_nodes.append(node)
-                else:
-                    raise SpecError("unexpected node %s in proto" % node.name)
-            node = node.next
-
-        self._init_params(param_nodes)
-        self._init_descs(tmpl_node, param_nodes)
-
-    def __str__(self):
-        return "%s %s%s(%s)" % (self.return_type, self.prefix, self.name,
-                self.param_string(True))
-
-    def _init_params(self, param_nodes):
-        """Parse and initialize parameters."""
-        self.params = []
-
-        for param_node in param_nodes:
-            size = self.param_node_size(param_node)
-            # when no expansion, vector is just like param
-            if param_node.name == "param" or not self._expand_vector:
-                param = Parameter(param_node, self._gltype, size)
-                self.params.append(param)
-                continue
-
-            if not size or size > param_node.lsCountNode():
-                raise SpecError("could not expand %s with unknown or "
-                                "mismatch sizes" % param.name)
-
-            # expand the vector
-            expanded_params = []
-            child = param_node.children
-            while child:
-                if (child.type == "element" and child.name == "param" and
-                    self.support_node(child)):
-                    expanded_params.append(Parameter(child, self._gltype))
-                    if len(expanded_params) == size:
-                        break
-                child = child.next
-            # just in case that lsCountNode counts unknown nodes
-            if len(expanded_params) < size:
-                raise SpecError("not enough named parameters")
-
-            self.params.extend(expanded_params)
-
-    def _init_descs(self, tmpl_node, param_nodes):
-        """Parse and initialize parameter descriptions."""
-        self.checker = Checker()
-        if self._skip_desc:
-            return
-
-        node = tmpl_node.children
-        while node:
-            if node.type == "element" and node.name == "desc":
-                if self.support_node(node):
-                    # parse <desc>
-                    desc = Description(node, self._categories)
-                    self.checker.add_desc(desc)
-            node = node.next
-
-        self.checker.validate(self, param_nodes)
-
-    def support_node(self, node):
-        """Return true if a node is in the supported category."""
-        return (not node.hasProp("category") or
-                node.prop("category") in self._categories)
-
-    def get_param(self, name):
-        """Return the named parameter."""
-        for param in self.params:
-            if param.name == name:
-                return param
-        return None
-
-    def param_node_size(self, param):
-        """Return the size of a vector."""
-        if param.name != "vector":
-            return 0
-
-        size = param.prop("size")
-        if size.isdigit():
-            size = int(size)
-        else:
-            size = 0
-        if not size:
-            size = self._vector_size
-            if not size and self._expand_vector:
-                # return the number of named parameters
-                size = param.lsCountNode()
-        return size
-
-    def param_string(self, declaration):
-        """Return the C code of the parameters."""
-        args = []
-        if declaration:
-            for param in self.params:
-                sep = "" if param.type.endswith("*") else " "
-                args.append("%s%s%s" % (param.type, sep, param.name))
-            if not args:
-                args.append("void")
-        else:
-            for param in self.params:
-                args.append(param.name)
-        return ", ".join(args)
-
-    def match(self, other, conversions={}):
-        """Return true if the functions match, probably with a conversion."""
-        if (self.tmpl_name != other.tmpl_name or
-            self.return_type != other.return_type or
-            len(self.params) != len(other.params)):
-            return (False, False)
-
-        need_conv = False
-        for i in xrange(len(self.params)):
-            src = other.params[i]
-            dst = self.params[i]
-            if (src.is_vector != dst.is_vector or src.size != dst.size):
-                return (False, False)
-            if src.type != dst.type:
-                if dst.base_type() in conversions.get(src.base_type(), []):
-                    need_conv = True
-                else:
-                    # unable to convert
-                    return (False, False)
-
-        return (True, need_conv)
-
-
-class Parameter(object):
-    """A parameter of a function."""
-
-    def __init__(self, param_node, gltype=None, size=0):
-        self.is_vector = (param_node.name == "vector")
-
-        self.name = param_node.prop("name")
-        self.size = size
-
-        type = param_node.prop("type")
-        if gltype:
-            type = type.replace("GLtype", gltype)
-        elif type.find("GLtype") != -1:
-            raise SpecError("parameter %s has unresolved type" % self.name)
-
-        self.type = type
-
-    def base_type(self):
-        """Return the base GL type by stripping qualifiers."""
-        return [t for t in self.type.split(" ") if t.startswith("GL")][0]
-
-
-class Checker(object):
-    """A checker is the collection of all descriptions on the same level.
-    Descriptions of the same parameter are concatenated.
-    """
-
-    def __init__(self):
-        self.switches = {}
-        self.switch_constants = {}
-
-    def add_desc(self, desc):
-        """Add a description."""
-        # TODO allow index to vary
-        const_attrs = ["index", "error", "convert", "size_str"]
-        if desc.name not in self.switches:
-            self.switches[desc.name] = []
-            self.switch_constants[desc.name] = {}
-            for attr in const_attrs:
-                self.switch_constants[desc.name][attr] = None
-
-        # some attributes, like error code, should be the same for all descs
-        consts = self.switch_constants[desc.name]
-        for attr in const_attrs:
-            if getattr(desc, attr) is not None:
-                if (consts[attr] is not None and
-                    consts[attr] != getattr(desc, attr)):
-                    raise SpecError("mismatch %s for %s" % (attr, desc.name))
-                consts[attr] = getattr(desc, attr)
-
-        self.switches[desc.name].append(desc)
-
-    def validate(self, func, param_nodes):
-        """Validate the checker against a function."""
-        tmp = Checker()
-
-        for switch in self.switches.itervalues():
-            valid_descs = []
-            for desc in switch:
-                if desc.validate(func, param_nodes):
-                    valid_descs.append(desc)
-            # no possible values
-            if not valid_descs:
-                return False
-            for desc in valid_descs:
-                if not desc._is_noop:
-                    tmp.add_desc(desc)
-
-        self.switches = tmp.switches
-        self.switch_constants = tmp.switch_constants
-        return True
-
-    def flatten(self, name=None):
-        """Return a flat list of all descriptions of the named parameter."""
-        flat_list = []
-        for switch in self.switches.itervalues():
-            for desc in switch:
-                if not name or desc.name == name:
-                    flat_list.append(desc)
-                flat_list.extend(desc.checker.flatten(name))
-        return flat_list
-
-    def always_check(self, name):
-        """Return true if the parameter is checked in all possible pathes."""
-        if name in self.switches:
-            return True
-
-        # a param is always checked if any of the switch always checks it
-        for switch in self.switches.itervalues():
-            # a switch always checks it if all of the descs always check it
-            always = True
-            for desc in switch:
-                if not desc.checker.always_check(name):
-                    always = False
-                    break
-            if always:
-                return True
-        return False
-
-    def _c_switch(self, name, indent="\t"):
-        """Output C switch-statement for the named parameter, for debug."""
-        switch = self.switches.get(name, [])
-        # make sure there are valid values
-        need_switch = False
-        for desc in switch:
-            if desc.values:
-                need_switch = True
-        if not need_switch:
-            return []
-
-        stmts = []
-        var = switch[0].name
-        if switch[0].index >= 0:
-            var += "[%d]" % switch[0].index
-        stmts.append("switch (%s) { /* assume GLenum */" % var)
-
-        for desc in switch:
-            if desc.values:
-                for val in desc.values:
-                    stmts.append("case %s:" % val)
-                for dep_name in desc.checker.switches.iterkeys():
-                    dep_stmts = [indent + s for s in desc.checker._c_switch(dep_name, indent)]
-                    stmts.extend(dep_stmts)
-                stmts.append(indent + "break;")
-
-        stmts.append("default:")
-        stmts.append(indent + "ON_ERROR(%s);" % switch[0].error);
-        stmts.append(indent + "break;")
-        stmts.append("}")
-
-        return stmts
-
-    def dump(self, indent="\t"):
-        """Dump the descriptions in C code."""
-        stmts = []
-        for name in self.switches.iterkeys():
-            c_switch = self._c_switch(name)
-            print "\n".join(c_switch)
-
-
-class Description(object):
-    """A description desribes a parameter and its relationship with other
-    parameters.
-    """
-
-    def __init__(self, desc_node, categories=[]):
-        self._categories = categories
-        self._is_noop = False
-
-        self.name = desc_node.prop("name")
-        self.index = -1
-
-        self.error = desc_node.prop("error") or "GL_INVALID_ENUM"
-        # vector_size may be C code
-        self.size_str = desc_node.prop("vector_size")
-
-        self._has_enum = False
-        self.values = []
-        dep_nodes = []
-
-        # parse <desc>
-        valid_names = ["value", "range", "desc"]
-        node = desc_node.children
-        while node:
-            if node.type == "element":
-                if node.name in valid_names:
-                    # ignore nodes that require unsupported categories
-                    if (node.prop("category") and
-                        node.prop("category") not in self._categories):
-                        node = node.next
-                        continue
-                else:
-                    raise SpecError("unexpected node %s in desc" % node.name)
-
-                if node.name == "value":
-                    val = node.prop("name")
-                    if not self._has_enum and val.startswith("GL_"):
-                        self._has_enum = True
-                    self.values.append(val)
-                elif node.name == "range":
-                    first = int(node.prop("from"))
-                    last = int(node.prop("to"))
-                    base = node.prop("base") or ""
-                    if not self._has_enum and base.startswith("GL_"):
-                        self._has_enum = True
-                    # expand range
-                    for i in xrange(first, last + 1):
-                        self.values.append("%s%d" % (base, i))
-                else: # dependent desc
-                    dep_nodes.append(node)
-            node = node.next
-
-        # default to convert if there is no enum
-        self.convert = not self._has_enum
-        if desc_node.hasProp("convert"):
-            self.convert = (desc_node.prop("convert") == "true")
-
-        self._init_deps(dep_nodes)
-
-    def _init_deps(self, dep_nodes):
-        """Parse and initialize dependents."""
-        self.checker = Checker()
-
-        for dep_node in dep_nodes:
-            # recursion!
-            dep = Description(dep_node, self._categories)
-            self.checker.add_desc(dep)
-
-    def _search_param_node(self, param_nodes, name=None):
-        """Search the template parameters for the named node."""
-        param_node = None
-        param_index = -1
-
-        if not name:
-            name = self.name
-        for node in param_nodes:
-            if name == node.prop("name"):
-                param_node = node
-            elif node.name == "vector":
-                child = node.children
-                idx = 0
-                while child:
-                    if child.type == "element" and child.name == "param":
-                        if name == child.prop("name"):
-                            param_node = node
-                            param_index = idx
-                            break
-                        idx += 1
-                    child = child.next
-            if param_node:
-                break
-        return (param_node, param_index)
-
-    def _find_final(self, func, param_nodes):
-        """Find the final parameter."""
-        param = func.get_param(self.name)
-        param_index = -1
-
-        # the described param is not in the final function
-        if not param:
-            # search the template parameters
-            node, index = self._search_param_node(param_nodes)
-            if not node:
-                raise SpecError("invalid desc %s in %s" %
-                        (self.name, func.name))
-
-            # a named parameter of a vector
-            if index >= 0:
-                param = func.get_param(node.prop("name"))
-                param_index = index
-            elif node.name == "vector":
-                # must be an expanded vector, check its size
-                if self.size_str and self.size_str.isdigit():
-                    size = int(self.size_str)
-                    expanded_size = func.param_node_size(node)
-                    if size != expanded_size:
-                        return (False, None, -1)
-            # otherwise, it is a valid, but no-op, description
-
-        return (True, param, param_index)
-
-    def validate(self, func, param_nodes):
-        """Validate a description against certain function."""
-        if self.checker.switches and not self.values:
-            raise SpecError("no valid values for %s" % self.name)
-
-        valid, param, param_index = self._find_final(func, param_nodes)
-        if not valid:
-            return False
-
-        # the description is valid, but the param is gone
-        # mark it no-op so that it will be skipped
-        if not param:
-            self._is_noop = True
-            return True
-
-        if param.is_vector:
-            # if param was known, this should have been done in __init__
-            if self._has_enum:
-                self.size_str = "1"
-            # size mismatch
-            if (param.size and self.size_str and self.size_str.isdigit() and
-                param.size != int(self.size_str)):
-                return False
-        elif self.size_str:
-            # only vector accepts vector_size
-            raise SpecError("vector_size is invalid for %s" % param.name)
-
-        if not self.checker.validate(func, param_nodes):
-            return False
-
-        # update the description
-        self.name = param.name
-        self.index = param_index
-
-        return True
-
-
-def main():
-    import libxml2
-
-    filename = "APIspec.xml"
-    apinames = ["GLES1.1", "GLES2.0"]
-
-    doc = libxml2.readFile(filename, None,
-            libxml2.XML_PARSE_DTDLOAD +
-            libxml2.XML_PARSE_DTDVALID +
-            libxml2.XML_PARSE_NOBLANKS)
-
-    spec = Spec(doc)
-    impl = spec.get_impl()
-    for apiname in apinames:
-        spec.get_api(apiname)
-
-    doc.freeDoc()
-
-    print "%s is successfully parsed" % filename
-
-
-if __name__ == "__main__":
-    main()
diff --git a/src/mesa/es/main/APIspec.xml b/src/mesa/es/main/APIspec.xml
deleted file mode 100644 (file)
index 7e77eb7..0000000
+++ /dev/null
@@ -1,4336 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE apispec SYSTEM "APIspec.dtd">
-
-<!-- A function is generated from a template.  Multiple functions can be
-     generated from a single template with different arguments.  For example,
-     glColor3f can be generated from
-
-     <function name="Color3f" template="Color" gltype="GLfloat" vector_size="3" expand_vector="true"/>
-
-     and glColor4iv can be generated from
-
-     <function name="Color4iv" template="Color" gltype="GLint" vector_size="4"/>
-
-     In a template, there are <desc>s that describe the properties of
-     parameters.  A <desc> can enumerate the valid values of a parameter.  It
-     can also specify the error code when an invalid value is given, and etc.
-     By nesting <desc>s, they can create dependency between parameters.
-
-     A function can be marked as external.  It means that the function cannot
-     be dispatched to the corresponding mesa function, if one exists, directly,
-     and requires an external implementation.
--->
-
-<apispec>
-
-<template name="Color">
-       <proto>
-               <return type="void"/>
-               <vector name="v" type="const GLtype *" size="dynamic">
-                       <param name="red" type="GLtype"/>
-                       <param name="green" type="GLtype"/>
-                       <param name="blue" type="GLtype"/>
-                       <param name="alpha" type="GLtype"/>
-               </vector>
-       </proto>
-</template>
-
-<template name="ClipPlane">
-       <proto>
-               <return type="void"/>
-               <param name="plane" type="GLenum"/>
-               <vector name="equation" type="const GLtype *" size="4"/>
-       </proto>
-
-       <desc name="plane">
-               <range base="GL_CLIP_PLANE" from="0" to="5"/>
-       </desc>
-</template>
-
-<template name="CullFace">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_FRONT"/>
-               <value name="GL_BACK"/>
-               <value name="GL_FRONT_AND_BACK"/>
-       </desc>
-</template>
-
-<template name="Fog">
-       <proto>
-               <return type="void"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="const GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-        <desc name="pname">
-               <value name="GL_FOG_MODE"/>
-               <desc name="param">
-                       <value name="GL_EXP"/>
-                       <value name="GL_EXP2"/>
-                       <value name="GL_LINEAR"/>
-               </desc>
-        </desc>
-
-       <desc name="pname">
-               <value name="GL_FOG_COLOR"/>
-
-               <desc name="params" vector_size="4"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_FOG_DENSITY"/>
-               <value name="GL_FOG_START"/>
-               <value name="GL_FOG_END"/>
-
-               <desc name="params" vector_size="1"/>
-       </desc>
-</template>
-
-<template name="FrontFace">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_CW"/>
-               <value name="GL_CCW"/>
-       </desc>
-</template>
-
-<template name="Hint">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="mode" type="GLenum"/>
-       </proto>
-
-       <desc name="target" category="GLES1.1">
-               <value name="GL_FOG_HINT"/>
-               <value name="GL_LINE_SMOOTH_HINT"/>
-               <value name="GL_PERSPECTIVE_CORRECTION_HINT"/>
-               <value name="GL_POINT_SMOOTH_HINT"/>
-       </desc>
-       <desc name="target" category="OES_standard_derivatives">
-               <value name="GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES"/>
-       </desc>
-       <desc name="target">
-               <value name="GL_GENERATE_MIPMAP_HINT"/>
-       </desc>
-
-       <desc name="mode">
-               <value name="GL_FASTEST"/>
-               <value name="GL_NICEST"/>
-               <value name="GL_DONT_CARE"/>
-       </desc>
-</template>
-
-<template name="Light">
-       <proto>
-               <return type="void"/>
-               <param name="light" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="const GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="light">
-               <range base="GL_LIGHT" from="0" to="7"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_AMBIENT"/>
-               <value name="GL_DIFFUSE"/>
-               <value name="GL_SPECULAR"/>
-               <value name="GL_POSITION"/>
-
-               <desc name="params" vector_size="4"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_SPOT_DIRECTION"/>
-
-               <desc name="params" vector_size="3"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_SPOT_EXPONENT"/>
-               <value name="GL_SPOT_CUTOFF"/>
-               <value name="GL_CONSTANT_ATTENUATION"/>
-               <value name="GL_LINEAR_ATTENUATION"/>
-               <value name="GL_QUADRATIC_ATTENUATION"/>
-
-               <desc name="params" vector_size="1"/>
-       </desc>
-</template>
-
-<template name="LightModel">
-       <proto>
-               <return type="void"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="const GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="pname">
-               <value name="GL_LIGHT_MODEL_AMBIENT"/>
-
-               <desc name="params" vector_size="4"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_LIGHT_MODEL_TWO_SIDE"/>
-               <desc name="param">
-                       <value name="GL_TRUE"/>
-                       <value name="GL_FALSE"/>
-               </desc>
-       </desc>
-</template>
-
-<template name="LineWidth">
-       <proto>
-               <return type="void"/>
-               <param name="width" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="Material">
-       <proto>
-               <return type="void"/>
-               <param name="face" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="const GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="face">
-               <value name="GL_FRONT_AND_BACK"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_AMBIENT"/>
-               <value name="GL_DIFFUSE"/>
-               <value name="GL_AMBIENT_AND_DIFFUSE"/>
-               <value name="GL_SPECULAR"/>
-               <value name="GL_EMISSION"/>
-
-               <desc name="params" vector_size="4"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_SHININESS"/>
-
-               <desc name="params" vector_size="1"/>
-       </desc>
-</template>
-
-<template name="PointSize">
-       <proto>
-               <return type="void"/>
-               <param name="size" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="PointSizePointer">
-       <proto>
-               <return type="void"/>
-               <param name="type" type="GLenum"/>
-               <param name="stride" type="GLsizei"/>
-               <param name="pointer" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="type">
-               <value name="GL_FLOAT"/>
-               <value name="GL_FIXED"/>
-       </desc>
-</template>
-
-<template name="Scissor">
-       <proto>
-               <return type="void"/>
-               <param name="x" type="GLint"/>
-               <param name="y" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-       </proto>
-</template>
-
-<template name="ShadeModel">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_FLAT"/>
-               <value name="GL_SMOOTH"/>
-       </desc>
-</template>
-
-<template name="TexParameter">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="const GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_TEXTURE_WRAP_S"/>
-               <value name="GL_TEXTURE_WRAP_T"/>
-               <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/>
-
-               <desc name="param">
-                       <value name="GL_CLAMP_TO_EDGE"/>
-                       <value name="GL_REPEAT"/>
-                       <value name="GL_MIRRORED_REPEAT" category="GLES2.0"/>
-                       <value name="GL_MIRRORED_REPEAT_OES" category="OES_texture_mirrored_repeat"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_TEXTURE_MIN_FILTER"/>
-
-               <desc name="param">
-                       <value name="GL_NEAREST"/>
-                       <value name="GL_LINEAR"/>
-                       <value name="GL_NEAREST_MIPMAP_NEAREST"/>
-                       <value name="GL_NEAREST_MIPMAP_LINEAR"/>
-                       <value name="GL_LINEAR_MIPMAP_NEAREST"/>
-                       <value name="GL_LINEAR_MIPMAP_LINEAR"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_TEXTURE_MAG_FILTER"/>
-
-               <desc name="param">
-                       <value name="GL_NEAREST"/>
-                       <value name="GL_LINEAR"/>
-               </desc>
-       </desc>
-
-       <desc name="pname" category="GLES1.1">
-               <value name="GL_GENERATE_MIPMAP"/>
-
-               <desc name="param">
-                       <value name="GL_TRUE"/>
-                       <value name="GL_FALSE"/>
-               </desc>
-       </desc>
-
-       <desc name="pname" category="EXT_texture_filter_anisotropic">
-               <value name="GL_TEXTURE_MAX_ANISOTROPY_EXT"/>
-               <desc name="params" vector_size="1"/>
-       </desc>
-
-       <desc name="pname" category="OES_draw_texture">
-               <value name="GL_TEXTURE_CROP_RECT_OES"/>
-               <desc name="params" vector_size="4"/>
-       </desc>
-</template>
-
-<template name="TexImage2D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="internalFormat" type="GLint"/> <!-- should be GLenum -->
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="border" type="GLint"/>
-               <param name="format" type="GLenum"/>
-               <param name="type" type="GLenum"/>
-               <param name="pixels" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
-       </desc>
-
-       <desc name="internalFormat" error="GL_INVALID_VALUE">
-               <value name="GL_ALPHA"/>
-               <value name="GL_RGB"/>
-               <value name="GL_RGBA"/>
-               <value name="GL_LUMINANCE"/>
-               <value name="GL_LUMINANCE_ALPHA"/>
-               <value name="GL_DEPTH_COMPONENT" category="OES_depth_texture"/>
-               <value name="GL_DEPTH_STENCIL_OES" category="OES_packed_depth_stencil"/>
-       </desc>
-
-       <desc name="border" error="GL_INVALID_VALUE">
-               <value name="0"/>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_ALPHA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGB"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGBA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
-                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-                       <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE_ALPHA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format" category="OES_depth_texture">
-               <value name="GL_DEPTH_COMPONENT"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_SHORT"/>
-                       <value name="GL_UNSIGNED_INT"/>
-               </desc>
-       </desc>
-
-       <desc name="format" category="OES_packed_depth_stencil">
-               <value name="GL_DEPTH_STENCIL_OES"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_INT_24_8_OES"/>
-               </desc>
-       </desc>
-</template>
-
-<template name="TexEnv">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="const GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="target" category="OES_point_sprite">
-               <value name="GL_POINT_SPRITE_OES"/>
-
-               <desc name="pname">
-                       <value name="GL_COORD_REPLACE_OES"/>
-               </desc>
-       </desc>
-
-       <desc name="pname" category="OES_point_sprite">
-               <value name="GL_COORD_REPLACE_OES"/>
-
-               <desc name="param">
-                       <value name="GL_TRUE"/>
-                       <value name="GL_FALSE"/>
-               </desc>
-       </desc>
-
-       <desc name="target" category="EXT_texture_lod_bias">
-               <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/>
-
-               <desc name="pname">
-                       <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
-               </desc>
-       </desc>
-
-       <desc name="pname" category="EXT_texture_lod_bias">
-               <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
-               <desc name="params" vector_size="1"/>
-       </desc>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_ENV"/>
-
-               <desc name="pname">
-                       <value name="GL_TEXTURE_ENV_MODE"/>
-                       <value name="GL_COMBINE_RGB"/>
-                       <value name="GL_COMBINE_ALPHA"/>
-                       <value name="GL_RGB_SCALE"/>
-                       <value name="GL_ALPHA_SCALE"/>
-                       <value name="GL_SRC0_RGB"/>
-                       <value name="GL_SRC1_RGB"/>
-                       <value name="GL_SRC2_RGB"/>
-                       <value name="GL_SRC0_ALPHA"/>
-                       <value name="GL_SRC1_ALPHA"/>
-                       <value name="GL_SRC2_ALPHA"/>
-                       <value name="GL_OPERAND0_RGB"/>
-                       <value name="GL_OPERAND1_RGB"/>
-                       <value name="GL_OPERAND2_RGB"/>
-                       <value name="GL_OPERAND0_ALPHA"/>
-                       <value name="GL_OPERAND1_ALPHA"/>
-                       <value name="GL_OPERAND2_ALPHA"/>
-                       <value name="GL_TEXTURE_ENV_COLOR"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_TEXTURE_ENV_MODE"/>
-
-               <desc name="param">
-                       <value name="GL_REPLACE"/>
-                       <value name="GL_MODULATE"/>
-                       <value name="GL_DECAL"/>
-                       <value name="GL_BLEND"/>
-                       <value name="GL_ADD"/>
-                       <value name="GL_COMBINE"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_COMBINE_RGB"/>
-
-               <desc name="param">
-                       <value name="GL_REPLACE"/>
-                       <value name="GL_MODULATE"/>
-                       <value name="GL_ADD"/>
-                       <value name="GL_ADD_SIGNED"/>
-                       <value name="GL_INTERPOLATE"/>
-                       <value name="GL_SUBTRACT"/>
-                       <value name="GL_DOT3_RGB"/>
-                       <value name="GL_DOT3_RGBA"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_COMBINE_ALPHA"/>
-
-               <desc name="param">
-                       <value name="GL_REPLACE"/>
-                       <value name="GL_MODULATE"/>
-                       <value name="GL_ADD"/>
-                       <value name="GL_ADD_SIGNED"/>
-                       <value name="GL_INTERPOLATE"/>
-                       <value name="GL_SUBTRACT"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_RGB_SCALE"/>
-               <value name="GL_ALPHA_SCALE"/>
-
-               <desc name="param" convert="true" error="GL_INVALID_VALUE">
-                       <value name="1.0"/>
-                       <value name="2.0"/>
-                       <value name="4.0"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_SRC0_RGB"/>
-               <value name="GL_SRC1_RGB"/>
-               <value name="GL_SRC2_RGB"/>
-               <value name="GL_SRC0_ALPHA"/>
-               <value name="GL_SRC1_ALPHA"/>
-               <value name="GL_SRC2_ALPHA"/>
-
-               <desc name="param">
-                       <value name="GL_TEXTURE"/>
-                       <value name="GL_CONSTANT"/>
-                       <value name="GL_PRIMARY_COLOR"/>
-                       <value name="GL_PREVIOUS"/>
-
-                       <range base="GL_TEXTURE" from="0" to="31" category="OES_texture_env_crossbar"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_OPERAND0_RGB"/>
-               <value name="GL_OPERAND1_RGB"/>
-               <value name="GL_OPERAND2_RGB"/>
-
-               <desc name="param">
-                       <value name="GL_SRC_COLOR"/>
-                       <value name="GL_ONE_MINUS_SRC_COLOR"/>
-                       <value name="GL_SRC_ALPHA"/>
-                       <value name="GL_ONE_MINUS_SRC_ALPHA"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_OPERAND0_ALPHA"/>
-               <value name="GL_OPERAND1_ALPHA"/>
-               <value name="GL_OPERAND2_ALPHA"/>
-
-               <desc name="param">
-                       <value name="GL_SRC_ALPHA"/>
-                       <value name="GL_ONE_MINUS_SRC_ALPHA"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_TEXTURE_ENV_COLOR"/>
-
-               <desc name="params" vector_size="4"/>
-       </desc>
-</template>
-
-<template name="TexGen">
-       <proto>
-               <return type="void"/>
-               <param name="coord" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="const GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="coord" category="OES_texture_cube_map">
-               <value name="GL_TEXTURE_GEN_STR_OES"/>
-       </desc>
-
-       <desc name="pname" category="OES_texture_cube_map">
-               <value name="GL_TEXTURE_GEN_MODE_OES"/>
-
-               <desc name="param">
-                       <value name="GL_NORMAL_MAP_OES"/>
-                       <value name="GL_REFLECTION_MAP_OES"/>
-               </desc>
-       </desc>
-</template>
-
-<template name="Clear">
-       <proto>
-               <return type="void"/>
-               <param name="mask" type="GLbitfield"/>
-       </proto>
-
-       <desc name="mask" error="GL_INVALID_VALUE">
-               <value name="0"/>
-               <value name="(GL_COLOR_BUFFER_BIT)"/>
-               <value name="(GL_DEPTH_BUFFER_BIT)"/>
-               <value name="(GL_STENCIL_BUFFER_BIT)"/>
-               <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)"/>
-               <value name="(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
-               <value name="(GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
-               <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
-       </desc>
-</template>
-
-<template name="ClearColor">
-       <proto>
-               <return type="void"/>
-               <param name="red" type="GLtype"/>
-               <param name="green" type="GLtype"/>
-               <param name="blue" type="GLtype"/>
-               <param name="alpha" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="ClearStencil">
-       <proto>
-               <return type="void"/>
-               <param name="s" type="GLint"/>
-       </proto>
-</template>
-
-<template name="ClearDepth">
-       <proto>
-               <return type="void"/>
-               <param name="depth" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="StencilMask">
-       <proto>
-               <return type="void"/>
-               <param name="mask" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="StencilMaskSeparate">
-       <proto>
-               <return type="void"/>
-               <param name="face" type="GLenum"/>
-               <param name="mask" type="GLuint"/>
-       </proto>
-
-       <desc name="face">
-               <value name="GL_FRONT"/>
-               <value name="GL_BACK"/>
-               <value name="GL_FRONT_AND_BACK"/>
-       </desc>
-</template>
-
-<template name="ColorMask">
-       <proto>
-               <return type="void"/>
-               <param name="red" type="GLboolean"/>
-               <param name="green" type="GLboolean"/>
-               <param name="blue" type="GLboolean"/>
-               <param name="alpha" type="GLboolean"/>
-       </proto>
-</template>
-
-<template name="DepthMask">
-       <proto>
-               <return type="void"/>
-               <param name="flag" type="GLboolean"/>
-       </proto>
-</template>
-
-<template name="Disable">
-       <proto>
-               <return type="void"/>
-               <param name="cap" type="GLenum"/>
-       </proto>
-
-       <desc name="cap" category="GLES1.1">
-               <value name="GL_NORMALIZE"/>
-               <value name="GL_RESCALE_NORMAL"/>
-
-               <range base="GL_CLIP_PLANE" from="0" to="5"/>
-
-               <value name="GL_FOG"/>
-               <value name="GL_LIGHTING"/>
-               <value name="GL_COLOR_MATERIAL"/>
-
-               <range base="GL_LIGHT" from="0" to="7"/>
-
-               <value name="GL_POINT_SMOOTH"/>
-               <value name="GL_LINE_SMOOTH"/>
-               <value name="GL_CULL_FACE"/>
-               <value name="GL_POLYGON_OFFSET_FILL"/>
-               <value name="GL_MULTISAMPLE"/>
-               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
-               <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
-               <value name="GL_SAMPLE_COVERAGE"/>
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_SCISSOR_TEST"/>
-               <value name="GL_ALPHA_TEST"/>
-               <value name="GL_STENCIL_TEST"/>
-               <value name="GL_DEPTH_TEST"/>
-               <value name="GL_BLEND"/>
-               <value name="GL_DITHER"/>
-               <value name="GL_COLOR_LOGIC_OP"/>
-
-               <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
-               <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
-               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
-       </desc>
-
-       <desc name="cap" category="GLES2.0">
-               <value name="GL_CULL_FACE"/>
-               <value name="GL_SCISSOR_TEST"/>
-               <value name="GL_POLYGON_OFFSET_FILL"/>
-               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
-               <value name="GL_SAMPLE_COVERAGE"/>
-               <value name="GL_STENCIL_TEST"/>
-               <value name="GL_DEPTH_TEST"/>
-               <value name="GL_DITHER"/>
-               <value name="GL_BLEND"/>
-       </desc>
-</template>
-
-<!-- it is exactly the same as Disable -->
-<template name="Enable">
-       <proto>
-               <return type="void"/>
-               <param name="cap" type="GLenum"/>
-       </proto>
-
-       <desc name="cap" category="GLES1.1">
-               <value name="GL_NORMALIZE"/>
-               <value name="GL_RESCALE_NORMAL"/>
-
-               <range base="GL_CLIP_PLANE" from="0" to="5"/>
-
-               <value name="GL_FOG"/>
-               <value name="GL_LIGHTING"/>
-               <value name="GL_COLOR_MATERIAL"/>
-
-               <range base="GL_LIGHT" from="0" to="7"/>
-
-               <value name="GL_POINT_SMOOTH"/>
-               <value name="GL_LINE_SMOOTH"/>
-               <value name="GL_CULL_FACE"/>
-               <value name="GL_POLYGON_OFFSET_FILL"/>
-               <value name="GL_MULTISAMPLE"/>
-               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
-               <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
-               <value name="GL_SAMPLE_COVERAGE"/>
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_SCISSOR_TEST"/>
-               <value name="GL_ALPHA_TEST"/>
-               <value name="GL_STENCIL_TEST"/>
-               <value name="GL_DEPTH_TEST"/>
-               <value name="GL_BLEND"/>
-               <value name="GL_DITHER"/>
-               <value name="GL_COLOR_LOGIC_OP"/>
-
-               <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
-               <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
-               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
-       </desc>
-
-       <desc name="cap" category="GLES2.0">
-               <value name="GL_CULL_FACE"/>
-               <value name="GL_SCISSOR_TEST"/>
-               <value name="GL_POLYGON_OFFSET_FILL"/>
-               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
-               <value name="GL_SAMPLE_COVERAGE"/>
-               <value name="GL_STENCIL_TEST"/>
-               <value name="GL_DEPTH_TEST"/>
-               <value name="GL_DITHER"/>
-               <value name="GL_BLEND"/>
-       </desc>
-</template>
-
-<template name="Finish">
-       <proto>
-               <return type="void"/>
-       </proto>
-</template>
-
-<template name="Flush">
-       <proto>
-               <return type="void"/>
-       </proto>
-</template>
-
-<template name="AlphaFunc">
-       <proto>
-               <return type="void"/>
-               <param name="func" type="GLenum"/>
-               <param name="ref" type="GLtype"/>
-       </proto>
-       <desc name="func">
-               <value name="GL_NEVER"/>
-               <value name="GL_LESS"/>
-               <value name="GL_EQUAL"/>
-               <value name="GL_LEQUAL"/>
-               <value name="GL_GREATER"/>
-               <value name="GL_NOTEQUAL"/>
-               <value name="GL_GEQUAL"/>
-               <value name="GL_ALWAYS"/>
-       </desc>
-</template>
-
-<template name="BlendFunc">
-       <proto>
-               <return type="void"/>
-               <param name="sfactor" type="GLenum"/>
-               <param name="dfactor" type="GLenum"/>
-       </proto>
-
-       <desc name="sfactor">
-               <value name="GL_ZERO"/>
-               <value name="GL_ONE"/>
-               <value name="GL_SRC_COLOR"/>
-               <value name="GL_ONE_MINUS_SRC_COLOR"/>
-               <value name="GL_SRC_ALPHA"/>
-               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
-               <value name="GL_DST_ALPHA"/>
-               <value name="GL_ONE_MINUS_DST_ALPHA"/>
-               <value name="GL_DST_COLOR"/>
-               <value name="GL_ONE_MINUS_DST_COLOR"/>
-               <value name="GL_SRC_ALPHA_SATURATE"/>
-
-               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
-       </desc>
-
-       <desc name="dfactor">
-               <value name="GL_ZERO"/>
-               <value name="GL_ONE"/>
-               <value name="GL_SRC_COLOR"/>
-               <value name="GL_ONE_MINUS_SRC_COLOR"/>
-               <value name="GL_SRC_ALPHA"/>
-               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
-               <value name="GL_DST_ALPHA"/>
-               <value name="GL_ONE_MINUS_DST_ALPHA"/>
-               <value name="GL_DST_COLOR"/>
-               <value name="GL_ONE_MINUS_DST_COLOR"/>
-
-               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
-       </desc>
-</template>
-
-<template name="LogicOp">
-       <proto>
-               <return type="void"/>
-               <param name="opcode" type="GLenum"/>
-       </proto>
-
-       <desc name="opcode">
-               <value name="GL_CLEAR"/>
-               <value name="GL_SET"/>
-               <value name="GL_COPY"/>
-               <value name="GL_COPY_INVERTED"/>
-               <value name="GL_NOOP"/>
-               <value name="GL_INVERT"/>
-               <value name="GL_AND"/>
-               <value name="GL_NAND"/>
-               <value name="GL_OR"/>
-               <value name="GL_NOR"/>
-               <value name="GL_XOR"/>
-               <value name="GL_EQUIV"/>
-               <value name="GL_AND_REVERSE"/>
-               <value name="GL_AND_INVERTED"/>
-               <value name="GL_OR_REVERSE"/>
-               <value name="GL_OR_INVERTED"/>
-       </desc>
-</template>
-
-<template name="StencilFunc">
-       <proto>
-               <return type="void"/>
-               <param name="func" type="GLenum"/>
-               <param name="ref" type="GLint"/>
-               <param name="mask" type="GLuint"/>
-       </proto>
-
-       <desc name="func">
-               <value name="GL_NEVER"/>
-               <value name="GL_LESS"/>
-               <value name="GL_LEQUAL"/>
-               <value name="GL_GREATER"/>
-               <value name="GL_GEQUAL"/>
-               <value name="GL_EQUAL"/>
-               <value name="GL_NOTEQUAL"/>
-               <value name="GL_ALWAYS"/>
-       </desc>
-</template>
-
-<template name="StencilFuncSeparate">
-       <proto>
-               <return type="void"/>
-               <param name="face" type="GLenum"/>
-               <param name="func" type="GLenum"/>
-               <param name="ref" type="GLint"/>
-               <param name="mask" type="GLuint"/>
-       </proto>
-
-       <desc name="face">
-               <value name="GL_FRONT"/>
-               <value name="GL_BACK"/>
-               <value name="GL_FRONT_AND_BACK"/>
-       </desc>
-
-       <desc name="func">
-               <value name="GL_NEVER"/>
-               <value name="GL_LESS"/>
-               <value name="GL_LEQUAL"/>
-               <value name="GL_GREATER"/>
-               <value name="GL_GEQUAL"/>
-               <value name="GL_EQUAL"/>
-               <value name="GL_NOTEQUAL"/>
-               <value name="GL_ALWAYS"/>
-       </desc>
-</template>
-
-<template name="StencilOp">
-       <proto>
-               <return type="void"/>
-               <param name="fail" type="GLenum"/>
-               <param name="zfail" type="GLenum"/>
-               <param name="zpass" type="GLenum"/>
-       </proto>
-
-       <desc name="fail">
-               <value name="GL_KEEP"/>
-               <value name="GL_ZERO"/>
-               <value name="GL_REPLACE"/>
-               <value name="GL_INCR"/>
-               <value name="GL_DECR"/>
-               <value name="GL_INVERT"/>
-               <value name="GL_INCR_WRAP" category="GLES2.0"/>
-               <value name="GL_DECR_WRAP" category="GLES2.0"/>
-               <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/>
-               <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/>
-       </desc>
-
-       <desc name="zfail">
-               <value name="GL_KEEP"/>
-               <value name="GL_ZERO"/>
-               <value name="GL_REPLACE"/>
-               <value name="GL_INCR"/>
-               <value name="GL_DECR"/>
-               <value name="GL_INVERT"/>
-               <value name="GL_INCR_WRAP" category="GLES2.0"/>
-               <value name="GL_DECR_WRAP" category="GLES2.0"/>
-               <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/>
-               <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/>
-       </desc>
-
-       <desc name="zpass">
-               <value name="GL_KEEP"/>
-               <value name="GL_ZERO"/>
-               <value name="GL_REPLACE"/>
-               <value name="GL_INCR"/>
-               <value name="GL_DECR"/>
-               <value name="GL_INVERT"/>
-               <value name="GL_INCR_WRAP" category="GLES2.0"/>
-               <value name="GL_DECR_WRAP" category="GLES2.0"/>
-               <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/>
-               <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/>
-       </desc>
-</template>
-
-<template name="StencilOpSeparate">
-       <proto>
-               <return type="void"/>
-               <param name="face" type="GLenum"/>
-               <param name="fail" type="GLenum"/>
-               <param name="zfail" type="GLenum"/>
-               <param name="zpass" type="GLenum"/>
-       </proto>
-
-       <desc name="face">
-               <value name="GL_FRONT"/>
-               <value name="GL_BACK"/>
-               <value name="GL_FRONT_AND_BACK"/>
-       </desc>
-
-       <desc name="fail">
-               <value name="GL_KEEP"/>
-               <value name="GL_ZERO"/>
-               <value name="GL_REPLACE"/>
-               <value name="GL_INCR"/>
-               <value name="GL_DECR"/>
-               <value name="GL_INVERT"/>
-               <value name="GL_INCR_WRAP"/>
-               <value name="GL_DECR_WRAP"/>
-       </desc>
-
-       <desc name="zfail">
-               <value name="GL_KEEP"/>
-               <value name="GL_ZERO"/>
-               <value name="GL_REPLACE"/>
-               <value name="GL_INCR"/>
-               <value name="GL_DECR"/>
-               <value name="GL_INVERT"/>
-               <value name="GL_INCR_WRAP"/>
-               <value name="GL_DECR_WRAP"/>
-       </desc>
-
-       <desc name="zpass">
-               <value name="GL_KEEP"/>
-               <value name="GL_ZERO"/>
-               <value name="GL_REPLACE"/>
-               <value name="GL_INCR"/>
-               <value name="GL_DECR"/>
-               <value name="GL_INVERT"/>
-               <value name="GL_INCR_WRAP"/>
-               <value name="GL_DECR_WRAP"/>
-       </desc>
-</template>
-
-<template name="DepthFunc">
-       <proto>
-               <return type="void"/>
-               <param name="func" type="GLenum"/>
-       </proto>
-
-       <desc name="func">
-               <value name="GL_NEVER"/>
-               <value name="GL_LESS"/>
-               <value name="GL_EQUAL"/>
-               <value name="GL_LEQUAL"/>
-               <value name="GL_GREATER"/>
-               <value name="GL_NOTEQUAL"/>
-               <value name="GL_GEQUAL"/>
-               <value name="GL_ALWAYS"/>
-       </desc>
-</template>
-
-<template name="PixelStore">
-       <proto>
-               <return type="void"/>
-               <param name="pname" type="GLenum"/>
-               <param name="param" type="GLtype"/>
-       </proto>
-
-       <desc name="pname">
-               <value name="GL_PACK_ALIGNMENT"/>
-               <value name="GL_UNPACK_ALIGNMENT"/>
-       </desc>
-
-       <desc name="param" error="GL_INVALID_VALUE">
-               <value name="1"/>
-               <value name="2"/>
-               <value name="4"/>
-               <value name="8"/>
-       </desc>
-</template>
-
-<template name="ReadPixels" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="x" type="GLint"/>
-               <param name="y" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="format" type="GLenum"/>
-               <param name="type" type="GLenum"/>
-               <param name="pixels" type="GLvoid *"/>
-       </proto>
-
-       <!-- Technically, only two combinations are actually allowed:
-            GL_RGBA/GL_UNSIGNED_BYTE, and some implementation-specific
-            internal preferred combination.  I don't know what that is, so I'm
-            allowing any valid combination for now; the underlying support
-            should fail when necessary.-->
-       <desc name="format">
-               <value name="GL_ALPHA"/>
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGB"/>
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGBA"/>
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
-                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE"/>
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE_ALPHA"/>
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-               </desc>
-       </desc>
-
-       <desc name="format" category="EXT_read_format_bgra">
-               <value name="GL_BGRA_EXT"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT"/>
-                       <value name="GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT"/>
-               </desc>
-       </desc>
-</template>
-
-<template name="GetClipPlane" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="plane" type="GLenum"/>
-               <vector name="equation" type="GLtype *" size="4"/>
-       </proto>
-
-       <desc name="plane">
-               <range base="GL_CLIP_PLANE" from="0" to="5"/>
-       </desc>
-</template>
-
-<template name="GetError" direction="get">
-       <proto>
-               <return type="GLenum"/>
-       </proto>
-</template>
-
-<!-- template for GetFloatv, GetIntegerv, GetBoolean, and GetFixedv -->
-<template name="GetState" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-       <!-- param checking is done in mesa -->
-</template>
-
-<template name="GetLight" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="light" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="light">
-               <range base="GL_LIGHT" from="0" to="7"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_AMBIENT"/>
-               <value name="GL_DIFFUSE"/>
-               <value name="GL_SPECULAR"/>
-               <value name="GL_POSITION"/>
-
-               <desc name="params" vector_size="4"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_SPOT_DIRECTION"/>
-
-               <desc name="params" vector_size="3"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_SPOT_EXPONENT"/>
-               <value name="GL_SPOT_CUTOFF"/>
-               <value name="GL_CONSTANT_ATTENUATION"/>
-               <value name="GL_LINEAR_ATTENUATION"/>
-               <value name="GL_QUADRATIC_ATTENUATION"/>
-
-               <desc name="params" vector_size="1"/>
-       </desc>
-</template>
-
-<template name="GetMaterial" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="face" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="face">
-               <value name="GL_FRONT"/>
-               <value name="GL_BACK"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_SHININESS"/>
-               <desc name="params" vector_size="1"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_AMBIENT"/>
-               <value name="GL_DIFFUSE"/>
-               <value name="GL_AMBIENT_AND_DIFFUSE"/>
-               <value name="GL_SPECULAR"/>
-               <value name="GL_EMISSION"/>
-
-               <desc name="params" vector_size="4"/>
-       </desc>
-</template>
-
-<template name="GetString" direction="get">
-       <proto>
-               <return type="const GLubyte *"/>
-               <param name="name" type="GLenum"/>
-       </proto>
-
-       <desc name="name">
-               <value name="GL_VENDOR"/>
-               <value name="GL_RENDERER"/>
-               <value name="GL_VERSION"/>
-               <value name="GL_EXTENSIONS"/>
-               <value name="GL_SHADING_LANGUAGE_VERSION" category="GLES2.0"/>
-       </desc>
-</template>
-
-<template name="GetTexEnv" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="target" category="OES_point_sprite">
-               <value name="GL_POINT_SPRITE_OES"/>
-               <desc name="pname">
-                       <value name="GL_COORD_REPLACE_OES"/>
-               </desc>
-       </desc>
-
-       <desc name="pname" category="OES_point_sprite">
-               <value name="GL_COORD_REPLACE_OES"/>
-               <desc name="params" vector_size="1" convert="false"/>
-       </desc>
-
-       <desc name="target" category="EXT_texture_lod_bias">
-               <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/>
-
-               <desc name="pname">
-                       <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
-               </desc>
-       </desc>
-
-       <desc name="pname" category="EXT_texture_lod_bias">
-               <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
-               <desc name="params" vector_size="1"/>
-       </desc>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_ENV"/>
-
-               <desc name="pname">
-                       <value name="GL_TEXTURE_ENV_COLOR"/>
-                       <value name="GL_RGB_SCALE"/>
-                       <value name="GL_ALPHA_SCALE"/>
-                       <value name="GL_TEXTURE_ENV_MODE"/>
-                       <value name="GL_COMBINE_RGB"/>
-                       <value name="GL_COMBINE_ALPHA"/>
-                       <value name="GL_SRC0_RGB"/>
-                       <value name="GL_SRC1_RGB"/>
-                       <value name="GL_SRC2_RGB"/>
-                       <value name="GL_SRC0_ALPHA"/>
-                       <value name="GL_SRC1_ALPHA"/>
-                       <value name="GL_SRC2_ALPHA"/>
-                       <value name="GL_OPERAND0_RGB"/>
-                       <value name="GL_OPERAND1_RGB"/>
-                       <value name="GL_OPERAND2_RGB"/>
-                       <value name="GL_OPERAND0_ALPHA"/>
-                       <value name="GL_OPERAND1_ALPHA"/>
-                       <value name="GL_OPERAND2_ALPHA"/>
-               </desc>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_TEXTURE_ENV_COLOR"/>
-               <desc name="params" vector_size="4"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_RGB_SCALE"/>
-               <value name="GL_ALPHA_SCALE"/>
-
-               <desc name="params" vector_size="1"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_TEXTURE_ENV_MODE"/>
-               <value name="GL_COMBINE_RGB"/>
-               <value name="GL_COMBINE_ALPHA"/>
-               <value name="GL_SRC0_RGB"/>
-               <value name="GL_SRC1_RGB"/>
-               <value name="GL_SRC2_RGB"/>
-               <value name="GL_SRC0_ALPHA"/>
-               <value name="GL_SRC1_ALPHA"/>
-               <value name="GL_SRC2_ALPHA"/>
-               <value name="GL_OPERAND0_RGB"/>
-               <value name="GL_OPERAND1_RGB"/>
-               <value name="GL_OPERAND2_RGB"/>
-               <value name="GL_OPERAND0_ALPHA"/>
-               <value name="GL_OPERAND1_ALPHA"/>
-               <value name="GL_OPERAND2_ALPHA"/>
-
-               <desc name="params" vector_size="1" convert="false"/>
-       </desc>
-</template>
-
-<template name="GetTexGen" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="coord" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="coord">
-               <value name="GL_TEXTURE_GEN_STR_OES"/>
-       </desc>
-       <desc name="pname">
-               <value name="GL_TEXTURE_GEN_MODE_OES"/>
-               <desc name="params" vector_size="1" convert="false"/>
-       </desc>
-</template>
-
-<template name="GetTexParameter" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_TEXTURE_WRAP_S"/>
-               <value name="GL_TEXTURE_WRAP_T"/>
-               <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/>
-               <value name="GL_TEXTURE_MIN_FILTER"/>
-               <value name="GL_TEXTURE_MAG_FILTER"/>
-               <value name="GL_GENERATE_MIPMAP" category="GLES1.1"/>
-
-               <desc name="params" vector_size="1" convert="false"/>
-       </desc>
-
-       <desc name="pname" category="OES_draw_texture">
-               <value name="GL_TEXTURE_CROP_RECT_OES"/>
-               <desc name="params" vector_size="4"/>
-       </desc>
-</template>
-
-<template name="IsEnabled" direction="get">
-       <proto>
-               <return type="GLboolean"/>
-               <param name="cap" type="GLenum"/>
-       </proto>
-
-       <desc name="cap" category="GLES1.1">
-               <value name="GL_NORMALIZE"/>
-               <value name="GL_RESCALE_NORMAL"/>
-
-               <range base="GL_CLIP_PLANE" from="0" to="5"/>
-
-               <value name="GL_FOG"/>
-               <value name="GL_LIGHTING"/>
-               <value name="GL_COLOR_MATERIAL"/>
-
-               <range base="GL_LIGHT" from="0" to="7"/>
-
-               <value name="GL_POINT_SMOOTH"/>
-               <value name="GL_LINE_SMOOTH"/>
-               <value name="GL_CULL_FACE"/>
-               <value name="GL_POLYGON_OFFSET_FILL"/>
-               <value name="GL_MULTISAMPLE"/>
-               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
-               <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
-               <value name="GL_SAMPLE_COVERAGE"/>
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_SCISSOR_TEST"/>
-               <value name="GL_ALPHA_TEST"/>
-               <value name="GL_STENCIL_TEST"/>
-               <value name="GL_DEPTH_TEST"/>
-               <value name="GL_BLEND"/>
-               <value name="GL_DITHER"/>
-               <value name="GL_COLOR_LOGIC_OP"/>
-
-               <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
-               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
-
-               <value name="GL_VERTEX_ARRAY"/>
-               <value name="GL_NORMAL_ARRAY"/>
-               <value name="GL_COLOR_ARRAY"/>
-               <value name="GL_TEXTURE_COORD_ARRAY"/>
-               <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
-               <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
-               <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
-       </desc>
-
-       <desc name="cap" category="GLES2.0">
-               <value name="GL_CULL_FACE"/>
-               <value name="GL_SCISSOR_TEST"/>
-               <value name="GL_POLYGON_OFFSET_FILL"/>
-               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
-               <value name="GL_SAMPLE_COVERAGE"/>
-               <value name="GL_STENCIL_TEST"/>
-               <value name="GL_DEPTH_TEST"/>
-               <value name="GL_DITHER"/>
-               <value name="GL_BLEND"/>
-       </desc>
-</template>
-
-<template name="DepthRange">
-       <proto>
-               <return type="void"/>
-               <param name="zNear" type="GLtype"/>
-               <param name="zFar" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="Frustum">
-       <proto>
-               <return type="void"/>
-               <param name="left" type="GLtype"/>
-               <param name="right" type="GLtype"/>
-               <param name="bottom" type="GLtype"/>
-               <param name="top" type="GLtype"/>
-               <param name="zNear" type="GLtype"/>
-               <param name="zFar" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="LoadIdentity">
-       <proto>
-               <return type="void"/>
-       </proto>
-</template>
-
-<template name="LoadMatrix">
-       <proto>
-               <return type="void"/>
-               <vector name="m" type="const GLtype *" size="16"/>
-       </proto>
-</template>
-
-<template name="MatrixMode">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_MODELVIEW"/>
-               <value name="GL_PROJECTION"/>
-               <value name="GL_TEXTURE"/>
-               <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
-       </desc>
-</template>
-
-<template name="MultMatrix">
-       <proto>
-               <return type="void"/>
-               <vector name="m" type="const GLtype *" size="16"/>
-       </proto>
-</template>
-
-<template name="Ortho">
-       <proto>
-               <return type="void"/>
-               <param name="left" type="GLtype"/>
-               <param name="right" type="GLtype"/>
-               <param name="bottom" type="GLtype"/>
-               <param name="top" type="GLtype"/>
-               <param name="zNear" type="GLtype"/>
-               <param name="zFar" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="PopMatrix">
-       <proto>
-               <return type="void"/>
-       </proto>
-</template>
-
-<template name="PushMatrix">
-       <proto>
-               <return type="void"/>
-       </proto>
-</template>
-
-<template name="Rotate">
-       <proto>
-               <return type="void"/>
-               <param name="angle" type="GLtype"/>
-               <param name="x" type="GLtype"/>
-               <param name="y" type="GLtype"/>
-               <param name="z" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="Scale">
-       <proto>
-               <return type="void"/>
-               <param name="x" type="GLtype"/>
-               <param name="y" type="GLtype"/>
-               <param name="z" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="Translate">
-       <proto>
-               <return type="void"/>
-               <param name="x" type="GLtype"/>
-               <param name="y" type="GLtype"/>
-               <param name="z" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="Viewport">
-       <proto>
-               <return type="void"/>
-               <param name="x" type="GLint"/>
-               <param name="y" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-       </proto>
-</template>
-
-<template name="ColorPointer">
-       <proto>
-               <return type="void"/>
-               <param name="size" type="GLint"/>
-               <param name="type" type="GLenum"/>
-               <param name="stride" type="GLsizei"/>
-               <param name="pointer" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="size" error="GL_INVALID_VALUE">
-               <value name="4"/>
-       </desc>
-
-       <desc name="type">
-               <value name="GL_UNSIGNED_BYTE"/>
-               <value name="GL_FLOAT"/>
-               <value name="GL_FIXED"/>
-               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
-       </desc>
-</template>
-
-<template name="DisableClientState">
-       <proto>
-               <return type="void"/>
-               <param name="array" type="GLenum"/>
-       </proto>
-
-       <desc name="array">
-               <value name="GL_VERTEX_ARRAY"/>
-               <value name="GL_NORMAL_ARRAY"/>
-               <value name="GL_COLOR_ARRAY"/>
-               <value name="GL_TEXTURE_COORD_ARRAY"/>
-               <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
-               <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
-               <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
-       </desc>
-</template>
-
-<template name="DrawArrays">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-               <param name="first" type="GLint"/>
-               <param name="count" type="GLsizei"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_POINTS"/>
-               <value name="GL_LINES"/>
-               <value name="GL_LINE_LOOP"/>
-               <value name="GL_LINE_STRIP"/>
-               <value name="GL_TRIANGLES"/>
-               <value name="GL_TRIANGLE_STRIP"/>
-               <value name="GL_TRIANGLE_FAN"/>
-       </desc>
-</template>
-
-<template name="DrawElements">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-               <param name="count" type="GLsizei"/>
-               <param name="type" type="GLenum"/>
-               <param name="indices" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_POINTS"/>
-               <value name="GL_LINES"/>
-               <value name="GL_LINE_LOOP"/>
-               <value name="GL_LINE_STRIP"/>
-               <value name="GL_TRIANGLES"/>
-               <value name="GL_TRIANGLE_STRIP"/>
-               <value name="GL_TRIANGLE_FAN"/>
-       </desc>
-
-       <desc name="type">
-               <value name="GL_UNSIGNED_BYTE"/>
-               <value name="GL_UNSIGNED_SHORT"/>
-               <!-- GL_UNSIGNED_INT is not defined in GLES1.1 headers -->
-               <value name="(0x1405 /* GL_UNSIGNED_INT */)" category="OES_element_index_uint"/>
-       </desc>
-</template>
-
-<template name="EnableClientState">
-       <proto>
-               <return type="void"/>
-               <param name="array" type="GLenum"/>
-       </proto>
-
-       <desc name="array">
-               <value name="GL_VERTEX_ARRAY"/>
-               <value name="GL_NORMAL_ARRAY"/>
-               <value name="GL_COLOR_ARRAY"/>
-               <value name="GL_TEXTURE_COORD_ARRAY"/>
-               <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
-               <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
-               <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
-       </desc>
-</template>
-
-<template name="GetPointer" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLvoid **" size="dynamic"/>
-       </proto>
-
-       <desc name="pname">
-               <value name="GL_VERTEX_ARRAY_POINTER"/>
-               <value name="GL_NORMAL_ARRAY_POINTER"/>
-               <value name="GL_COLOR_ARRAY_POINTER"/>
-               <value name="GL_TEXTURE_COORD_ARRAY_POINTER"/>
-               <value name="GL_MATRIX_INDEX_ARRAY_POINTER_OES" category="OES_matrix_palette"/>
-               <value name="GL_WEIGHT_ARRAY_POINTER_OES" category="OES_matrix_palette"/>
-               <value name="GL_POINT_SIZE_ARRAY_POINTER_OES" category="OES_point_size_array"/>
-       </desc>
-</template>
-
-<template name="Normal">
-       <proto>
-               <return type="void"/>
-               <vector name="v" type="const GLtype *" size="3">
-                       <param name="nx" type="GLtype"/>
-                       <param name="ny" type="GLtype"/>
-                       <param name="nz" type="GLtype"/>
-               </vector>
-       </proto>
-</template>
-
-<template name="NormalPointer">
-       <proto>
-               <return type="void"/>
-               <param name="type" type="GLenum"/>
-               <param name="stride" type="GLsizei"/>
-               <param name="pointer" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="type">
-               <value name="GL_BYTE"/>
-               <value name="GL_SHORT"/>
-               <value name="GL_FLOAT"/>
-               <value name="GL_FIXED"/>
-               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
-       </desc>
-</template>
-
-<template name="TexCoordPointer">
-       <proto>
-               <return type="void"/>
-               <param name="size" type="GLint"/>
-               <param name="type" type="GLenum"/>
-               <param name="stride" type="GLsizei"/>
-               <param name="pointer" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="size" error="GL_INVALID_VALUE">
-               <value name="2"/>
-               <value name="3"/>
-               <value name="4"/>
-       </desc>
-
-       <desc name="type">
-               <value name="GL_BYTE"/>
-               <value name="GL_SHORT"/>
-               <value name="GL_FLOAT"/>
-               <value name="GL_FIXED"/>
-               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
-       </desc>
-</template>
-
-<template name="VertexPointer">
-       <proto>
-               <return type="void"/>
-               <param name="size" type="GLint"/>
-               <param name="type" type="GLenum"/>
-               <param name="stride" type="GLsizei"/>
-               <param name="pointer" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="size" error="GL_INVALID_VALUE">
-               <value name="2"/>
-               <value name="3"/>
-               <value name="4"/>
-       </desc>
-
-       <desc name="type">
-               <value name="GL_BYTE"/>
-               <value name="GL_SHORT"/>
-               <value name="GL_FLOAT"/>
-               <value name="GL_FIXED"/>
-               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
-       </desc>
-</template>
-
-<template name="PolygonOffset">
-       <proto>
-               <return type="void"/>
-               <param name="factor" type="GLtype"/>
-               <param name="units" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="CopyTexImage2D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="internalFormat" type="GLenum"/>
-               <param name="x" type="GLint"/>
-               <param name="y" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="border" type="GLint"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
-       </desc>
-
-       <desc name="internalFormat" error="GL_INVALID_VALUE">
-               <value name="GL_ALPHA"/>
-               <value name="GL_RGB"/>
-               <value name="GL_RGBA"/>
-               <value name="GL_LUMINANCE"/>
-               <value name="GL_LUMINANCE_ALPHA"/>
-       </desc>
-
-       <desc name="border" error="GL_INVALID_VALUE">
-               <value name="0"/>
-       </desc>
-</template>
-
-<template name="CopyTexSubImage2D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="xoffset" type="GLint"/>
-               <param name="yoffset" type="GLint"/>
-               <param name="x" type="GLint"/>
-               <param name="y" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
-       </desc>
-</template>
-
-<template name="TexSubImage2D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="xoffset" type="GLint"/>
-               <param name="yoffset" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="format" type="GLenum"/>
-               <param name="type" type="GLenum"/>
-               <param name="pixels" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_ALPHA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGB"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGBA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
-                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-                       <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE_ALPHA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format" category="OES_depth_texture">
-               <value name="GL_DEPTH_COMPONENT"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_SHORT"/>
-                       <value name="GL_UNSIGNED_INT"/>
-               </desc>
-       </desc>
-
-       <desc name="format" category="OES_packed_depth_stencil">
-               <value name="GL_DEPTH_STENCIL_OES"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_INT_24_8_OES"/>
-               </desc>
-       </desc>
-</template>
-
-<template name="BindTexture">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="texture" type="GLuint"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
-       </desc>
-</template>
-
-<template name="DeleteTextures">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="textures" type="const GLuint *"/>
-       </proto>
-</template>
-
-<template name="GenTextures" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="textures" type="GLuint *"/>
-       </proto>
-</template>
-
-<template name="IsTexture" direction="get">
-       <proto>
-               <return type="GLboolean"/>
-               <param name="texture" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="BlendColor">
-       <proto>
-               <return type="void"/>
-               <param name="red" type="GLtype"/>
-               <param name="green" type="GLtype"/>
-               <param name="blue" type="GLtype"/>
-               <param name="alpha" type="GLtype"/>
-       </proto>
-</template>
-
-<template name="BlendEquation">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_FUNC_ADD" category="GLES2.0"/>
-               <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/>
-               <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/>
-               <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/>
-               <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/>
-               <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/>
-
-               <value name="GL_MIN_EXT" category="EXT_blend_minmax"/>
-               <value name="GL_MAX_EXT" category="EXT_blend_minmax"/>
-       </desc>
-</template>
-
-<template name="BlendEquationSeparate">
-       <proto>
-               <return type="void"/>
-               <param name="modeRGB" type="GLenum"/>
-               <param name="modeAlpha" type="GLenum"/>
-       </proto>
-
-       <desc name="modeRGB">
-               <value name="GL_FUNC_ADD" category="GLES2.0"/>
-               <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/>
-               <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/>
-               <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/>
-               <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/>
-               <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/>
-
-               <value name="GL_MIN_EXT" category="EXT_blend_minmax"/>
-               <value name="GL_MAX_EXT" category="EXT_blend_minmax"/>
-       </desc>
-
-       <desc name="modeAlpha">
-               <value name="GL_FUNC_ADD" category="GLES2.0"/>
-               <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/>
-               <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/>
-               <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/>
-               <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/>
-               <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/>
-
-               <value name="GL_MIN_EXT" category="EXT_blend_minmax"/>
-               <value name="GL_MAX_EXT" category="EXT_blend_minmax"/>
-       </desc>
-</template>
-
-<template name="TexImage3D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="internalFormat" type="GLenum"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="depth" type="GLsizei"/>
-               <param name="border" type="GLint"/>
-               <param name="format" type="GLenum"/>
-               <param name="type" type="GLenum"/>
-               <param name="pixels" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_3D_OES"/>
-       </desc>
-
-       <desc name="internalFormat">
-               <value name="GL_ALPHA"/>
-               <value name="GL_RGB"/>
-               <value name="GL_RGBA"/>
-               <value name="GL_LUMINANCE"/>
-               <value name="GL_LUMINANCE_ALPHA"/>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_ALPHA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGB"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGBA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
-                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-                       <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE_ALPHA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-</template>
-
-<template name="TexSubImage3D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="xoffset" type="GLint"/>
-               <param name="yoffset" type="GLint"/>
-               <param name="zoffset" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="depth" type="GLsizei"/>
-               <param name="format" type="GLenum"/>
-               <param name="type" type="GLenum"/>
-               <param name="pixels" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_3D_OES"/>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_ALPHA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGB"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_RGBA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
-                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-                       <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_LUMINANCE_ALPHA"/>
-
-               <desc name="type" error="GL_INVALID_OPERATION">
-                       <value name="GL_UNSIGNED_BYTE"/>
-                       <value name="GL_FLOAT" category="OES_texture_float"/>
-                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
-               </desc>
-       </desc>
-</template>
-
-<template name="CopyTexSubImage3D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="xoffset" type="GLint"/>
-               <param name="yoffset" type="GLint"/>
-               <param name="zoffset" type="GLint"/>
-               <param name="x" type="GLint"/>
-               <param name="y" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_3D_OES"/>
-       </desc>
-</template>
-
-<template name="MultiTexCoord">
-       <proto>
-               <return type="void"/>
-               <param name="texture" type="GLenum"/>
-               <vector name="v" type="const GLtype *" size="dynamic">
-                       <param name="s" type="GLtype"/>
-                       <param name="t" type="GLtype"/>
-                       <param name="r" type="GLtype"/>
-                       <param name="q" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="texture">
-               <range base="GL_TEXTURE" from="0" to="31"/>
-       </desc>
-</template>
-
-<template name="CompressedTexImage3D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="internalFormat" type="GLenum"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="depth" type="GLsizei"/>
-               <param name="border" type="GLint"/>
-               <param name="imagesize" type="GLsizei"/>
-               <param name="data" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_3D_OES"/>
-       </desc>
-
-       <desc name="internalFormat">
-               <value name="GL_3DC_X_AMD" category="AMD_compressed_3DC_texture"/>
-               <value name="GL_3DC_XY_AMD" category="AMD_compressed_3DC_texture"/>
-               <value name="GL_ATC_RGB_AMD" category="AMD_compressed_ATC_texture"/>
-               <value name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD" category="AMD_compressed_ATC_texture"/>
-               <value name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD" category="AMD_compressed_ATC_texture"/>
-       </desc>
-</template>
-
-<template name="CompressedTexSubImage3D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="xoffset" type="GLint"/>
-               <param name="yoffset" type="GLint"/>
-               <param name="zoffset" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="depth" type="GLsizei"/>
-               <param name="format" type="GLenum"/>
-               <param name="imagesize" type="GLsizei"/>
-               <param name="data" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_3D_OES"/>
-       </desc>
-</template>
-
-<template name="ActiveTexture">
-       <proto>
-               <return type="void"/>
-               <param name="texture" type="GLenum"/>
-       </proto>
-
-       <desc name="texture">
-               <range base="GL_TEXTURE" from="0" to="31"/>
-       </desc>
-</template>
-
-<template name="ClientActiveTexture">
-       <proto>
-               <return type="void"/>
-               <param name="texture" type="GLenum"/>
-       </proto>
-
-       <desc name="texture">
-               <range base="GL_TEXTURE" from="0" to="31"/>
-       </desc>
-</template>
-
-<template name="SampleCoverage">
-       <proto>
-               <return type="void"/>
-               <param name="value" type="GLtype"/>
-               <param name="invert" type="GLboolean"/>
-       </proto>
-</template>
-
-<template name="CompressedTexImage2D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="internalFormat" type="GLenum"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="border" type="GLint"/>
-               <param name="imageSize" type="GLsizei"/>
-               <param name="data" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
-       </desc>
-
-       <desc name="internalFormat">
-               <value name="GL_ETC1_RGB8_OES" category="OES_compressed_ETC1_RGB8_texture"/>
-
-               <value name="GL_PALETTE4_RGB8_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE4_RGBA8_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE4_R5_G6_B5_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE4_RGBA4_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE4_RGB5_A1_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_RGB8_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_RGBA8_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_R5_G6_B5_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_RGBA4_OES" category="OES_compressed_paletted_texture"/>
-               <value name="GL_PALETTE8_RGB5_A1_OES" category="OES_compressed_paletted_texture"/>
-
-               <value name="GL_3DC_X_AMD" category="AMD_compressed_3DC_texture"/>
-               <value name="GL_3DC_XY_AMD" category="AMD_compressed_3DC_texture"/>
-
-               <value name="GL_ATC_RGB_AMD" category="AMD_compressed_ATC_texture"/>
-               <value name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD" category="AMD_compressed_ATC_texture"/>
-               <value name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD" category="AMD_compressed_ATC_texture"/>
-
-               <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
-               <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
-       </desc>
-
-       <desc name="border" error="GL_INVALID_VALUE">
-               <value name="0"/>
-       </desc>
-</template>
-
-<template name="CompressedTexSubImage2D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="level" type="GLint"/>
-               <param name="xoffset" type="GLint"/>
-               <param name="yoffset" type="GLint"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-               <param name="format" type="GLenum"/>
-               <param name="imageSize" type="GLsizei"/>
-               <param name="data" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
-       </desc>
-
-       <desc name="format">
-               <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
-               <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
-       </desc>
-</template>
-
-<template name="BlendFuncSeparate">
-       <proto>
-               <return type="void"/>
-               <param name="srcRGB" type="GLenum"/>
-               <param name="dstRGB" type="GLenum"/>
-               <param name="srcAlpha" type="GLenum"/>
-               <param name="dstAlpha" type="GLenum"/>
-       </proto>
-
-       <desc name="srcRGB">
-               <value name="GL_ZERO"/>
-               <value name="GL_ONE"/>
-               <value name="GL_SRC_COLOR"/>
-               <value name="GL_ONE_MINUS_SRC_COLOR"/>
-               <value name="GL_SRC_ALPHA"/>
-               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
-               <value name="GL_DST_ALPHA"/>
-               <value name="GL_ONE_MINUS_DST_ALPHA"/>
-               <value name="GL_DST_COLOR"/>
-               <value name="GL_ONE_MINUS_DST_COLOR"/>
-               <value name="GL_SRC_ALPHA_SATURATE"/>
-
-               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
-       </desc>
-
-       <desc name="dstRGB">
-               <value name="GL_ZERO"/>
-               <value name="GL_ONE"/>
-               <value name="GL_SRC_COLOR"/>
-               <value name="GL_ONE_MINUS_SRC_COLOR"/>
-               <value name="GL_SRC_ALPHA"/>
-               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
-               <value name="GL_DST_ALPHA"/>
-               <value name="GL_ONE_MINUS_DST_ALPHA"/>
-               <value name="GL_DST_COLOR"/>
-               <value name="GL_ONE_MINUS_DST_COLOR"/>
-
-               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
-       </desc>
-
-       <desc name="srcAlpha">
-               <value name="GL_ZERO"/>
-               <value name="GL_ONE"/>
-               <value name="GL_SRC_COLOR"/>
-               <value name="GL_ONE_MINUS_SRC_COLOR"/>
-               <value name="GL_SRC_ALPHA"/>
-               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
-               <value name="GL_DST_ALPHA"/>
-               <value name="GL_ONE_MINUS_DST_ALPHA"/>
-               <value name="GL_DST_COLOR"/>
-               <value name="GL_ONE_MINUS_DST_COLOR"/>
-               <value name="GL_SRC_ALPHA_SATURATE"/>
-
-               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
-       </desc>
-
-       <desc name="dstAlpha">
-               <value name="GL_ZERO"/>
-               <value name="GL_ONE"/>
-               <value name="GL_SRC_COLOR"/>
-               <value name="GL_ONE_MINUS_SRC_COLOR"/>
-               <value name="GL_SRC_ALPHA"/>
-               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
-               <value name="GL_DST_ALPHA"/>
-               <value name="GL_ONE_MINUS_DST_ALPHA"/>
-               <value name="GL_DST_COLOR"/>
-               <value name="GL_ONE_MINUS_DST_COLOR"/>
-
-               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
-               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
-               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
-       </desc>
-</template>
-
-<template name="PointParameter">
-       <proto>
-               <return type="void"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="const GLtype *" size="dynamic">
-                       <param name="param" type="GLtype"/>
-               </vector>
-       </proto>
-
-       <desc name="pname">
-               <value name="GL_POINT_SIZE_MIN"/>
-               <value name="GL_POINT_SIZE_MAX"/>
-               <value name="GL_POINT_FADE_THRESHOLD_SIZE"/>
-
-               <desc name="params" vector_size="1"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_POINT_DISTANCE_ATTENUATION"/>
-               <desc name="params" vector_size="3"/>
-       </desc>
-</template>
-
-<template name="VertexAttrib">
-       <proto>
-               <return type="void"/>
-               <param name="index" type="GLuint"/>
-               <vector name="v" type="const GLtype *" size="dynamic">
-                       <param name="x" type="GLtype"/>
-                       <param name="y" type="GLtype"/>
-                       <param name="z" type="GLtype"/>
-                       <param name="w" type="GLtype"/>
-               </vector>
-       </proto>
-</template>
-
-<template name="VertexAttribPointer">
-       <proto>
-               <return type="void"/>
-               <param name="index" type="GLuint"/>
-               <param name="size" type="GLint"/>
-               <param name="type" type="GLenum"/>
-               <param name="normalized" type="GLboolean"/>
-               <param name="stride" type="GLsizei"/>
-               <param name="pointer" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="size" error="GL_INVALID_VALUE">
-               <value name="1"/>
-               <value name="2"/>
-               <value name="3"/>
-               <value name="4"/>
-       </desc>
-
-       <desc name="type" error="GL_INVALID_VALUE">
-               <value name="GL_BYTE"/>
-               <value name="GL_UNSIGNED_BYTE"/>
-               <value name="GL_SHORT"/>
-               <value name="GL_UNSIGNED_SHORT"/>
-               <value name="GL_FLOAT"/>
-               <value name="GL_FIXED"/>
-               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
-               <value name="GL_UNSIGNED_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/>
-               <value name="GL_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/>
-       </desc>
-
-       <desc name="type" category="OES_vertex_type_10_10_10_2">
-               <value name="GL_UNSIGNED_INT_10_10_10_2_OES"/>
-               <value name="GL_INT_10_10_10_2_OES"/>
-
-               <desc name="size">
-                       <value name="3"/>
-                       <value name="4"/>
-               </desc>
-       </desc>
-</template>
-
-<template name="EnableVertexAttribArray">
-       <proto>
-               <return type="void"/>
-               <param name="index" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="DisableVertexAttribArray">
-       <proto>
-               <return type="void"/>
-               <param name="index" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="IsProgram" direction="get">
-       <proto>
-               <return type="GLboolean"/>
-               <param name="program" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="GetProgram" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="pname">
-               <value name="GL_DELETE_STATUS"/>
-               <value name="GL_LINK_STATUS"/>
-               <value name="GL_VALIDATE_STATUS"/>
-               <value name="GL_INFO_LOG_LENGTH"/>
-               <value name="GL_ATTACHED_SHADERS"/>
-               <value name="GL_ACTIVE_ATTRIBUTES"/>
-               <value name="GL_ACTIVE_ATTRIBUTE_MAX_LENGTH"/>
-               <value name="GL_ACTIVE_UNIFORMS"/>
-               <value name="GL_ACTIVE_UNIFORM_MAX_LENGTH"/>
-               <value name="GL_PROGRAM_BINARY_LENGTH_OES" category="OES_get_program_binary"/>
-
-               <desc name="params" convert="false"/>
-       </desc>
-</template>
-
-<template name="GetVertexAttrib" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="index" type="GLuint"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="pname">
-               <value name="GL_VERTEX_ATTRIB_ARRAY_ENABLED"/>
-               <value name="GL_VERTEX_ATTRIB_ARRAY_SIZE"/>
-               <value name="GL_VERTEX_ATTRIB_ARRAY_STRIDE"/>
-               <value name="GL_VERTEX_ATTRIB_ARRAY_TYPE"/>
-               <value name="GL_VERTEX_ATTRIB_ARRAY_NORMALIZED"/>
-               <value name="GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"/>
-
-               <desc name="params" vector_size="1" convert="false"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_CURRENT_VERTEX_ATTRIB"/>
-               <desc name="params" vector_size="16?" convert="false"/>
-       </desc>
-</template>
-
-<template name="GetVertexAttribPointer" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="index" type="GLuint"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="pointer" type="GLvoid **" size="dynamic"/>
-       </proto>
-
-       <desc name="pname">
-               <value name="GL_VERTEX_ATTRIB_ARRAY_POINTER"/>
-       </desc>
-</template>
-
-<template name="GetBufferPointer" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLvoid **" size="dynamic"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_ARRAY_BUFFER"/>
-               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_BUFFER_MAP_POINTER_OES"/>
-       </desc>
-</template>
-
-<template name="MapBuffer" direction="get">
-       <proto>
-               <return type="void *"/>
-               <param name="target" type="GLenum"/>
-               <param name="access" type="GLenum"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_ARRAY_BUFFER"/>
-               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
-       </desc>
-
-       <desc name="access">
-               <value name="GL_WRITE_ONLY_OES"/>
-       </desc>
-</template>
-
-<template name="UnmapBuffer" direction="get">
-       <proto>
-               <return type="GLboolean"/>
-               <param name="target" type="GLenum"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_ARRAY_BUFFER"/>
-               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
-       </desc>
-</template>
-
-<template name="BindBuffer">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="buffer" type="GLuint"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_ARRAY_BUFFER"/>
-               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
-       </desc>
-</template>
-
-<template name="BufferData">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="size" type="GLsizeiptr"/>
-               <param name="data" type="const GLvoid *"/>
-               <param name="usage" type="GLenum"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_ARRAY_BUFFER"/>
-               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
-       </desc>
-
-       <desc name="usage">
-               <value name="GL_STATIC_DRAW"/>
-               <value name="GL_DYNAMIC_DRAW"/>
-               <value name="GL_STREAM_DRAW" category="GLES2.0"/>
-       </desc>
-</template>
-
-<template name="BufferSubData">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="offset" type="GLintptr"/>
-               <param name="size" type="GLsizeiptr"/>
-               <param name="data" type="const GLvoid *"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_ARRAY_BUFFER"/>
-               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
-       </desc>
-</template>
-
-<template name="DeleteBuffers">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="buffer" type="const GLuint *"/>
-       </proto>
-</template>
-
-<template name="GenBuffers" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="buffer" type="GLuint *"/>
-       </proto>
-</template>
-
-<template name="GetBufferParameter" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_ARRAY_BUFFER"/>
-               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_BUFFER_SIZE"/>
-               <value name="GL_BUFFER_USAGE"/>
-               <value name="GL_BUFFER_ACCESS_OES" category="OES_mapbuffer"/>
-               <value name="GL_BUFFER_MAPPED_OES" category="OES_mapbuffer"/>
-       </desc>
-</template>
-
-<template name="IsBuffer" direction="get">
-       <proto>
-               <return type="GLboolean"/>
-               <param name="buffer" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="CreateShader">
-       <proto>
-               <return type="GLuint"/>
-               <param name="type" type="GLenum"/>
-       </proto>
-
-       <desc name="type">
-               <value name="GL_VERTEX_SHADER"/>
-               <value name="GL_FRAGMENT_SHADER"/>
-       </desc>
-</template>
-
-<template name="ShaderSource">
-       <proto>
-               <return type="void"/>
-               <param name="shader" type="GLuint"/>
-               <param name="count" type="GLsizei"/>
-               <param name="string" type="const GLchar **"/>
-               <param name="length" type="const int *"/>
-       </proto>
-</template>
-
-<template name="CompileShader">
-       <proto>
-               <return type="void"/>
-               <param name="shader" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="ReleaseShaderCompiler">
-       <proto>
-               <return type="void"/>
-       </proto>
-</template>
-
-<template name="DeleteShader">
-       <proto>
-               <return type="void"/>
-               <param name="shader" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="ShaderBinary">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="shaders" type="const GLuint *"/>
-               <param name="binaryformat" type="GLenum"/>
-               <param name="binary" type="const GLvoid *"/>
-               <param name="length" type="GLsizei"/>
-       </proto>
-</template>
-
-<template name="CreateProgram">
-       <proto>
-               <return type="GLuint"/>
-       </proto>
-</template>
-
-<template name="AttachShader">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="shader" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="DetachShader">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="shader" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="LinkProgram">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="UseProgram">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="DeleteProgram">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="GetActiveAttrib" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="index" type="GLuint"/>
-               <param name="bufSize" type="GLsizei"/>
-               <param name="length" type="GLsizei *"/>
-               <param name="size" type="GLint *"/>
-               <param name="type" type="GLenum *"/>
-               <param name="name" type="GLchar *"/>
-       </proto>
-</template>
-
-<template name="GetAttribLocation" direction="get">
-       <proto>
-               <return type="GLint"/>
-               <param name="program" type="GLuint"/>
-               <param name="name" type="const char *"/>
-       </proto>
-</template>
-
-<template name="BindAttribLocation">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="index" type="GLuint"/>
-               <param name="name" type="const char *"/>
-       </proto>
-</template>
-
-<template name="GetUniformLocation" direction="get">
-       <proto>
-               <return type="GLint"/>
-               <param name="program" type="GLuint"/>
-               <param name="name" type="const char *"/>
-       </proto>
-</template>
-
-<template name="GetActiveUniform" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="index" type="GLuint"/>
-               <param name="bufSize" type="GLsizei"/>
-               <param name="length" type="GLsizei *"/>
-               <param name="size" type="GLint *"/>
-               <param name="type" type="GLenum *"/>
-               <param name="name" type="GLchar *"/>
-       </proto>
-</template>
-
-<template name="Uniform">
-       <proto>
-               <return type="void"/>
-               <param name="location" type="GLint"/>
-               <param name="count" type="GLsizei" hide_if_expanded="true"/>
-               <vector name="values" type="const GLtype *" size="dynamic">
-                       <param name="v0" type="GLtype"/>
-                       <param name="v1" type="GLtype"/>
-                       <param name="v2" type="GLtype"/>
-                       <param name="v3" type="GLtype"/>
-               </vector>
-       </proto>
-</template>
-
-<template name="UniformMatrix">
-       <proto>
-               <return type="void"/>
-               <param name="location" type="GLint"/>
-               <param name="count" type="GLsizei"/>
-               <param name="transpose" type="GLboolean"/>
-               <vector name="value" type="const GLtype *" size="dynamic"/>
-       </proto>
-</template>
-
-<template name="ValidateProgram">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="GenerateMipmap">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
-       </desc>
-</template>
-
-<template name="BindFramebuffer">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="framebuffer" type="GLuint"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
-       </desc>
-</template>
-
-<template name="DeleteFramebuffers">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="framebuffers" type="const GLuint *"/>
-       </proto>
-</template>
-
-<template name="GenFramebuffers">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="ids" type="GLuint *"/>
-       </proto>
-</template>
-
-<template name="BindRenderbuffer">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="renderbuffer" type="GLuint"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
-       </desc>
-</template>
-
-<template name="DeleteRenderbuffers">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="renderbuffers" type="const GLuint *"/>
-       </proto>
-</template>
-
-<template name="GenRenderbuffers">
-       <proto>
-               <return type="void"/>
-               <param name="n" type="GLsizei"/>
-               <param name="renderbuffers" type="GLuint *"/>
-       </proto>
-</template>
-
-<template name="RenderbufferStorage">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="internalFormat" type="GLenum"/>
-               <param name="width" type="GLsizei"/>
-               <param name="height" type="GLsizei"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
-       </desc>
-
-       <desc name="internalFormat">
-               <value name="GL_DEPTH_COMPONENT16_OES" category="OES_framebuffer_object"/>
-               <value name="GL_RGBA4_OES" category="OES_framebuffer_object"/>
-               <value name="GL_RGB5_A1_OES" category="OES_framebuffer_object"/>
-               <value name="GL_RGB565_OES" category="OES_framebuffer_object"/>
-               <value name="GL_STENCIL_INDEX8_OES" category="OES_stencil8"/>
-
-               <value name="GL_DEPTH_COMPONENT16" category="GLES2.0"/>
-               <value name="GL_RGBA4" category="GLES2.0"/>
-               <value name="GL_RGB5_A1" category="GLES2.0"/>
-               <value name="GL_RGB565" category="GLES2.0"/>
-               <value name="GL_STENCIL_INDEX8" category="GLES2.0"/>
-
-               <value name="GL_DEPTH_COMPONENT24_OES" category="OES_depth24"/>
-               <value name="GL_DEPTH_COMPONENT32_OES" category="OES_depth32"/>
-               <value name="GL_RGB8_OES" category="OES_rgb8_rgba8"/>
-               <value name="GL_RGBA8_OES" category="OES_rgb8_rgba8"/>
-               <value name="GL_STENCIL_INDEX1_OES" category="OES_stencil1"/>
-               <value name="GL_STENCIL_INDEX4_OES" category="OES_stencil4"/>
-               <value name="GL_DEPTH24_STENCIL8_OES" category="OES_packed_depth_stencil"/>
-       </desc>
-</template>
-
-<template name="FramebufferRenderbuffer">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="attachment" type="GLenum"/>
-               <param name="renderbuffertarget" type="GLenum"/>
-               <param name="renderbuffer" type="GLuint"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
-       </desc>
-
-       <desc name="attachment">
-               <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
-               <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
-               <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
-               <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
-               <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
-               <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
-       </desc>
-
-       <desc name="renderbuffertarget">
-               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
-       </desc>
-</template>
-
-<template name="FramebufferTexture2D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="attachment" type="GLenum"/>
-               <param name="textarget" type="GLenum"/>
-               <param name="texture" type="GLuint"/>
-               <param name="level" type="GLint"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
-       </desc>
-
-       <desc name="attachment">
-               <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
-               <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
-               <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
-               <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
-               <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
-               <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
-       </desc>
-
-       <desc name="textarget" error="GL_INVALID_OPERATION">
-               <value name="GL_TEXTURE_2D"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
-               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
-       </desc>
-       <!-- According to the base specification, "level" must be 0.  But
-            extension GL_OES_fbo_render_mipmap lifts that restriction,
-            so no restriction is placed here. -->
-</template>
-
-<template name="FramebufferTexture3D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="attachment" type="GLenum"/>
-               <param name="textarget" type="GLenum"/>
-               <param name="texture" type="GLuint"/>
-               <param name="level" type="GLint"/>
-               <param name="zoffset" type="GLint"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
-       </desc>
-
-       <desc name="attachment">
-               <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
-               <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
-               <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
-               <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
-               <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
-               <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
-       </desc>
-
-       <desc name="textarget" error="GL_INVALID_OPERATION">
-               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
-       </desc>
-</template>
-
-<template name="CheckFramebufferStatus" direction="get">
-       <proto>
-               <return type="GLenum"/>
-               <param name="target" type="GLenum"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
-       </desc>
-</template>
-
-<template name="GetFramebufferAttachmentParameter" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="attachment" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
-       </desc>
-
-       <desc name="pname">
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES" category="OES_framebuffer_object"/>
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES" category="OES_framebuffer_object"/>
-
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE" category="GLES2.0"/>
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME" category="GLES2.0"/>
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL" category="GLES2.0"/>
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE" category="GLES2.0"/>
-               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" category="OES_texture_3D"/>
-
-               <desc name="params" vector_size="1" convert="false"/>
-       </desc>
-</template>
-
-<template name="GetRenderbufferParameter" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
-       </desc>
-
-       <desc name="pname" category="OES_framebuffer_object">
-               <value name="GL_RENDERBUFFER_WIDTH_OES"/>
-               <value name="GL_RENDERBUFFER_HEIGHT_OES"/>
-               <value name="GL_RENDERBUFFER_INTERNAL_FORMAT_OES"/>
-               <value name="GL_RENDERBUFFER_RED_SIZE_OES"/>
-               <value name="GL_RENDERBUFFER_GREEN_SIZE_OES"/>
-               <value name="GL_RENDERBUFFER_BLUE_SIZE_OES"/>
-               <value name="GL_RENDERBUFFER_ALPHA_SIZE_OES"/>
-               <value name="GL_RENDERBUFFER_DEPTH_SIZE_OES"/>
-               <value name="GL_RENDERBUFFER_STENCIL_SIZE_OES"/>
-
-               <desc name="params" vector_size="1" convert="false"/>
-       </desc>
-
-       <desc name="pname" category="GLES2.0">
-               <value name="GL_RENDERBUFFER_WIDTH"/>
-               <value name="GL_RENDERBUFFER_HEIGHT"/>
-               <value name="GL_RENDERBUFFER_INTERNAL_FORMAT"/>
-               <value name="GL_RENDERBUFFER_RED_SIZE"/>
-               <value name="GL_RENDERBUFFER_GREEN_SIZE"/>
-               <value name="GL_RENDERBUFFER_BLUE_SIZE"/>
-               <value name="GL_RENDERBUFFER_ALPHA_SIZE"/>
-               <value name="GL_RENDERBUFFER_DEPTH_SIZE"/>
-               <value name="GL_RENDERBUFFER_STENCIL_SIZE"/>
-
-               <desc name="params" vector_size="1" convert="false"/>
-       </desc>
-</template>
-
-<template name="IsRenderbuffer" direction="get">
-       <proto>
-               <return type="GLboolean"/>
-               <param name="renderbuffer" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="IsFramebuffer" direction="get">
-       <proto>
-               <return type="GLboolean"/>
-               <param name="framebuffer" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="IsShader" direction="get">
-       <proto>
-               <return type="GLboolean"/>
-               <param name="shader" type="GLuint"/>
-       </proto>
-</template>
-
-<template name="GetShader" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="shader" type="GLuint"/>
-               <param name="pname" type="GLenum"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-
-       <desc name="pname">
-               <value name="GL_SHADER_TYPE"/>
-               <value name="GL_COMPILE_STATUS"/>
-               <value name="GL_DELETE_STATUS"/>
-               <value name="GL_INFO_LOG_LENGTH"/>
-               <value name="GL_SHADER_SOURCE_LENGTH"/>
-       </desc>
-</template>
-
-<template name="GetAttachedShaders" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="maxCount" type="GLsizei"/>
-               <param name="count" type="GLsizei *"/>
-               <param name="shaders" type="GLuint *"/>
-       </proto>
-</template>
-
-<template name="GetShaderInfoLog" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="shader" type="GLuint"/>
-               <param name="bufSize" type="GLsizei"/>
-               <param name="length" type="GLsizei *"/>
-               <param name="infoLog" type="GLchar *"/>
-       </proto>
-</template>
-
-<template name="GetProgramInfoLog" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="bufSize" type="GLsizei"/>
-               <param name="length" type="GLsizei *"/>
-               <param name="infoLog" type="GLchar *"/>
-       </proto>
-</template>
-
-<template name="GetShaderSource" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="shader" type="GLuint"/>
-               <param name="bufSize" type="GLsizei"/>
-               <param name="length" type="GLsizei *"/>
-               <param name="source" type="GLchar *"/>
-       </proto>
-</template>
-
-<template name="GetShaderPrecisionFormat" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="shadertype" type="GLenum"/>
-               <param name="precisiontype" type="GLenum"/>
-               <param name="range" type="GLint *"/>
-               <param name="precision" type="GLint *"/>
-       </proto>
-
-       <desc name="shadertype">
-               <value name="GL_VERTEX_SHADER"/>
-               <value name="GL_FRAGMENT_SHADER"/>
-       </desc>
-
-       <desc name="precisiontype">
-               <value name="GL_LOW_FLOAT"/>
-               <value name="GL_MEDIUM_FLOAT"/>
-               <value name="GL_HIGH_FLOAT"/>
-               <value name="GL_LOW_INT"/>
-               <value name="GL_MEDIUM_INT"/>
-               <value name="GL_HIGH_INT"/>
-       </desc>
-</template>
-
-<template name="GetUniform" direction="get">
-       <proto>
-               <return type="void"/>
-               <param name="program" type="GLuint"/>
-               <param name="location" type="GLint"/>
-               <vector name="params" type="GLtype *" size="dynamic"/>
-       </proto>
-</template>
-
-<template name="QueryMatrix" direction="get">
-       <proto>
-               <return type="GLbitfield"/>
-               <vector name="mantissa" type="GLtype *" size="16"/>
-               <vector name="exponent" type="GLint *" size="16"/>
-       </proto>
-</template>
-
-<template name="DrawTex">
-       <proto>
-               <return type="void"/>
-               <vector name="coords" type="const GLtype *" size="5">
-                       <param name="x" type="GLtype"/>
-                       <param name="y" type="GLtype"/>
-                       <param name="z" type="GLtype"/>
-                       <param name="w" type="GLtype"/>
-                       <param name="h" type="GLtype"/>
-               </vector>
-       </proto>
-</template>
-
-<template name="MultiDrawArrays">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-               <param name="first" type="GLint *"/>
-               <param name="count" type="GLsizei *"/>
-               <param name="primcount" type="GLsizei"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_POINTS"/>
-               <value name="GL_LINES"/>
-               <value name="GL_LINE_LOOP"/>
-               <value name="GL_LINE_STRIP"/>
-               <value name="GL_TRIANGLES"/>
-               <value name="GL_TRIANGLE_STRIP"/>
-               <value name="GL_TRIANGLE_FAN"/>
-       </desc>
-</template>
-
-<template name="MultiDrawElements">
-       <proto>
-               <return type="void"/>
-               <param name="mode" type="GLenum"/>
-               <param name="count" type="const GLsizei *"/>
-               <param name="type" type="GLenum"/>
-               <param name="indices" type="const GLvoid **"/>
-               <param name="primcount" type="GLsizei"/>
-       </proto>
-
-       <desc name="mode">
-               <value name="GL_POINTS"/>
-               <value name="GL_LINES"/>
-               <value name="GL_LINE_LOOP"/>
-               <value name="GL_LINE_STRIP"/>
-               <value name="GL_TRIANGLES"/>
-               <value name="GL_TRIANGLE_STRIP"/>
-               <value name="GL_TRIANGLE_FAN"/>
-       </desc>
-
-       <desc name="type">
-               <value name="GL_UNSIGNED_BYTE"/>
-               <value name="GL_UNSIGNED_SHORT"/>
-               <!-- GL_UNSIGNED_INT is not defined in GLES1.1 headers -->
-               <value name="(0x1405 /* GL_UNSIGNED_INT */)" category="OES_element_index_uint"/>
-       </desc>
-</template>
-
-<template name="EGLImageTargetTexture2D">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="image" type="GLeglImageOES"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_TEXTURE_2D"/>
-       </desc>
-</template>
-
-<template name="EGLImageTargetRenderbufferStorage">
-       <proto>
-               <return type="void"/>
-               <param name="target" type="GLenum"/>
-               <param name="image" type="GLeglImageOES"/>
-       </proto>
-
-       <desc name="target">
-               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
-               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
-       </desc>
-</template>
-
-<api name="mesa" implementation="true">
-       <category name="MESA"/>
-
-       <function name="Color4f"  default_prefix="_vbo_" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-       <function name="ClipPlane" template="ClipPlane" gltype="GLdouble"/>
-       <function name="CullFace" template="CullFace"/>
-
-       <function name="Fogf" template="Fog" gltype="GLfloat" expand_vector="true"/>
-       <function name="Fogfv" template="Fog" gltype="GLfloat"/>
-
-       <function name="FrontFace" template="FrontFace"/>
-       <function name="Hint" template="Hint"/>
-
-       <function name="Lightf" template="Light" gltype="GLfloat" expand_vector="true"/>
-       <function name="Lightfv" template="Light" gltype="GLfloat"/>
-
-       <function name="LightModelf" template="LightModel" gltype="GLfloat" expand_vector="true"/>
-       <function name="LightModelfv" template="LightModel" gltype="GLfloat"/>
-
-       <function name="LineWidth" template="LineWidth" gltype="GLfloat"/>
-
-       <function name="Materialf" default_prefix="_vbo_" template="Material" gltype="GLfloat" expand_vector="true"/>
-       <function name="Materialfv" default_prefix="_vbo_" template="Material" gltype="GLfloat"/>
-
-       <function name="PointSize" template="PointSize" gltype="GLfloat"/>
-       <function name="PointSizePointer" template="PointSizePointer"/>
-
-       <function name="Scissor" template="Scissor"/>
-       <function name="ShadeModel" template="ShadeModel"/>
-
-       <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/>
-       <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/>
-       <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/>
-       <function name="TexParameteriv" template="TexParameter" gltype="GLint"/>
-
-       <function name="TexImage2D" template="TexImage2D"/>
-
-       <function name="TexEnvf" template="TexEnv" gltype="GLfloat" expand_vector="true"/>
-       <function name="TexEnvi" template="TexEnv" gltype="GLint" expand_vector="true"/>
-       <function name="TexEnvfv" template="TexEnv" gltype="GLfloat"/>
-       <function name="TexEnviv" template="TexEnv" gltype="GLint"/>
-
-       <function name="TexGenf" template="TexGen" gltype="GLfloat" expand_vector="true"/>
-       <function name="TexGenfv" template="TexGen" gltype="GLfloat"/>
-
-       <function name="Clear" template="Clear"/>
-       <function name="ClearColor" template="ClearColor" gltype="GLclampf"/>
-       <function name="ClearStencil" template="ClearStencil"/>
-       <function name="ClearDepth" template="ClearDepth" gltype="GLclampd"/>
-
-       <function name="StencilMask" template="StencilMask"/>
-       <function name="StencilMaskSeparate" template="StencilMaskSeparate"/>
-       <function name="ColorMask" template="ColorMask"/>
-       <function name="DepthMask" template="DepthMask"/>
-       <function name="Disable" template="Disable"/>
-       <function name="Enable" template="Enable"/>
-       <function name="Finish" template="Finish"/>
-       <function name="Flush" template="Flush"/>
-
-       <function name="AlphaFunc" template="AlphaFunc" gltype="GLclampf"/>
-
-       <function name="BlendFunc" template="BlendFunc"/>
-       <function name="LogicOp" template="LogicOp"/>
-       <function name="StencilFunc" template="StencilFunc"/>
-       <function name="StencilFuncSeparate" template="StencilFuncSeparate"/>
-       <function name="StencilOp" template="StencilOp"/>
-       <function name="StencilOpSeparate" template="StencilOpSeparate"/>
-       <function name="DepthFunc" template="DepthFunc"/>
-       <function name="PixelStorei" template="PixelStore" gltype="GLint"/>
-
-       <function name="ReadPixels" template="ReadPixels"/>
-       <function name="GetBooleanv" template="GetState" gltype="GLboolean"/>
-       <function name="GetClipPlane" template="GetClipPlane" gltype="GLdouble"/>
-       <function name="GetError" template="GetError"/>
-       <function name="GetFloatv" template="GetState" gltype="GLfloat"/>
-       <function name="GetFixedv" template="GetState" gltype="GLfixed"/>
-       <function name="GetIntegerv" template="GetState" gltype="GLint"/>
-
-       <function name="GetLightfv" template="GetLight" gltype="GLfloat"/>
-       <function name="GetMaterialfv" template="GetMaterial" gltype="GLfloat"/>
-       <function name="GetMaterialiv" template="GetMaterial" gltype="GLint"/>
-
-       <function name="GetString" template="GetString"/>
-
-       <function name="GetTexEnvfv" template="GetTexEnv" gltype="GLfloat"/>
-       <function name="GetTexEnviv" template="GetTexEnv" gltype="GLint"/>
-       <function name="GetTexGenfv" template="GetTexGen" gltype="GLfloat"/>
-       <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/>
-       <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/>
-
-       <function name="IsEnabled" template="IsEnabled"/>
-
-       <function name="DepthRange" template="DepthRange" gltype="GLclampd"/>
-       <function name="Frustum" template="Frustum" gltype="GLdouble"/>
-
-       <function name="LoadIdentity" template="LoadIdentity"/>
-       <function name="LoadMatrixf" template="LoadMatrix" gltype="GLfloat"/>
-       <function name="MatrixMode" template="MatrixMode"/>
-
-       <function name="MultMatrixf" template="MultMatrix" gltype="GLfloat"/>
-       <function name="Ortho" template="Ortho" gltype="GLdouble"/>
-       <function name="PopMatrix" template="PopMatrix"/>
-       <function name="PushMatrix" template="PushMatrix"/>
-
-       <function name="Rotatef" template="Rotate" gltype="GLfloat"/>
-       <function name="Scalef" template="Scale" gltype="GLfloat"/>
-       <function name="Translatef" template="Translate" gltype="GLfloat"/>
-
-       <function name="Viewport" template="Viewport"/>
-
-       <function name="ColorPointer" template="ColorPointer"/>
-       <function name="DisableClientState" template="DisableClientState"/>
-       <function name="DrawArrays" template="DrawArrays"/>
-       <function name="DrawElements" template="DrawElements"/>
-       <function name="EnableClientState" template="EnableClientState"/>
-
-       <function name="GetPointerv" template="GetPointer"/>
-       <function name="Normal3f" default_prefix="_vbo_" template="Normal" gltype="GLfloat" expand_vector="true"/>
-       <function name="NormalPointer" template="NormalPointer"/>
-       <function name="TexCoordPointer" template="TexCoordPointer"/>
-       <function name="VertexPointer" template="VertexPointer"/>
-
-       <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/>
-       <function name="CopyTexImage2D" template="CopyTexImage2D"/>
-       <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/>
-       <function name="TexSubImage2D" template="TexSubImage2D"/>
-
-       <function name="BindTexture" template="BindTexture"/>
-       <function name="DeleteTextures" template="DeleteTextures"/>
-       <function name="GenTextures" template="GenTextures"/>
-       <function name="IsTexture" template="IsTexture"/>
-
-       <function name="BlendColor" template="BlendColor" gltype="GLclampf"/>
-       <function name="BlendEquation" template="BlendEquation"/>
-       <function name="BlendEquationSeparateEXT" template="BlendEquationSeparate"/>
-
-       <function name="TexImage3D" template="TexImage3D"/>
-       <function name="TexSubImage3D" template="TexSubImage3D"/>
-       <function name="CopyTexSubImage3D" template="CopyTexSubImage3D"/>
-
-       <function name="CompressedTexImage3DARB" template="CompressedTexImage3D"/>
-       <function name="CompressedTexSubImage3DARB" template="CompressedTexSubImage3D"/>
-
-       <function name="ActiveTextureARB" template="ActiveTexture"/>
-       <function name="ClientActiveTextureARB" template="ClientActiveTexture"/>
-
-       <function name="MultiTexCoord4f" default_prefix="_vbo_" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-
-       <function name="SampleCoverageARB" template="SampleCoverage" gltype="GLclampf"/>
-
-       <function name="CompressedTexImage2DARB" template="CompressedTexImage2D"/>
-       <function name="CompressedTexSubImage2DARB" template="CompressedTexSubImage2D"/>
-
-       <function name="BlendFuncSeparateEXT" template="BlendFuncSeparate"/>
-
-       <function name="PointParameterf" template="PointParameter" gltype="GLfloat" expand_vector="true"/>
-       <function name="PointParameterfv" template="PointParameter" gltype="GLfloat"/>
-
-       <function name="VertexAttrib1f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
-       <function name="VertexAttrib2f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
-       <function name="VertexAttrib3f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
-       <function name="VertexAttrib4f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-       <function name="VertexAttrib1fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
-       <function name="VertexAttrib2fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
-       <function name="VertexAttrib3fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
-       <function name="VertexAttrib4fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="4"/>
-
-       <function name="VertexAttribPointerARB" template="VertexAttribPointer"/>
-       <function name="EnableVertexAttribArrayARB" template="EnableVertexAttribArray"/>
-       <function name="DisableVertexAttribArrayARB" template="DisableVertexAttribArray"/>
-
-       <function name="IsProgram" template="IsProgram"/>
-       <function name="GetProgramiv" template="GetProgram" gltype="GLint"/>
-
-       <function name="GetVertexAttribfvARB" template="GetVertexAttrib" gltype="GLfloat"/>
-       <function name="GetVertexAttribivARB" template="GetVertexAttrib" gltype="GLint"/>
-       <function name="GetVertexAttribPointervARB" template="GetVertexAttribPointer"/>
-
-       <function name="GetBufferPointervARB" template="GetBufferPointer"/>
-       <function name="MapBufferARB" template="MapBuffer"/>
-       <function name="UnmapBufferARB" template="UnmapBuffer"/>
-       <function name="BindBufferARB" template="BindBuffer"/>
-       <function name="BufferDataARB" template="BufferData"/>
-       <function name="BufferSubDataARB" template="BufferSubData"/>
-       <function name="DeleteBuffersARB" template="DeleteBuffers"/>
-       <function name="GenBuffersARB" template="GenBuffers"/>
-       <function name="GetBufferParameterivARB" template="GetBufferParameter" gltype="GLint"/>
-       <function name="IsBufferARB" template="IsBuffer"/>
-
-       <function name="CreateShader" template="CreateShader"/>
-       <function name="ShaderSourceARB" template="ShaderSource"/>
-       <function name="CompileShaderARB" template="CompileShader"/>
-       <function name="ReleaseShaderCompiler" template="ReleaseShaderCompiler"/>
-       <function name="DeleteShader" template="DeleteShader"/>
-       <function name="ShaderBinary" template="ShaderBinary"/>
-       <function name="CreateProgram" template="CreateProgram"/>
-       <function name="AttachShader" template="AttachShader"/>
-       <function name="DetachShader" template="DetachShader"/>
-       <function name="LinkProgramARB" template="LinkProgram"/>
-       <function name="UseProgramObjectARB" template="UseProgram"/>
-       <function name="DeleteProgram" template="DeleteProgram"/>
-
-       <function name="GetActiveAttribARB" template="GetActiveAttrib"/>
-       <function name="GetAttribLocationARB" template="GetAttribLocation"/>
-       <function name="BindAttribLocationARB" template="BindAttribLocation"/>
-       <function name="GetUniformLocationARB" template="GetUniformLocation"/>
-       <function name="GetActiveUniformARB" template="GetActiveUniform"/>
-
-       <function name="Uniform1fARB" template="Uniform" gltype="GLfloat" vector_size="1" expand_vector="true"/>
-       <function name="Uniform2fARB" template="Uniform" gltype="GLfloat" vector_size="2" expand_vector="true"/>
-       <function name="Uniform3fARB" template="Uniform" gltype="GLfloat" vector_size="3" expand_vector="true"/>
-       <function name="Uniform4fARB" template="Uniform" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-       <function name="Uniform1iARB" template="Uniform" gltype="GLint" vector_size="1" expand_vector="true"/>
-       <function name="Uniform2iARB" template="Uniform" gltype="GLint" vector_size="2" expand_vector="true"/>
-       <function name="Uniform3iARB" template="Uniform" gltype="GLint" vector_size="3" expand_vector="true"/>
-       <function name="Uniform4iARB" template="Uniform" gltype="GLint" vector_size="4" expand_vector="true"/>
-       <function name="Uniform1fvARB" template="Uniform" gltype="GLfloat" vector_size="1"/>
-       <function name="Uniform2fvARB" template="Uniform" gltype="GLfloat" vector_size="2"/>
-       <function name="Uniform3fvARB" template="Uniform" gltype="GLfloat" vector_size="3"/>
-       <function name="Uniform4fvARB" template="Uniform" gltype="GLfloat" vector_size="4"/>
-       <function name="Uniform1ivARB" template="Uniform" gltype="GLint" vector_size="1"/>
-       <function name="Uniform2ivARB" template="Uniform" gltype="GLint" vector_size="2"/>
-       <function name="Uniform3ivARB" template="Uniform" gltype="GLint" vector_size="3"/>
-       <function name="Uniform4ivARB" template="Uniform" gltype="GLint" vector_size="4"/>
-
-       <function name="UniformMatrix2fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="2"/>
-       <function name="UniformMatrix3fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="3"/>
-       <function name="UniformMatrix4fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="4"/>
-
-       <function name="ValidateProgramARB" template="ValidateProgram"/>
-
-       <function name="GenerateMipmapEXT" template="GenerateMipmap"/>
-       <function name="BindFramebufferEXT" template="BindFramebuffer"/>
-       <function name="DeleteFramebuffersEXT" template="DeleteFramebuffers"/>
-       <function name="GenFramebuffersEXT" template="GenFramebuffers"/>
-       <function name="BindRenderbufferEXT" template="BindRenderbuffer"/>
-       <function name="DeleteRenderbuffersEXT" template="DeleteRenderbuffers"/>
-       <function name="GenRenderbuffersEXT" template="GenRenderbuffers"/>
-       <function name="RenderbufferStorageEXT" template="RenderbufferStorage"/>
-       <function name="FramebufferRenderbufferEXT" template="FramebufferRenderbuffer"/>
-       <function name="FramebufferTexture2DEXT" template="FramebufferTexture2D"/>
-       <function name="FramebufferTexture3DEXT" template="FramebufferTexture3D"/>
-       <function name="CheckFramebufferStatusEXT" template="CheckFramebufferStatus"/>
-       <function name="GetFramebufferAttachmentParameterivEXT" template="GetFramebufferAttachmentParameter" gltype="GLint"/>
-       <function name="GetRenderbufferParameterivEXT" template="GetRenderbufferParameter" gltype="GLint"/>
-       <function name="IsRenderbufferEXT" template="IsRenderbuffer"/>
-       <function name="IsFramebufferEXT" template="IsFramebuffer"/>
-
-       <function name="IsShader" template="IsShader"/>
-       <function name="GetShaderiv" template="GetShader" gltype="GLint"/>
-       <function name="GetAttachedShaders" template="GetAttachedShaders"/>
-       <function name="GetShaderInfoLog" template="GetShaderInfoLog"/>
-       <function name="GetProgramInfoLog" template="GetProgramInfoLog"/>
-       <function name="GetShaderSourceARB" template="GetShaderSource"/>
-       <function name="GetShaderPrecisionFormat" template="GetShaderPrecisionFormat"/>
-       <function name="GetUniformfvARB" template="GetUniform" gltype="GLfloat"/>
-       <function name="GetUniformivARB" template="GetUniform" gltype="GLint"/>
-
-       <function name="DrawTexf" template="DrawTex" gltype="GLfloat" expand_vector="true"/>
-       <function name="DrawTexfv" template="DrawTex" gltype="GLfloat"/>
-       <function name="DrawTexi" template="DrawTex" gltype="GLint" expand_vector="true"/>
-       <function name="DrawTexiv" template="DrawTex" gltype="GLint"/>
-       <function name="DrawTexs" template="DrawTex" gltype="GLshort" expand_vector="true"/>
-       <function name="DrawTexsv" template="DrawTex" gltype="GLshort"/>
-
-        <!-- EXT_multi_draw_arrays -->
-        <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/>
-        <function name="MultiDrawElementsEXT" template="MultiDrawElements"/>
-
-        <!-- OES_EGL_image -->
-        <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/>
-        <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/>
-</api>
-
-<api name="GLES1.1">
-       <category name="GLES1.1"/>
-
-       <category name="OES_byte_coordinates"/>
-       <category name="OES_fixed_point"/>
-       <category name="OES_single_precision"/>
-       <category name="OES_matrix_get"/>
-       <category name="OES_read_format"/>
-       <category name="OES_compressed_paletted_texture"/>
-       <category name="OES_point_size_array"/>
-       <category name="OES_point_sprite"/>
-       <category name="OES_query_matrix"/>
-       <category name="OES_draw_texture"/>
-       <category name="OES_blend_equation_separate"/>
-       <category name="OES_blend_func_separate"/>
-       <category name="OES_blend_subtract"/>
-       <category name="OES_stencil_wrap"/>
-       <category name="OES_texture_cube_map"/>
-       <category name="OES_texture_env_crossbar"/>
-       <category name="OES_texture_mirrored_repeat"/>
-       <category name="OES_framebuffer_object"/>
-       <category name="OES_depth24"/>
-       <category name="OES_depth32"/>
-       <category name="OES_fbo_render_mipmap"/>
-       <category name="OES_rgb8_rgba8"/>
-       <category name="OES_stencil1"/>
-       <category name="OES_stencil4"/>
-       <category name="OES_stencil8"/>
-       <category name="OES_element_index_uint"/>
-       <category name="OES_mapbuffer"/>
-       <category name="EXT_texture_filter_anisotropic"/>
-
-       <category name="ARB_texture_non_power_of_two"/>
-       <!-- disabled due to missing enums
-       <category name="EXT_texture_compression_dxt1"/>
-       <category name="EXT_texture_lod_bias"/>
-       <category name="EXT_blend_minmax"/>
-       -->
-       <category name="EXT_multi_draw_arrays"/>
-       <category name="OES_EGL_image"/>
-
-       <category name="OES_matrix_palette"/>
-
-       <function name="Color4f" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-       <function name="Color4ub" template="Color" gltype="GLubyte" vector_size="4" expand_vector="true"/>
-       <function name="Color4x" template="Color" gltype="GLfixed" vector_size="4" expand_vector="true"/>
-
-       <function name="ClipPlanef" template="ClipPlane" gltype="GLfloat"/>
-       <function name="ClipPlanex" template="ClipPlane" gltype="GLfixed"/>
-
-       <function name="CullFace" template="CullFace"/>
-
-       <function name="Fogf" template="Fog" gltype="GLfloat" expand_vector="true"/>
-       <function name="Fogx" template="Fog" gltype="GLfixed" expand_vector="true"/>
-       <function name="Fogfv" template="Fog" gltype="GLfloat"/>
-       <function name="Fogxv" template="Fog" gltype="GLfixed"/>
-
-       <function name="FrontFace" template="FrontFace"/>
-       <function name="Hint" template="Hint"/>
-
-       <function name="Lightf" template="Light" gltype="GLfloat" expand_vector="true"/>
-       <function name="Lightx" template="Light" gltype="GLfixed" expand_vector="true"/>
-       <function name="Lightfv" template="Light" gltype="GLfloat"/>
-       <function name="Lightxv" template="Light" gltype="GLfixed"/>
-
-       <function name="LightModelf" template="LightModel" gltype="GLfloat" expand_vector="true"/>
-       <function name="LightModelx" template="LightModel" gltype="GLfixed" expand_vector="true"/>
-       <function name="LightModelfv" template="LightModel" gltype="GLfloat"/>
-       <function name="LightModelxv" template="LightModel" gltype="GLfixed"/>
-
-       <function name="LineWidth" template="LineWidth" gltype="GLfloat"/>
-       <function name="LineWidthx" template="LineWidth" gltype="GLfixed"/>
-
-       <function name="Materialf" template="Material" gltype="GLfloat" expand_vector="true"/>
-       <function name="Materialfv" template="Material" gltype="GLfloat"/>
-       <function name="Materialx" template="Material" gltype="GLfixed" expand_vector="true"/>
-       <function name="Materialxv" template="Material" gltype="GLfixed"/>
-
-       <function name="PointSize" template="PointSize" gltype="GLfloat"/>
-       <function name="PointSizex" template="PointSize" gltype="GLfixed"/>
-       <function name="PointSizePointerOES" template="PointSizePointer"/>
-
-       <function name="Scissor" template="Scissor"/>
-       <function name="ShadeModel" template="ShadeModel"/>
-
-       <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/>
-       <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/>
-       <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/>
-       <function name="TexParameteriv" template="TexParameter" gltype="GLint"/>
-       <function name="TexParameterx" template="TexParameter" gltype="GLfixed" expand_vector="true"/>
-       <function name="TexParameterxv" template="TexParameter" gltype="GLfixed"/>
-
-       <function name="TexImage2D" template="TexImage2D"/>
-
-       <function name="TexEnvf" template="TexEnv" gltype="GLfloat" expand_vector="true"/>
-       <function name="TexEnvfv" template="TexEnv" gltype="GLfloat"/>
-       <function name="TexEnvi" template="TexEnv" gltype="GLint" expand_vector="true"/>
-       <function name="TexEnviv" template="TexEnv" gltype="GLint"/>
-       <function name="TexEnvx" template="TexEnv" gltype="GLfixed" expand_vector="true"/>
-       <function name="TexEnvxv" template="TexEnv" gltype="GLfixed"/>
-
-       <function name="TexGenfOES" external="true" template="TexGen" gltype="GLfloat" expand_vector="true"/>
-       <function name="TexGenfvOES" external="true" template="TexGen" gltype="GLfloat"/>
-       <function name="TexGeniOES" external="true" template="TexGen" gltype="GLint" expand_vector="true"/>
-       <function name="TexGenivOES" external="true" template="TexGen" gltype="GLint"/>
-       <function name="TexGenxOES" external="true" template="TexGen" gltype="GLfixed" expand_vector="true"/>
-       <function name="TexGenxvOES" external="true" template="TexGen" gltype="GLfixed"/>
-
-       <function name="Clear" template="Clear"/>
-       <function name="ClearColor" template="ClearColor" gltype="GLclampf"/>
-       <function name="ClearColorx" template="ClearColor" gltype="GLclampx"/>
-
-       <function name="ClearStencil" template="ClearStencil"/>
-       <function name="ClearDepthf" template="ClearDepth" gltype="GLclampf"/>
-       <function name="ClearDepthx" template="ClearDepth" gltype="GLclampx"/>
-
-       <function name="StencilMask" template="StencilMask"/>
-       <function name="ColorMask" template="ColorMask"/>
-       <function name="DepthMask" template="DepthMask"/>
-
-       <function name="Disable" external="true" template="Disable"/>
-       <function name="Enable" external="true" template="Enable"/>
-       <function name="Finish" template="Finish"/>
-       <function name="Flush" template="Flush"/>
-
-       <function name="AlphaFunc" template="AlphaFunc" gltype="GLclampf"/>
-       <function name="AlphaFuncx" template="AlphaFunc" gltype="GLclampx"/>
-
-       <function name="BlendFunc" template="BlendFunc"/>
-       <function name="LogicOp" template="LogicOp"/>
-       <function name="StencilFunc" template="StencilFunc"/>
-
-       <function name="StencilOp" template="StencilOp"/>
-       <function name="DepthFunc" template="DepthFunc"/>
-
-       <function name="PixelStorei" template="PixelStore" gltype="GLint"/>
-       <function name="ReadPixels" template="ReadPixels"/>
-
-       <function name="GetBooleanv" template="GetState" gltype="GLboolean"/>
-
-       <function name="GetClipPlanef" template="GetClipPlane" gltype="GLfloat"/>
-       <function name="GetClipPlanex" template="GetClipPlane" gltype="GLfixed"/>
-
-       <function name="GetError" template="GetError"/>
-       <function name="GetFloatv" template="GetState" gltype="GLfloat"/>
-       <function name="GetFixedv" template="GetState" gltype="GLfixed"/>
-       <function name="GetIntegerv" template="GetState" gltype="GLint"/>
-
-       <function name="GetLightfv" template="GetLight" gltype="GLfloat"/>
-       <function name="GetLightxv" template="GetLight" gltype="GLfixed"/>
-
-       <function name="GetMaterialfv" template="GetMaterial" gltype="GLfloat"/>
-       <function name="GetMaterialxv" template="GetMaterial" gltype="GLfixed"/>
-
-       <function name="GetString" template="GetString"/>
-
-       <function name="GetTexEnvfv" template="GetTexEnv" gltype="GLfloat"/>
-       <function name="GetTexEnviv" template="GetTexEnv" gltype="GLint"/>
-       <function name="GetTexEnvxv" template="GetTexEnv" gltype="GLfixed"/>
-
-       <function name="GetTexGenfvOES" external="true" template="GetTexGen" gltype="GLfloat"/>
-       <function name="GetTexGenivOES" external="true" template="GetTexGen" gltype="GLint"/>
-       <function name="GetTexGenxvOES" external="true" template="GetTexGen" gltype="GLfixed"/>
-
-       <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/>
-       <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/>
-       <function name="GetTexParameterxv" template="GetTexParameter" gltype="GLfixed"/>
-
-       <function name="IsEnabled" external="true" template="IsEnabled"/>
-
-       <function name="DepthRangef" template="DepthRange" gltype="GLclampf"/>
-       <function name="DepthRangex" template="DepthRange" gltype="GLclampx"/>
-
-       <function name="Frustumf" template="Frustum" gltype="GLfloat"/>
-       <function name="Frustumx" template="Frustum" gltype="GLfixed"/>
-
-       <function name="LoadIdentity" template="LoadIdentity"/>
-       <function name="LoadMatrixf" template="LoadMatrix" gltype="GLfloat"/>
-       <function name="LoadMatrixx" template="LoadMatrix" gltype="GLfixed"/>
-       <function name="MatrixMode" template="MatrixMode"/>
-
-       <function name="MultMatrixf" template="MultMatrix" gltype="GLfloat"/>
-       <function name="MultMatrixx" template="MultMatrix" gltype="GLfixed"/>
-       <function name="Orthof" template="Ortho" gltype="GLfloat"/>
-       <function name="Orthox" template="Ortho" gltype="GLfixed"/>
-
-       <function name="PopMatrix" template="PopMatrix"/>
-       <function name="PushMatrix" template="PushMatrix"/>
-
-       <function name="Rotatef" template="Rotate" gltype="GLfloat"/>
-       <function name="Rotatex" template="Rotate" gltype="GLfixed"/>
-       <function name="Scalef" template="Scale" gltype="GLfloat"/>
-       <function name="Scalex" template="Scale" gltype="GLfixed"/>
-       <function name="Translatef" template="Translate" gltype="GLfloat"/>
-       <function name="Translatex" template="Translate" gltype="GLfixed"/>
-
-       <function name="Viewport" template="Viewport"/>
-       <function name="ColorPointer" template="ColorPointer"/>
-       <function name="DisableClientState" template="DisableClientState"/>
-       <function name="DrawArrays" template="DrawArrays"/>
-       <function name="DrawElements" template="DrawElements"/>
-       <function name="EnableClientState" template="EnableClientState"/>
-
-       <function name="GetPointerv" template="GetPointer"/>
-
-       <function name="Normal3f" template="Normal" gltype="GLfloat" expand_vector="true"/>
-       <function name="Normal3x" template="Normal" gltype="GLfixed" expand_vector="true"/>
-       <function name="NormalPointer" template="NormalPointer"/>
-       <function name="TexCoordPointer" template="TexCoordPointer"/>
-       <function name="VertexPointer" template="VertexPointer"/>
-
-       <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/>
-       <function name="PolygonOffsetx" template="PolygonOffset" gltype="GLfixed"/>
-
-       <function name="CopyTexImage2D" template="CopyTexImage2D"/>
-       <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/>
-
-       <function name="TexSubImage2D" template="TexSubImage2D"/>
-
-       <function name="BindTexture" template="BindTexture"/>
-       <function name="DeleteTextures" template="DeleteTextures"/>
-       <function name="GenTextures" template="GenTextures"/>
-       <function name="IsTexture" template="IsTexture"/>
-
-       <function name="BlendEquationOES" template="BlendEquation"/>
-       <function name="BlendEquationSeparateOES" template="BlendEquationSeparate"/>
-
-       <function name="MultiTexCoord4x" template="MultiTexCoord" gltype="GLfixed" vector_size="4" expand_vector="true"/>
-
-       <function name="ActiveTexture" template="ActiveTexture"/>
-       <function name="ClientActiveTexture" template="ClientActiveTexture"/>
-
-       <function name="MultiTexCoord4f" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-
-       <function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/>
-       <function name="SampleCoveragex" template="SampleCoverage" gltype="GLclampx"/>
-
-       <!-- CompressedTexImage2D calls out to two different functions based on
-            whether the image is a paletted image or not -->
-       <function name="CompressedTexImage2D" external="true" template="CompressedTexImage2D"/>
-       <function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/>
-
-       <function name="BlendFuncSeparateOES" template="BlendFuncSeparate"/>
-
-       <function name="PointParameterf" template="PointParameter" gltype="GLfloat" expand_vector="true"/>
-       <function name="PointParameterfv" template="PointParameter" gltype="GLfloat"/>
-       <function name="PointParameterx" template="PointParameter" gltype="GLfixed" expand_vector="true"/>
-       <function name="PointParameterxv" template="PointParameter" gltype="GLfixed"/>
-
-       <!-- OES_mapbuffer -->
-       <function name="GetBufferPointervOES" template="GetBufferPointer"/>
-       <function name="MapBufferOES" template="MapBuffer"/>
-       <function name="UnmapBufferOES" template="UnmapBuffer"/>
-
-       <function name="BindBuffer" template="BindBuffer"/>
-       <function name="BufferData" template="BufferData"/>
-       <function name="BufferSubData" template="BufferSubData"/>
-       <function name="DeleteBuffers" template="DeleteBuffers"/>
-       <function name="GenBuffers" template="GenBuffers"/>
-       <function name="GetBufferParameteriv" template="GetBufferParameter" gltype="GLint"/>
-       <function name="IsBuffer" template="IsBuffer"/>
-
-       <!-- OES_framebuffer_object -->
-       <function name="GenerateMipmapOES" template="GenerateMipmap"/>
-       <function name="BindFramebufferOES" template="BindFramebuffer"/>
-       <function name="DeleteFramebuffersOES" template="DeleteFramebuffers"/>
-       <function name="GenFramebuffersOES" template="GenFramebuffers"/>
-       <function name="BindRenderbufferOES" template="BindRenderbuffer"/>
-       <function name="DeleteRenderbuffersOES" template="DeleteRenderbuffers"/>
-       <function name="GenRenderbuffersOES" template="GenRenderbuffers"/>
-       <function name="RenderbufferStorageOES" external="true" template="RenderbufferStorage"/>
-       <function name="FramebufferRenderbufferOES" template="FramebufferRenderbuffer"/>
-       <function name="FramebufferTexture2DOES" template="FramebufferTexture2D"/>
-       <function name="CheckFramebufferStatusOES" template="CheckFramebufferStatus"/>
-       <function name="GetFramebufferAttachmentParameterivOES" template="GetFramebufferAttachmentParameter" gltype="GLint"/>
-       <function name="GetRenderbufferParameterivOES" template="GetRenderbufferParameter" gltype="GLint"/>
-       <function name="IsRenderbufferOES" template="IsRenderbuffer"/>
-       <function name="IsFramebufferOES" template="IsFramebuffer"/>
-
-       <!-- OES_query_matrix -->
-       <!-- QueryMatrixx returns values in an unusual, decomposed, fixed-value
-            form; it has its own code for this -->
-       <function name="QueryMatrixxOES" external="true" template="QueryMatrix" gltype="GLfixed"/>
-
-       <!-- OES_draw_texture -->
-       <function name="DrawTexfOES" template="DrawTex" gltype="GLfloat" expand_vector="true"/>
-       <function name="DrawTexiOES" template="DrawTex" gltype="GLint" expand_vector="true"/>
-       <function name="DrawTexsOES" template="DrawTex" gltype="GLshort" expand_vector="true"/>
-       <function name="DrawTexxOES" template="DrawTex" gltype="GLfixed" expand_vector="true"/>
-       <function name="DrawTexfvOES" template="DrawTex" gltype="GLfloat"/>
-       <function name="DrawTexivOES" template="DrawTex" gltype="GLint"/>
-       <function name="DrawTexsvOES" template="DrawTex" gltype="GLshort"/>
-       <function name="DrawTexxvOES" template="DrawTex" gltype="GLfixed"/>
-
-        <!-- EXT_multi_draw_arrays -->
-        <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/>
-        <function name="MultiDrawElementsEXT" template="MultiDrawElements"/>
-
-        <!-- OES_EGL_image -->
-        <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/>
-        <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/>
-</api>
-
-<api name="GLES2.0">
-       <category name="GLES2.0"/>
-
-       <category name="OES_compressed_paletted_texture"/>
-       <category name="OES_depth24"/>
-       <category name="OES_depth32"/>
-       <category name="OES_fbo_render_mipmap"/>
-       <category name="OES_rgb8_rgba8"/>
-       <category name="OES_stencil1"/>
-       <category name="OES_stencil4"/>
-       <category name="OES_element_index_uint"/>
-       <category name="OES_mapbuffer"/>
-       <category name="OES_texture_3D"/>
-       <category name="OES_texture_npot"/>
-       <category name="EXT_texture_filter_anisotropic"/>
-       <category name="EXT_texture_type_2_10_10_10_REV"/>
-       <category name="OES_depth_texture"/>
-       <category name="OES_packed_depth_stencil"/>
-       <category name="OES_standard_derivatives"/>
-
-       <!-- disabled due to missing enums
-       <category name="EXT_texture_compression_dxt1"/>
-       <category name="EXT_blend_minmax"/>
-       -->
-       <category name="EXT_multi_draw_arrays"/>
-       <category name="OES_EGL_image"/>
-
-       <function name="CullFace" template="CullFace"/>
-
-       <function name="FrontFace" template="FrontFace"/>
-       <function name="Hint" template="Hint"/>
-
-       <function name="LineWidth" template="LineWidth" gltype="GLfloat"/>
-
-       <function name="Scissor" template="Scissor"/>
-
-       <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/>
-       <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/>
-       <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/>
-       <function name="TexParameteriv" template="TexParameter" gltype="GLint"/>
-
-       <function name="TexImage2D" template="TexImage2D"/>
-
-       <function name="Clear" template="Clear"/>
-       <function name="ClearColor" template="ClearColor" gltype="GLclampf"/>
-       <function name="ClearStencil" template="ClearStencil"/>
-       <function name="ClearDepthf" template="ClearDepth" gltype="GLclampf"/>
-
-       <function name="StencilMask" template="StencilMask"/>
-       <function name="StencilMaskSeparate" template="StencilMaskSeparate"/>
-       <function name="ColorMask" template="ColorMask"/>
-       <function name="DepthMask" template="DepthMask"/>
-       <function name="Disable" template="Disable"/>
-       <function name="Enable" template="Enable"/>
-       <function name="Finish" template="Finish"/>
-       <function name="Flush" template="Flush"/>
-
-       <function name="BlendFunc" template="BlendFunc"/>
-
-       <function name="StencilFunc" template="StencilFunc"/>
-       <function name="StencilFuncSeparate" template="StencilFuncSeparate"/>
-       <function name="StencilOp" template="StencilOp"/>
-       <function name="StencilOpSeparate" template="StencilOpSeparate"/>
-
-       <function name="DepthFunc" template="DepthFunc"/>
-
-       <function name="PixelStorei" template="PixelStore" gltype="GLint"/>
-       <function name="ReadPixels" template="ReadPixels"/>
-
-       <function name="GetBooleanv" template="GetState" gltype="GLboolean"/>
-       <function name="GetError" template="GetError"/>
-       <function name="GetFloatv" template="GetState" gltype="GLfloat"/>
-       <function name="GetIntegerv" template="GetState" gltype="GLint"/>
-
-       <function name="GetString" template="GetString"/>
-
-       <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/>
-       <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/>
-
-       <function name="IsEnabled" template="IsEnabled"/>
-
-       <function name="DepthRangef" template="DepthRange" gltype="GLclampf"/>
-
-       <function name="Viewport" template="Viewport"/>
-
-       <function name="DrawArrays" template="DrawArrays"/>
-       <function name="DrawElements" template="DrawElements"/>
-
-       <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/>
-       <function name="CopyTexImage2D" template="CopyTexImage2D"/>
-       <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/>
-       <function name="TexSubImage2D" template="TexSubImage2D"/>
-
-       <function name="BindTexture" template="BindTexture"/>
-       <function name="DeleteTextures" template="DeleteTextures"/>
-       <function name="GenTextures" template="GenTextures"/>
-       <function name="IsTexture" template="IsTexture"/>
-
-       <function name="BlendColor" template="BlendColor" gltype="GLclampf"/>
-       <function name="BlendEquation" template="BlendEquation"/>
-       <function name="BlendEquationSeparate" template="BlendEquationSeparate"/>
-
-       <function name="TexImage3DOES" template="TexImage3D"/>
-       <function name="TexSubImage3DOES" template="TexSubImage3D"/>
-       <function name="CopyTexSubImage3DOES" template="CopyTexSubImage3D"/>
-
-       <function name="CompressedTexImage3DOES" template="CompressedTexImage3D"/>
-       <function name="CompressedTexSubImage3DOES" template="CompressedTexSubImage3D"/>
-
-       <function name="ActiveTexture" template="ActiveTexture"/>
-
-       <function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/>
-
-       <function name="CompressedTexImage2D" external="true" template="CompressedTexImage2D"/>
-       <function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/>
-
-       <function name="BlendFuncSeparate" template="BlendFuncSeparate"/>
-
-       <function name="VertexAttrib1f" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
-       <function name="VertexAttrib2f" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
-       <function name="VertexAttrib3f" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
-       <function name="VertexAttrib4f" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-       <function name="VertexAttrib1fv" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
-       <function name="VertexAttrib2fv" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
-       <function name="VertexAttrib3fv" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
-       <function name="VertexAttrib4fv" template="VertexAttrib" gltype="GLfloat" vector_size="4"/>
-
-       <function name="VertexAttribPointer" template="VertexAttribPointer"/>
-
-       <function name="EnableVertexAttribArray" template="EnableVertexAttribArray"/>
-       <function name="DisableVertexAttribArray" template="DisableVertexAttribArray"/>
-
-       <function name="IsProgram" template="IsProgram"/>
-       <function name="GetProgramiv" template="GetProgram" gltype="GLint"/>
-
-       <function name="GetVertexAttribfv" template="GetVertexAttrib" gltype="GLfloat"/>
-       <function name="GetVertexAttribiv" template="GetVertexAttrib" gltype="GLint"/>
-       <function name="GetVertexAttribPointerv" template="GetVertexAttribPointer"/>
-
-       <function name="GetBufferPointervOES" template="GetBufferPointer"/>
-       <function name="MapBufferOES" template="MapBuffer"/>
-       <function name="UnmapBufferOES" template="UnmapBuffer"/>
-       <function name="BindBuffer" template="BindBuffer"/>
-       <function name="BufferData" template="BufferData"/>
-       <function name="BufferSubData" template="BufferSubData"/>
-       <function name="DeleteBuffers" template="DeleteBuffers"/>
-       <function name="GenBuffers" template="GenBuffers"/>
-       <function name="GetBufferParameteriv" template="GetBufferParameter" gltype="GLint"/>
-       <function name="IsBuffer" template="IsBuffer"/>
-
-       <function name="CreateShader" template="CreateShader"/>
-       <function name="ShaderSource" template="ShaderSource"/>
-       <function name="CompileShader" template="CompileShader"/>
-       <function name="ReleaseShaderCompiler" template="ReleaseShaderCompiler"/>
-       <function name="DeleteShader" template="DeleteShader"/>
-       <function name="ShaderBinary" template="ShaderBinary"/>
-       <function name="CreateProgram" template="CreateProgram"/>
-       <function name="AttachShader" template="AttachShader"/>
-       <function name="DetachShader" template="DetachShader"/>
-       <function name="LinkProgram" template="LinkProgram"/>
-       <function name="UseProgram" template="UseProgram"/>
-       <function name="DeleteProgram" template="DeleteProgram"/>
-
-       <function name="GetActiveAttrib" template="GetActiveAttrib"/>
-       <function name="GetAttribLocation" template="GetAttribLocation"/>
-       <function name="BindAttribLocation" template="BindAttribLocation"/>
-       <function name="GetUniformLocation" template="GetUniformLocation"/>
-       <function name="GetActiveUniform" template="GetActiveUniform"/>
-
-       <function name="Uniform1f" template="Uniform" gltype="GLfloat" vector_size="1" expand_vector="true"/>
-       <function name="Uniform2f" template="Uniform" gltype="GLfloat" vector_size="2" expand_vector="true"/>
-       <function name="Uniform3f" template="Uniform" gltype="GLfloat" vector_size="3" expand_vector="true"/>
-       <function name="Uniform4f" template="Uniform" gltype="GLfloat" vector_size="4" expand_vector="true"/>
-       <function name="Uniform1i" template="Uniform" gltype="GLint" vector_size="1" expand_vector="true"/>
-       <function name="Uniform2i" template="Uniform" gltype="GLint" vector_size="2" expand_vector="true"/>
-       <function name="Uniform3i" template="Uniform" gltype="GLint" vector_size="3" expand_vector="true"/>
-       <function name="Uniform4i" template="Uniform" gltype="GLint" vector_size="4" expand_vector="true"/>
-
-       <function name="Uniform1fv" template="Uniform" gltype="GLfloat" vector_size="1"/>
-       <function name="Uniform2fv" template="Uniform" gltype="GLfloat" vector_size="2"/>
-       <function name="Uniform3fv" template="Uniform" gltype="GLfloat" vector_size="3"/>
-       <function name="Uniform4fv" template="Uniform" gltype="GLfloat" vector_size="4"/>
-       <function name="Uniform1iv" template="Uniform" gltype="GLint" vector_size="1"/>
-       <function name="Uniform2iv" template="Uniform" gltype="GLint" vector_size="2"/>
-       <function name="Uniform3iv" template="Uniform" gltype="GLint" vector_size="3"/>
-       <function name="Uniform4iv" template="Uniform" gltype="GLint" vector_size="4"/>
-
-       <function name="UniformMatrix2fv" template="UniformMatrix" gltype="GLfloat" vector_size="2"/>
-       <function name="UniformMatrix3fv" template="UniformMatrix" gltype="GLfloat" vector_size="3"/>
-       <function name="UniformMatrix4fv" template="UniformMatrix" gltype="GLfloat" vector_size="4"/>
-
-       <function name="ValidateProgram" template="ValidateProgram"/>
-
-       <function name="GenerateMipmap" template="GenerateMipmap"/>
-       <function name="BindFramebuffer" template="BindFramebuffer"/>
-       <function name="DeleteFramebuffers" template="DeleteFramebuffers"/>
-       <function name="GenFramebuffers" template="GenFramebuffers"/>
-       <function name="BindRenderbuffer" template="BindRenderbuffer"/>
-       <function name="DeleteRenderbuffers" template="DeleteRenderbuffers"/>
-       <function name="GenRenderbuffers" template="GenRenderbuffers"/>
-       <function name="RenderbufferStorage" external="true" template="RenderbufferStorage"/>
-       <function name="FramebufferRenderbuffer" template="FramebufferRenderbuffer"/>
-       <function name="FramebufferTexture2D" template="FramebufferTexture2D"/>
-       <function name="FramebufferTexture3DOES" template="FramebufferTexture3D"/>
-       <function name="CheckFramebufferStatus" template="CheckFramebufferStatus"/>
-       <function name="GetFramebufferAttachmentParameteriv" template="GetFramebufferAttachmentParameter" gltype="GLint"/>
-       <function name="GetRenderbufferParameteriv" template="GetRenderbufferParameter" gltype="GLint"/>
-       <function name="IsRenderbuffer" template="IsRenderbuffer"/>
-       <function name="IsFramebuffer" template="IsFramebuffer"/>
-
-       <function name="IsShader" template="IsShader"/>
-       <function name="GetShaderiv" template="GetShader" gltype="GLint"/>
-       <function name="GetAttachedShaders" template="GetAttachedShaders"/>
-       <function name="GetShaderInfoLog" template="GetShaderInfoLog"/>
-       <function name="GetProgramInfoLog" template="GetProgramInfoLog"/>
-       <function name="GetShaderSource" template="GetShaderSource"/>
-       <function name="GetShaderPrecisionFormat" template="GetShaderPrecisionFormat"/>
-       <function name="GetUniformfv" template="GetUniform" gltype="GLfloat"/>
-       <function name="GetUniformiv" template="GetUniform" gltype="GLint"/>
-
-        <!-- EXT_multi_draw_arrays -->
-        <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/>
-        <function name="MultiDrawElementsEXT" template="MultiDrawElements"/>
-
-        <!-- OES_EGL_image -->
-        <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/>
-        <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/>
-</api>
-
-</apispec>
diff --git a/src/mesa/es/main/APIspecutil.py b/src/mesa/es/main/APIspecutil.py
deleted file mode 100644 (file)
index 27a8fe8..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
-#
-# 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.
-"""
-Minimal apiutil.py interface for use by es_generator.py.
-"""
-
-import sys
-import libxml2
-
-import APIspec
-
-__spec = {}
-__functions = {}
-__aliases = {}
-
-def _ParseXML(filename, apiname):
-    conversions = {
-        # from           to
-        'GLfloat':  [ 'GLdouble' ],
-        'GLclampf': [ 'GLclampd' ],
-        'GLubyte':  [ 'GLfloat', 'GLdouble' ],
-        'GLint':    [ 'GLfloat', 'GLdouble' ],
-        'GLfixed':  [ 'GLfloat', 'GLdouble' ],
-        'GLclampx': [ 'GLclampf', 'GLclampd' ],
-    }
-
-    doc = libxml2.readFile(filename, None,
-            libxml2.XML_PARSE_DTDLOAD +
-            libxml2.XML_PARSE_DTDVALID +
-            libxml2.XML_PARSE_NOBLANKS)
-    spec = APIspec.Spec(doc)
-    impl = spec.get_impl()
-    api = spec.get_api(apiname)
-    doc.freeDoc()
-
-    __spec["impl"] = impl
-    __spec["api"] = api
-
-    for func in api.functions:
-        alias, need_conv = impl.match(func, conversions)
-        if not alias:
-            # external functions are manually dispatched
-            if not func.is_external:
-                print >>sys.stderr, "Error: unable to dispatch %s" % func.name
-            alias = func
-            need_conv = False
-
-        __functions[func.name] = func
-        __aliases[func.name] = (alias, need_conv)
-
-
-def AllSpecials(notused=None):
-    """Return a list of all external functions in the API."""
-    api = __spec["api"]
-
-    specials = []
-    for func in api.functions:
-        if func.is_external:
-            specials.append(func.name)
-
-    return specials
-
-
-def GetAllFunctions(filename, api):
-    """Return sorted list of all functions in the API."""
-    if not __spec:
-        _ParseXML(filename, api)
-
-    api = __spec["api"]
-    names = []
-    for func in api.functions:
-        names.append(func.name)
-    names.sort()
-    return names
-
-
-def ReturnType(funcname):
-    """Return the C return type of named function."""
-    func = __functions[funcname]
-    return func.return_type
-
-
-def Properties(funcname):
-    """Return list of properties of the named GL function."""
-    func = __functions[funcname]
-    return [func.direction]
-
-
-def _ValidValues(func, param):
-    """Return the valid values of a parameter."""
-    valid_values = []
-    switch = func.checker.switches.get(param.name, [])
-    for desc in switch:
-        # no dependent vector
-        if not desc.checker.switches:
-            for val in desc.values:
-                valid_values.append((val, None, None, [], desc.error, None))
-            continue
-
-        items = desc.checker.switches.items()
-        if len(items) > 1:
-            print >>sys.stderr, "%s: more than one parameter depend on %s" % \
-                    (func.name, desc.name)
-        dep_name, dep_switch = items[0]
-
-        for dep_desc in dep_switch:
-            if dep_desc.index >= 0 and dep_desc.index != 0:
-                print >>sys.stderr, "%s: not first element of a vector" % func.name
-            if dep_desc.checker.switches:
-                print >>sys.stderr, "%s: deep nested dependence" % func.name
-
-            convert = None if dep_desc.convert else "noconvert"
-            for val in desc.values:
-                valid_values.append((val, dep_desc.size_str, dep_desc.name,
-                                     dep_desc.values, dep_desc.error, convert))
-    return valid_values
-
-
-def _Conversion(func, src_param):
-    """Return the destination type of the conversion, or None."""
-    alias, need_conv = __aliases[func.name]
-    if need_conv:
-        dst_param = alias.get_param(src_param.name)
-        if src_param.type == dst_param.type:
-            need_conv = False
-    if not need_conv:
-        return (None, "none")
-
-    converts = { True: 0, False: 0 }
-
-    # In Fogx, for example,  pname may be GL_FOG_DENSITY/GL_FOG_START/GL_FOG_END
-    # or GL_FOG_MODE.  In the former three cases, param is not checked and the
-    # default is to convert.
-    if not func.checker.always_check(src_param.name):
-        converts[True] += 1
-
-    for desc in func.checker.flatten(src_param.name):
-        converts[desc.convert] += 1
-        if converts[True] and converts[False]:
-            break
-
-    # it should be "never", "sometimes", and "always"...
-    if converts[False]:
-        if converts[True]:
-            conversion = "some"
-        else:
-            conversion = "none"
-    else:
-        conversion = "all"
-
-    return (dst_param.base_type(), conversion)
-
-
-def _MaxVecSize(func, param):
-    """Return the largest possible size of a vector."""
-    if not param.is_vector:
-        return 0
-    if param.size:
-        return param.size
-
-    # need to look at all descriptions
-    size = 0
-    for desc in func.checker.flatten(param.name):
-        if desc.size_str and desc.size_str.isdigit():
-            s = int(desc.size_str)
-            if s > size:
-                size = s
-    if not size:
-        need_conv = __aliases[func.name][1]
-        if need_conv:
-            print >>sys.stderr, \
-                    "Error: unable to dicide the max size of %s in %s" % \
-                    (param.name, func.name)
-    return size
-
-
-def _ParameterTuple(func, param):
-    """Return a parameter tuple.
-
-    [0] -- parameter name
-    [1] -- parameter type
-    [2] -- max vector size or 0
-    [3] -- dest type the parameter converts to, or None
-    [4] -- valid values
-    [5] -- how often does the conversion happen
-
-    """
-    vec_size = _MaxVecSize(func, param)
-    dst_type, conversion = _Conversion(func, param)
-    valid_values = _ValidValues(func, param)
-
-    return (param.name, param.type, vec_size, dst_type, valid_values, conversion)
-
-
-def Parameters(funcname):
-    """Return list of tuples of function parameters."""
-    func = __functions[funcname]
-    params = []
-    for param in func.params:
-        params.append(_ParameterTuple(func, param))
-
-    return params
-
-
-def FindParamIndex(params, paramname):
-    """Find the index of a named parameter."""
-    for i in xrange(len(params)):
-        if params[i][0] == paramname:
-            return i
-    return None
-
-
-def MakeDeclarationString(params):
-    """Return a C-style parameter declaration string."""
-    string = []
-    for p in params:
-        sep = "" if p[1].endswith("*") else " "
-        string.append("%s%s%s" % (p[1], sep, p[0]))
-    if not string:
-        return "void"
-    return ", ".join(string)
-
-
-def AliasPrefix(funcname):
-    """Return the prefix of the function the named function is an alias of."""
-    alias = __aliases[funcname][0]
-    return alias.prefix
-
-
-def Alias(funcname):
-    """Return the name of the function the named function is an alias of."""
-    alias, need_conv = __aliases[funcname]
-    return alias.name if not need_conv else None
-
-
-def ConversionFunction(funcname):
-    """Return the name of the function the named function converts to."""
-    alias, need_conv = __aliases[funcname]
-    return alias.name if need_conv else None
-
-
-def Categories(funcname):
-    """Return all the categories of the named GL function."""
-    api = __spec["api"]
-    return [api.name]
diff --git a/src/mesa/es/main/es_generator.py b/src/mesa/es/main/es_generator.py
deleted file mode 100644 (file)
index 8dedafb..0000000
+++ /dev/null
@@ -1,719 +0,0 @@
-#*************************************************************************
-# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
-# 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
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# 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 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 NONINFRINGEMENT.  IN NO EVENT SHALL
-# TUNGSTEN GRAPHICS 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.
-#*************************************************************************
-
-
-import sys, os
-import APIspecutil as apiutil
-
-# These dictionary entries are used for automatic conversion.
-# The string will be used as a format string with the conversion
-# variable.
-Converters = {
-    'GLfloat': {
-        'GLdouble': "(GLdouble) (%s)",
-        'GLfixed' : "(GLint) (%s * 65536)",
-    },
-    'GLfixed': {
-        'GLfloat': "(GLfloat) (%s / 65536.0f)",
-        'GLdouble': "(GLdouble) (%s / 65536.0)",
-    },
-    'GLdouble': {
-        'GLfloat': "(GLfloat) (%s)",
-        'GLfixed': "(GLfixed) (%s * 65536)",
-    },
-    'GLclampf': {
-        'GLclampd': "(GLclampd) (%s)",
-        'GLclampx': "(GLclampx) (%s * 65536)",
-    },
-    'GLclampx': {
-        'GLclampf': "(GLclampf) (%s / 65536.0f)",
-        'GLclampd': "(GLclampd) (%s / 65536.0)",
-    },
-    'GLubyte': {
-        'GLfloat': "(GLfloat) (%s / 255.0f)",
-    },
-}
-
-def GetBaseType(type):
-    typeTokens = type.split(' ')
-    baseType = None
-    typeModifiers = []
-    for t in typeTokens:
-        if t in ['const', '*']:
-            typeModifiers.append(t)
-        else:
-            baseType = t
-    return (baseType, typeModifiers)
-
-def ConvertValue(value, fromType, toType):
-    """Returns a string that represents the given parameter string, 
-    type-converted if necessary."""
-
-    if not Converters.has_key(fromType):
-        print >> sys.stderr, "No base converter for type '%s' found.  Ignoring." % fromType
-        return value
-
-    if not Converters[fromType].has_key(toType):
-        print >> sys.stderr, "No converter found for type '%s' to type '%s'.  Ignoring." % (fromType, toType)
-        return value
-
-    # This part is simple.  Return the proper conversion.
-    conversionString = Converters[fromType][toType]
-    return conversionString % value
-
-FormatStrings = {
-    'GLenum' : '0x%x',
-    'GLfloat' : '%f',
-    'GLint' : '%d',
-    'GLbitfield' : '0x%x',
-}
-def GetFormatString(type):
-    if FormatStrings.has_key(type):
-        return FormatStrings[type]
-    else:
-        return None
-
-
-######################################################################
-# Version-specific values to be used in the main script
-# header: which header file to include
-# api: what text specifies an API-level function
-VersionSpecificValues = {
-    'GLES1.1' : {
-        'description' : 'GLES1.1 functions',
-        'header' : 'GLES/gl.h',
-        'extheader' : 'GLES/glext.h',
-    },
-    'GLES2.0': {
-        'description' : 'GLES2.0 functions',
-        'header' : 'GLES2/gl2.h',
-        'extheader' : 'GLES2/gl2ext.h',
-    }
-}
-
-
-######################################################################
-# Main code for the script begins here.
-
-# Get the name of the program (without the directory part) for use in
-# error messages.
-program = os.path.basename(sys.argv[0])
-
-# Set default values
-verbose = 0
-functionList = "APIspec.xml"
-version = "GLES1.1"
-
-# Allow for command-line switches
-import getopt, time
-options = "hvV:S:"
-try:
-    optlist, args = getopt.getopt(sys.argv[1:], options)
-except getopt.GetoptError, message:
-    sys.stderr.write("%s: %s.  Use -h for help.\n" % (program, message))
-    sys.exit(1)
-
-for option, optarg in optlist:
-    if option == "-h":
-        sys.stderr.write("Usage: %s [-%s]\n" % (program, options))
-        sys.stderr.write("Parse an API specification file and generate wrapper functions for a given GLES version\n")
-        sys.stderr.write("-h gives help\n")
-        sys.stderr.write("-v is verbose\n")
-        sys.stderr.write("-V specifies GLES version to generate [%s]:\n" % version)
-        for key in VersionSpecificValues.keys():
-            sys.stderr.write("    %s - %s\n" % (key, VersionSpecificValues[key]['description']))
-        sys.stderr.write("-S specifies API specification file to use [%s]\n" % functionList)
-        sys.exit(1)
-    elif option == "-v":
-        verbose += 1
-    elif option == "-V":
-        version = optarg
-    elif option == "-S":
-        functionList = optarg
-
-# Beyond switches, we support no further command-line arguments
-if len(args) >  0:
-    sys.stderr.write("%s: only switch arguments are supported - use -h for help\n" % program)
-    sys.exit(1)
-
-# If we don't have a valid version, abort.
-if not VersionSpecificValues.has_key(version):
-    sys.stderr.write("%s: version '%s' is not valid - use -h for help\n" % (program, version))
-    sys.exit(1)
-
-# Grab the version-specific items we need to use
-versionHeader = VersionSpecificValues[version]['header']
-versionExtHeader = VersionSpecificValues[version]['extheader']
-
-# If we get to here, we're good to go.  The "version" parameter
-# directs GetDispatchedFunctions to only allow functions from
-# that "category" (version in our parlance).  This allows 
-# functions with different declarations in different categories
-# to exist (glTexImage2D, for example, is different between
-# GLES1 and GLES2).
-keys = apiutil.GetAllFunctions(functionList, version)
-
-allSpecials = apiutil.AllSpecials()
-
-print """/* DO NOT EDIT *************************************************
- * THIS FILE AUTOMATICALLY GENERATED BY THE %s SCRIPT
- * API specification file:   %s
- * GLES version:             %s
- * date:                     %s
- */
-""" % (program, functionList, version, time.strftime("%Y-%m-%d %H:%M:%S"))
-
-# The headers we choose are version-specific.
-print """
-#include "%s"
-#include "%s"
-""" % (versionHeader, versionExtHeader)
-
-# Everyone needs these types.
-print """
-/* These types are needed for the Mesa veneer, but are not defined in
- * the standard GLES headers.
- */
-typedef double GLdouble;
-typedef double GLclampd;
-
-/* This type is normally in glext.h, but needed here */
-typedef char GLchar;
-
-/* Mesa error handling requires these */
-extern void *_mesa_get_current_context(void);
-extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
-
-#include "main/compiler.h"
-#include "main/api_exec.h"
-
-#include "main/dispatch.h"
-
-#if FEATURE_remap_table
-
-#include "main/remap.h"
-
-#ifdef IN_DRI_DRIVER
-#define _GLAPI_USE_REMAP_TABLE
-#endif
-
-#define need_MESA_remap_table
-#include "main/remap_helper.h"
-
-void
-_mesa_init_remap_table(void)
-{
-   _mesa_do_init_remap_table(_mesa_function_pool,
-                             driDispatchRemapTable_size,
-                             MESA_remap_table_functions);
-}
-
-void
-_mesa_map_static_functions(void)
-{
-}
-
-#endif
-
-typedef void (*_glapi_proc)(void); /* generic function pointer */
-"""
-
-# Finally we get to the all-important functions
-print """/*************************************************************
- * Generated functions begin here
- */
-"""
-for funcName in keys:
-    if verbose > 0: sys.stderr.write("%s: processing function %s\n" % (program, funcName))
-
-    # start figuring out what this function will look like.
-    returnType = apiutil.ReturnType(funcName)
-    props = apiutil.Properties(funcName)
-    params = apiutil.Parameters(funcName)
-    declarationString = apiutil.MakeDeclarationString(params)
-
-    # In case of error, a function may have to return.  Make
-    # sure we have valid return values in this case.
-    if returnType == "void":
-        errorReturn = "return"
-    elif returnType == "GLboolean":
-        errorReturn = "return GL_FALSE"
-    else:
-        errorReturn = "return (%s) 0" % returnType
-
-    # These are the output of this large calculation block.
-    # passthroughDeclarationString: a typed set of parameters that
-    # will be used to create the "extern" reference for the
-    # underlying Mesa or support function.  Note that as generated
-    # these have an extra ", " at the beginning, which will be
-    # removed before use.
-    # 
-    # passthroughDeclarationString: an untyped list of parameters
-    # that will be used to call the underlying Mesa or support
-    # function (including references to converted parameters).
-    # This will also be generated with an extra ", " at the
-    # beginning, which will be removed before use.
-    #
-    # variables: C code to create any local variables determined to
-    # be necessary.
-    # conversionCodeOutgoing: C code to convert application parameters
-    # to a necessary type before calling the underlying support code.
-    # May be empty if no conversion is required.  
-    # conversionCodeIncoming: C code to do the converse: convert 
-    # values returned by underlying Mesa code to the types needed
-    # by the application.
-    # Note that *either* the conversionCodeIncoming will be used (for
-    # generated query functions), *or* the conversionCodeOutgoing will
-    # be used (for generated non-query functions), never both.
-    passthroughFuncName = ""
-    passthroughDeclarationString = ""
-    passthroughCallString = ""
-    variables = []
-    conversionCodeOutgoing = []
-    conversionCodeIncoming = []
-    switchCode = []
-
-    # Calculate the name of the underlying support function to call.
-    # By default, the passthrough function is named _mesa_<funcName>.
-    # We're allowed to override the prefix and/or the function name
-    # for each function record, though.  The "ConversionFunction"
-    # utility is poorly named, BTW...
-    if funcName in allSpecials:
-        # perform checks and pass through
-        funcPrefix = "_check_"
-        aliasprefix = "_es_"
-    else:
-        funcPrefix = "_es_"
-        aliasprefix = apiutil.AliasPrefix(funcName)
-    alias = apiutil.ConversionFunction(funcName)
-    if not alias:
-        # There may still be a Mesa alias for the function
-        if apiutil.Alias(funcName):
-            passthroughFuncName = "%s%s" % (aliasprefix, apiutil.Alias(funcName))
-        else:
-            passthroughFuncName = "%s%s" % (aliasprefix, funcName)
-    else: # a specific alias is provided
-        passthroughFuncName = "%s%s" % (aliasprefix, alias)
-
-    # Look at every parameter: each one may have only specific
-    # allowed values, or dependent parameters to check, or 
-    # variant-sized vector arrays to calculate
-    for (paramName, paramType, paramMaxVecSize, paramConvertToType, paramValidValues, paramValueConversion) in params:
-        # We'll need this below if we're doing conversions
-        (paramBaseType, paramTypeModifiers) = GetBaseType(paramType)
-
-        # Conversion management.
-        # We'll handle three cases, easiest to hardest: a parameter
-        # that doesn't require conversion, a scalar parameter that
-        # requires conversion, and a vector parameter that requires
-        # conversion.
-        if paramConvertToType == None:
-            # Unconverted parameters are easy, whether they're vector
-            # or scalar - just add them to the call list.  No conversions
-            # or anything to worry about.
-            passthroughDeclarationString += ", %s %s" % (paramType, paramName)
-            passthroughCallString += ", %s" % paramName
-
-        elif paramMaxVecSize == 0: # a scalar parameter that needs conversion
-            # A scalar to hold a converted parameter
-            variables.append("    %s converted_%s;" % (paramConvertToType, paramName))
-
-            # Outgoing conversion depends on whether we have to conditionally
-            # perform value conversion.
-            if paramValueConversion == "none":
-                conversionCodeOutgoing.append("    converted_%s = (%s) %s;" % (paramName, paramConvertToType, paramName))
-            elif paramValueConversion == "some":
-                # We'll need a conditional variable to keep track of
-                # whether we're converting values or not.
-                if ("    int convert_%s_value = 1;" % paramName) not in variables:
-                    variables.append("    int convert_%s_value = 1;" % paramName)
-
-                # Write code based on that conditional.
-                conversionCodeOutgoing.append("    if (convert_%s_value) {" % paramName)
-                conversionCodeOutgoing.append("        converted_%s = %s;" % (paramName, ConvertValue(paramName, paramBaseType, paramConvertToType))) 
-                conversionCodeOutgoing.append("    } else {")
-                conversionCodeOutgoing.append("        converted_%s = (%s) %s;" % (paramName, paramConvertToType, paramName))
-                conversionCodeOutgoing.append("    }")
-            else: # paramValueConversion == "all"
-                conversionCodeOutgoing.append("    converted_%s = %s;" % (paramName, ConvertValue(paramName, paramBaseType, paramConvertToType)))
-
-            # Note that there can be no incoming conversion for a
-            # scalar parameter; changing the scalar will only change
-            # the local value, and won't ultimately change anything
-            # that passes back to the application.
-
-            # Call strings.  The unusual " ".join() call will join the
-            # array of parameter modifiers with spaces as separators.
-            passthroughDeclarationString += ", %s %s %s" % (paramConvertToType, " ".join(paramTypeModifiers), paramName)
-            passthroughCallString += ", converted_%s" % paramName
-
-        else: # a vector parameter that needs conversion
-            # We'll need an index variable for conversions
-            if "    register unsigned int i;" not in variables:
-                variables.append("    register unsigned int i;")
-
-            # This variable will hold the (possibly variant) size of
-            # this array needing conversion.  By default, we'll set
-            # it to the maximal size (which is correct for functions
-            # with a constant-sized vector parameter); for true
-            # variant arrays, we'll modify it with other code.
-            variables.append("    unsigned int n_%s = %d;" % (paramName, paramMaxVecSize))
-
-            # This array will hold the actual converted values.
-            variables.append("    %s converted_%s[%d];" % (paramConvertToType, paramName, paramMaxVecSize))
-
-            # Again, we choose the conversion code based on whether we
-            # have to always convert values, never convert values, or 
-            # conditionally convert values.
-            if paramValueConversion == "none":
-                conversionCodeOutgoing.append("    for (i = 0; i < n_%s; i++) {" % paramName)
-                conversionCodeOutgoing.append("        converted_%s[i] = (%s) %s[i];" % (paramName, paramConvertToType, paramName))
-                conversionCodeOutgoing.append("    }")
-            elif paramValueConversion == "some":
-                # We'll need a conditional variable to keep track of
-                # whether we're converting values or not.
-                if ("    int convert_%s_value = 1;" % paramName) not in variables:
-                    variables.append("    int convert_%s_value = 1;" % paramName)
-                # Write code based on that conditional.
-                conversionCodeOutgoing.append("    if (convert_%s_value) {" % paramName)
-                conversionCodeOutgoing.append("        for (i = 0; i < n_%s; i++) {" % paramName)
-                conversionCodeOutgoing.append("            converted_%s[i] = %s;" % (paramName, ConvertValue("%s[i]" % paramName, paramBaseType, paramConvertToType))) 
-                conversionCodeOutgoing.append("        }")
-                conversionCodeOutgoing.append("    } else {")
-                conversionCodeOutgoing.append("        for (i = 0; i < n_%s; i++) {" % paramName)
-                conversionCodeOutgoing.append("            converted_%s[i] = (%s) %s[i];" % (paramName, paramConvertToType, paramName))
-                conversionCodeOutgoing.append("        }")
-                conversionCodeOutgoing.append("    }")
-            else: # paramValueConversion == "all"
-                conversionCodeOutgoing.append("    for (i = 0; i < n_%s; i++) {" % paramName)
-                conversionCodeOutgoing.append("        converted_%s[i] = %s;" % (paramName, ConvertValue("%s[i]" % paramName, paramBaseType, paramConvertToType)))
-
-                conversionCodeOutgoing.append("    }")
-
-            # If instead we need an incoming conversion (i.e. results
-            # from Mesa have to be converted before handing back
-            # to the application), this is it.  Fortunately, we don't
-            # have to worry about conditional value conversion - the
-            # functions that do (e.g. glGetFixedv()) are handled
-            # specially, outside this code generation.
-            #
-            # Whether we use incoming conversion or outgoing conversion
-            # is determined later - we only ever use one or the other.
-
-            if paramValueConversion == "none":
-                conversionCodeIncoming.append("    for (i = 0; i < n_%s; i++) {" % paramName)
-                conversionCodeIncoming.append("        %s[i] = (%s) converted_%s[i];" % (paramName, paramConvertToType, paramName))
-                conversionCodeIncoming.append("    }")
-            elif paramValueConversion == "some":
-                # We'll need a conditional variable to keep track of
-                # whether we're converting values or not.
-                if ("    int convert_%s_value = 1;" % paramName) not in variables:
-                    variables.append("    int convert_%s_value = 1;" % paramName)
-
-                # Write code based on that conditional.
-                conversionCodeIncoming.append("    if (convert_%s_value) {" % paramName)
-                conversionCodeIncoming.append("        for (i = 0; i < n_%s; i++) {" % paramName)
-                conversionCodeIncoming.append("            %s[i] = %s;" % (paramName, ConvertValue("converted_%s[i]" % paramName, paramConvertToType, paramBaseType))) 
-                conversionCodeIncoming.append("        }")
-                conversionCodeIncoming.append("    } else {")
-                conversionCodeIncoming.append("        for (i = 0; i < n_%s; i++) {" % paramName)
-                conversionCodeIncoming.append("            %s[i] = (%s) converted_%s[i];" % (paramName, paramBaseType, paramName))
-                conversionCodeIncoming.append("        }")
-                conversionCodeIncoming.append("    }")
-            else: # paramValueConversion == "all"
-                conversionCodeIncoming.append("    for (i = 0; i < n_%s; i++) {" % paramName)
-                conversionCodeIncoming.append("        %s[i] = %s;" % (paramName, ConvertValue("converted_%s[i]" % paramName, paramConvertToType, paramBaseType)))
-                conversionCodeIncoming.append("    }")
-
-            # Call strings.  The unusual " ".join() call will join the
-            # array of parameter modifiers with spaces as separators.
-            passthroughDeclarationString += ", %s %s %s" % (paramConvertToType, " ".join(paramTypeModifiers), paramName)
-            passthroughCallString += ", converted_%s" % paramName
-
-        # endif conversion management
-
-        # Parameter checking.  If the parameter has a specific list of
-        # valid values, we have to make sure that the passed-in values
-        # match these, or we make an error.
-        if len(paramValidValues) > 0:
-            # We're about to make a big switch statement with an
-            # error at the end.  By default, the error is GL_INVALID_ENUM,
-            # unless we find a "case" statement in the middle with a
-            # non-GLenum value.
-            errorDefaultCase = "GL_INVALID_ENUM"
-
-            # This parameter has specific valid values.  Make a big
-            # switch statement to handle it.  Note that the original
-            # parameters are always what is checked, not the
-            # converted parameters.
-            switchCode.append("    switch(%s) {" % paramName)
-
-            for valueIndex in range(len(paramValidValues)):
-                (paramValue, dependentVecSize, dependentParamName, dependentValidValues, errorCode, valueConvert) = paramValidValues[valueIndex]
-
-                # We're going to need information on the dependent param
-                # as well.
-                if dependentParamName:
-                    depParamIndex = apiutil.FindParamIndex(params, dependentParamName)
-                    if depParamIndex == None:
-                        sys.stderr.write("%s: can't find dependent param '%s' for function '%s'\n" % (program, dependentParamName, funcName))
-
-                    (depParamName, depParamType, depParamMaxVecSize, depParamConvertToType, depParamValidValues, depParamValueConversion) = params[depParamIndex]
-                else:
-                    (depParamName, depParamType, depParamMaxVecSize, depParamConvertToType, depParamValidValues, depParamValueConversion) = (None, None, None, None, [], None)
-
-                # This is a sneaky trick.  It's valid syntax for a parameter
-                # that is *not* going to be converted to be declared
-                # with a dependent vector size; but in this case, the
-                # dependent vector size is unused and unnecessary.
-                # So check for this and ignore the dependent vector size
-                # if the parameter is not going to be converted.
-                if depParamConvertToType:
-                    usedDependentVecSize = dependentVecSize
-                else:
-                    usedDependentVecSize = None
-
-                # We'll peek ahead at the next parameter, to see whether
-                # we can combine cases
-                if valueIndex + 1 < len(paramValidValues) :
-                    (nextParamValue, nextDependentVecSize, nextDependentParamName, nextDependentValidValues, nextErrorCode, nextValueConvert) = paramValidValues[valueIndex + 1]
-                    if depParamConvertToType:
-                        usedNextDependentVecSize = nextDependentVecSize
-                    else:
-                        usedNextDependentVecSize = None
-
-                # Create a case for this value.  As a mnemonic,
-                # if we have a dependent vector size that we're ignoring,
-                # add it as a comment.
-                if usedDependentVecSize == None and dependentVecSize != None:
-                    switchCode.append("        case %s: /* size %s */" % (paramValue, dependentVecSize))
-                else:
-                    switchCode.append("        case %s:" % paramValue)
-
-                # If this is not a GLenum case, then switch our error
-                # if no value is matched to be GL_INVALID_VALUE instead
-                # of GL_INVALID_ENUM.  (Yes, this does get confused
-                # if there are both values and GLenums in the same
-                # switch statement, which shouldn't happen.)
-                if paramValue[0:3] != "GL_":
-                    errorDefaultCase = "GL_INVALID_VALUE"
-
-                # If all the remaining parameters are identical to the
-                # next set, then we're done - we'll just create the
-                # official code on the next pass through, and the two
-                # cases will share the code.
-                if valueIndex + 1 < len(paramValidValues) and usedDependentVecSize == usedNextDependentVecSize and dependentParamName == nextDependentParamName and dependentValidValues == nextDependentValidValues and errorCode == nextErrorCode and valueConvert == nextValueConvert:
-                    continue
-
-                # Otherwise, we'll have to generate code for this case.
-                # Start off with a check: if there is a dependent parameter,
-                # and a list of valid values for that parameter, we need
-                # to generate an error if something other than one
-                # of those values is passed.
-                if len(dependentValidValues) > 0:
-                    conditional=""
-
-                    # If the parameter being checked is actually an array,
-                    # check only its first element.
-                    if depParamMaxVecSize == 0:
-                        valueToCheck = dependentParamName
-                    else:
-                        valueToCheck = "%s[0]" % dependentParamName
-
-                    for v in dependentValidValues:
-                        conditional += " && %s != %s" % (valueToCheck, v)
-                    switchCode.append("            if (%s) {" % conditional[4:])
-                    if errorCode == None:
-                        errorCode = "GL_INVALID_ENUM"
-                    switchCode.append('                _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s=0x%s)", %s);' % (errorCode, funcName, paramName, "%x", paramName))
-                    switchCode.append("                %s;" % errorReturn)
-                    switchCode.append("            }")
-                # endif there are dependent valid values
-
-                # The dependent parameter may require conditional
-                # value conversion.  If it does, and we don't want
-                # to convert values, we'll have to generate code for that
-                if depParamValueConversion == "some" and valueConvert == "noconvert":
-                    switchCode.append("            convert_%s_value = 0;" % dependentParamName)
-
-                # If there's a dependent vector size for this parameter
-                # that we're actually going to use (i.e. we need conversion),
-                # mark it.
-                if usedDependentVecSize:
-                    switchCode.append("            n_%s = %s;" % (dependentParamName, dependentVecSize))
-
-                # In all cases, break out of the switch if any valid
-                # value is found.
-                switchCode.append("            break;")
-
-
-            # Need a default case to catch all the other, invalid
-            # parameter values.  These will all generate errors.
-            switchCode.append("        default:")
-            if errorCode == None:
-                errorCode = "GL_INVALID_ENUM"
-            formatString = GetFormatString(paramType)
-            if formatString == None:
-                switchCode.append('            _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s)");' % (errorCode, funcName, paramName))
-            else:
-                switchCode.append('            _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s=%s)", %s);' % (errorCode, funcName, paramName, formatString, paramName))
-            switchCode.append("            %s;" % errorReturn)
-
-            # End of our switch code.
-            switchCode.append("    }")
-
-        # endfor every recognized parameter value
-
-    # endfor every param
-
-    # Here, the passthroughDeclarationString and passthroughCallString
-    # are complete; remove the extra ", " at the front of each.
-    passthroughDeclarationString = passthroughDeclarationString[2:]
-    passthroughCallString = passthroughCallString[2:]
-
-    # The Mesa functions are scattered across all the Mesa
-    # header files.  The easiest way to manage declarations
-    # is to create them ourselves.
-    if funcName in allSpecials:
-        print "/* this function is special and is defined elsewhere */"
-    print "extern %s GLAPIENTRY %s(%s);" % (returnType, passthroughFuncName, passthroughDeclarationString)
-
-    # A function may be a core function (i.e. it exists in
-    # the core specification), a core addition (extension
-    # functions added officially to the core), a required
-    # extension (usually an extension for an earlier version
-    # that has been officially adopted), or an optional extension.
-    #
-    # Core functions have a simple category (e.g. "GLES1.1");
-    # we generate only a simple callback for them.
-    #
-    # Core additions have two category listings, one simple
-    # and one compound (e.g.  ["GLES1.1", "GLES1.1:OES_fixed_point"]).  
-    # We generate the core function, and also an extension function.
-    #
-    # Required extensions and implemented optional extensions
-    # have a single compound category "GLES1.1:OES_point_size_array".
-    # For these we generate just the extension function.
-    for categorySpec in apiutil.Categories(funcName):
-        compoundCategory = categorySpec.split(":")
-
-        # This category isn't for us, if the base category doesn't match
-        # our version
-        if compoundCategory[0] != version:
-            continue
-
-        # Otherwise, determine if we're writing code for a core
-        # function (no suffix) or an extension function.
-        if len(compoundCategory) == 1:
-            # This is a core function
-            extensionName = None
-            extensionSuffix = ""
-        else:
-            # This is an extension function.  We'll need to append
-            # the extension suffix.
-            extensionName = compoundCategory[1]
-            extensionSuffix = extensionName.split("_")[0]
-        fullFuncName = funcPrefix + funcName + extensionSuffix
-
-        # Now the generated function.  The text used to mark an API-level
-        # function, oddly, is version-specific.
-        if extensionName:
-            print "/* Extension %s */" % extensionName
-
-        if (not variables and
-            not switchCode and
-            not conversionCodeOutgoing and
-            not conversionCodeIncoming):
-            # pass through directly
-            print "#define %s %s" % (fullFuncName, passthroughFuncName)
-            print
-            continue
-
-        print "static %s %s(%s)" % (returnType, fullFuncName, declarationString)
-        print "{"
-
-        # Start printing our code pieces.  Start with any local
-        # variables we need.  This unusual syntax joins the 
-        # lines in the variables[] array with the "\n" separator.
-        if len(variables) > 0:
-            print "\n".join(variables) + "\n"
-
-        # If there's any sort of parameter checking or variable
-        # array sizing, the switch code will contain it.
-        if len(switchCode) > 0:
-            print "\n".join(switchCode) + "\n"
-
-        # In the case of an outgoing conversion (i.e. parameters must
-        # be converted before calling the underlying Mesa function),
-        # use the appropriate code.
-        if "get" not in props and len(conversionCodeOutgoing) > 0:
-            print "\n".join(conversionCodeOutgoing) + "\n"
-
-        # Call the Mesa function.  Note that there are very few functions
-        # that return a value (i.e. returnType is not "void"), and that
-        # none of them require incoming translation; so we're safe
-        # to generate code that directly returns in those cases,
-        # even though it's not completely independent.
-
-        if returnType == "void":
-            print "    %s(%s);" % (passthroughFuncName, passthroughCallString)
-        else:
-            print "    return %s(%s);" % (passthroughFuncName, passthroughCallString)
-
-        # If the function is one that returns values (i.e. "get" in props),
-        # it might return values of a different type than we need, that
-        # require conversion before passing back to the application.
-        if "get" in props and len(conversionCodeIncoming) > 0:
-            print "\n".join(conversionCodeIncoming)
-
-        # All done.
-        print "}"
-        print
-    # end for each category provided for a function
-
-# end for each function
-
-print "struct _glapi_table *"
-print "_mesa_create_exec_table(void)"
-print "{"
-print "   struct _glapi_table *exec;"
-print "   exec = _mesa_alloc_dispatch_table(sizeof *exec);"
-print "   if (exec == NULL)"
-print "      return NULL;"
-print ""
-
-for func in keys:
-    prefix = "_es_" if func not in allSpecials else "_check_"
-    for spec in apiutil.Categories(func):
-        ext = spec.split(":")
-        # version does not match
-        if ext.pop(0) != version:
-            continue
-        entry = func
-        if ext:
-            suffix = ext[0].split("_")[0]
-            entry += suffix
-        print "    SET_%s(exec, %s%s);" % (entry, prefix, entry)
-print ""
-print "   return exec;"
-print "}"
index b08069bce5225a9a1341f686da9c00bd4b2c3b7f..0f682f507e90970317e1bb7d4e71a66e5cebea5a 100644 (file)
@@ -3,7 +3,6 @@ include $(MESA)/sources.mak
 # LOCAL sources
 
 LOCAL_ES1_SOURCES :=                   \
-       main/api_exec_es1.c             \
        main/get_es1.c                  \
        main/drawtex.c                  \
        main/es_cpaltex.c               \
@@ -28,7 +27,6 @@ LOCAL_ES1_INCLUDES :=                 \
        -I$(MESA)/state_tracker
 
 LOCAL_ES2_SOURCES :=                   \
-       main/api_exec_es2.c             \
        main/get_es2.c                  \
        main/es_cpaltex.c               \
        main/es_fbo.c                   \
diff --git a/src/mesa/main/APIspec.dtd b/src/mesa/main/APIspec.dtd
new file mode 100644 (file)
index 0000000..efcfa31
--- /dev/null
@@ -0,0 +1,52 @@
+<!ELEMENT apispec (template|api)+>
+
+<!ELEMENT api (category*, function*)>
+<!ELEMENT category EMPTY>
+<!ELEMENT function EMPTY>
+
+<!ELEMENT template (proto, desc*)>
+<!ELEMENT proto (return, (param|vector)*)>
+<!ELEMENT return EMPTY>
+<!ELEMENT param EMPTY>
+<!ELEMENT vector (param*)>
+<!ELEMENT desc ((value|range)*, desc*)>
+<!ELEMENT value EMPTY>
+<!ELEMENT range EMPTY>
+
+<!ATTLIST api      name                NMTOKEN #REQUIRED
+                   implementation      (true | false) "false">
+<!ATTLIST category name                NMTOKEN #REQUIRED>
+<!ATTLIST function name                NMTOKEN #REQUIRED
+                   default_prefix      NMTOKEN "_mesa_"
+                   external            (true | false) "false"
+                   template            NMTOKEN #REQUIRED
+                   gltype              CDATA #IMPLIED
+                   vector_size         NMTOKEN #IMPLIED
+                   expand_vector       (true | false) "false"
+                   skip_desc           (true | false) "false">
+
+<!ATTLIST template name                NMTOKEN #REQUIRED
+                   direction           (set | get) "set">
+
+<!ATTLIST return   type                CDATA #REQUIRED>
+<!ATTLIST param    name                NMTOKEN #REQUIRED
+                   type                CDATA #REQUIRED
+                   hide_if_expanded    (true | false) "false"
+                   category            NMTOKEN #IMPLIED>
+<!ATTLIST vector   name                NMTOKEN #REQUIRED
+                   type                CDATA #REQUIRED
+                   size                NMTOKEN #REQUIRED
+                   category            NMTOKEN #IMPLIED>
+
+<!ATTLIST desc     name                NMTOKEN #REQUIRED
+                   vector_size         CDATA #IMPLIED
+                   convert             (true | false) #IMPLIED
+                   error               NMTOKEN "GL_INVALID_ENUM"
+                   category            NMTOKEN #IMPLIED>
+
+<!ATTLIST value    name                CDATA #REQUIRED
+                   category            NMTOKEN #IMPLIED>
+<!ATTLIST range    from                NMTOKEN #REQUIRED
+                   to                  NMTOKEN #REQUIRED
+                   base                NMTOKEN #IMPLIED
+                   category            NMTOKEN #IMPLIED>
diff --git a/src/mesa/main/APIspec.py b/src/mesa/main/APIspec.py
new file mode 100644 (file)
index 0000000..6947f73
--- /dev/null
@@ -0,0 +1,617 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
+#
+# 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.
+"""
+A parser for APIspec.
+"""
+
+class SpecError(Exception):
+    """Error in the spec file."""
+
+
+class Spec(object):
+    """A Spec is an abstraction of the API spec."""
+
+    def __init__(self, doc):
+        self.doc = doc
+
+        self.spec_node = doc.getRootElement()
+        self.tmpl_nodes = {}
+        self.api_nodes = {}
+        self.impl_node = None
+
+        # parse <apispec>
+        node = self.spec_node.children
+        while node:
+            if node.type == "element":
+                if node.name == "template":
+                    self.tmpl_nodes[node.prop("name")] = node
+                elif node.name == "api":
+                    self.api_nodes[node.prop("name")] = node
+                else:
+                    raise SpecError("unexpected node %s in apispec" %
+                            node.name)
+            node = node.next
+
+        # find an implementation
+        for name, node in self.api_nodes.iteritems():
+            if node.prop("implementation") == "true":
+                self.impl_node = node
+                break
+        if not self.impl_node:
+            raise SpecError("unable to find an implementation")
+
+    def get_impl(self):
+        """Return the implementation."""
+        return API(self, self.impl_node)
+
+    def get_api(self, name):
+        """Return an API."""
+        return API(self, self.api_nodes[name])
+
+
+class API(object):
+    """An API consists of categories and functions."""
+
+    def __init__(self, spec, api_node):
+        self.name = api_node.prop("name")
+        self.is_impl = (api_node.prop("implementation") == "true")
+
+        self.categories = []
+        self.functions = []
+
+        # parse <api>
+        func_nodes = []
+        node = api_node.children
+        while node:
+            if node.type == "element":
+                if node.name == "category":
+                    cat = node.prop("name")
+                    self.categories.append(cat)
+                elif node.name == "function":
+                    func_nodes.append(node)
+                else:
+                    raise SpecError("unexpected node %s in api" % node.name)
+            node = node.next
+
+        # realize functions
+        for func_node in func_nodes:
+            tmpl_node = spec.tmpl_nodes[func_node.prop("template")]
+            try:
+                func = Function(tmpl_node, func_node, self.is_impl,
+                                self.categories)
+            except SpecError, e:
+                func_name = func_node.prop("name")
+                raise SpecError("failed to parse %s: %s" % (func_name, e))
+            self.functions.append(func)
+
+    def match(self, func, conversions={}):
+        """Find a matching function in the API."""
+        match = None
+        need_conv = False
+        for f in self.functions:
+            matched, conv = f.match(func, conversions)
+            if matched:
+                match = f
+                need_conv = conv
+                # exact match
+                if not need_conv:
+                    break
+        return (match, need_conv)
+
+
+class Function(object):
+    """Parse and realize a <template> node."""
+
+    def __init__(self, tmpl_node, func_node, force_skip_desc=False, categories=[]):
+        self.tmpl_name = tmpl_node.prop("name")
+        self.direction = tmpl_node.prop("direction")
+
+        self.name = func_node.prop("name")
+        self.prefix = func_node.prop("default_prefix")
+        self.is_external = (func_node.prop("external") == "true")
+
+        if force_skip_desc:
+            self._skip_desc = True
+        else:
+            self._skip_desc = (func_node.prop("skip_desc") == "true")
+
+        self._categories = categories
+
+        # these attributes decide how the template is realized
+        self._gltype = func_node.prop("gltype")
+        if func_node.hasProp("vector_size"):
+            self._vector_size = int(func_node.prop("vector_size"))
+        else:
+            self._vector_size = 0
+        self._expand_vector = (func_node.prop("expand_vector") == "true")
+
+        self.return_type = "void"
+        param_nodes = []
+
+        # find <proto>
+        proto_node = tmpl_node.children
+        while proto_node:
+            if proto_node.type == "element" and proto_node.name == "proto":
+                break
+            proto_node = proto_node.next
+        if not proto_node:
+            raise SpecError("no proto")
+        # and parse it
+        node = proto_node.children
+        while node:
+            if node.type == "element":
+                if node.name == "return":
+                    self.return_type = node.prop("type")
+                elif node.name == "param" or node.name == "vector":
+                    if self.support_node(node):
+                        # make sure the node is not hidden
+                        if not (self._expand_vector and
+                                (node.prop("hide_if_expanded") == "true")):
+                            param_nodes.append(node)
+                else:
+                    raise SpecError("unexpected node %s in proto" % node.name)
+            node = node.next
+
+        self._init_params(param_nodes)
+        self._init_descs(tmpl_node, param_nodes)
+
+    def __str__(self):
+        return "%s %s%s(%s)" % (self.return_type, self.prefix, self.name,
+                self.param_string(True))
+
+    def _init_params(self, param_nodes):
+        """Parse and initialize parameters."""
+        self.params = []
+
+        for param_node in param_nodes:
+            size = self.param_node_size(param_node)
+            # when no expansion, vector is just like param
+            if param_node.name == "param" or not self._expand_vector:
+                param = Parameter(param_node, self._gltype, size)
+                self.params.append(param)
+                continue
+
+            if not size or size > param_node.lsCountNode():
+                raise SpecError("could not expand %s with unknown or "
+                                "mismatch sizes" % param.name)
+
+            # expand the vector
+            expanded_params = []
+            child = param_node.children
+            while child:
+                if (child.type == "element" and child.name == "param" and
+                    self.support_node(child)):
+                    expanded_params.append(Parameter(child, self._gltype))
+                    if len(expanded_params) == size:
+                        break
+                child = child.next
+            # just in case that lsCountNode counts unknown nodes
+            if len(expanded_params) < size:
+                raise SpecError("not enough named parameters")
+
+            self.params.extend(expanded_params)
+
+    def _init_descs(self, tmpl_node, param_nodes):
+        """Parse and initialize parameter descriptions."""
+        self.checker = Checker()
+        if self._skip_desc:
+            return
+
+        node = tmpl_node.children
+        while node:
+            if node.type == "element" and node.name == "desc":
+                if self.support_node(node):
+                    # parse <desc>
+                    desc = Description(node, self._categories)
+                    self.checker.add_desc(desc)
+            node = node.next
+
+        self.checker.validate(self, param_nodes)
+
+    def support_node(self, node):
+        """Return true if a node is in the supported category."""
+        return (not node.hasProp("category") or
+                node.prop("category") in self._categories)
+
+    def get_param(self, name):
+        """Return the named parameter."""
+        for param in self.params:
+            if param.name == name:
+                return param
+        return None
+
+    def param_node_size(self, param):
+        """Return the size of a vector."""
+        if param.name != "vector":
+            return 0
+
+        size = param.prop("size")
+        if size.isdigit():
+            size = int(size)
+        else:
+            size = 0
+        if not size:
+            size = self._vector_size
+            if not size and self._expand_vector:
+                # return the number of named parameters
+                size = param.lsCountNode()
+        return size
+
+    def param_string(self, declaration):
+        """Return the C code of the parameters."""
+        args = []
+        if declaration:
+            for param in self.params:
+                sep = "" if param.type.endswith("*") else " "
+                args.append("%s%s%s" % (param.type, sep, param.name))
+            if not args:
+                args.append("void")
+        else:
+            for param in self.params:
+                args.append(param.name)
+        return ", ".join(args)
+
+    def match(self, other, conversions={}):
+        """Return true if the functions match, probably with a conversion."""
+        if (self.tmpl_name != other.tmpl_name or
+            self.return_type != other.return_type or
+            len(self.params) != len(other.params)):
+            return (False, False)
+
+        need_conv = False
+        for i in xrange(len(self.params)):
+            src = other.params[i]
+            dst = self.params[i]
+            if (src.is_vector != dst.is_vector or src.size != dst.size):
+                return (False, False)
+            if src.type != dst.type:
+                if dst.base_type() in conversions.get(src.base_type(), []):
+                    need_conv = True
+                else:
+                    # unable to convert
+                    return (False, False)
+
+        return (True, need_conv)
+
+
+class Parameter(object):
+    """A parameter of a function."""
+
+    def __init__(self, param_node, gltype=None, size=0):
+        self.is_vector = (param_node.name == "vector")
+
+        self.name = param_node.prop("name")
+        self.size = size
+
+        type = param_node.prop("type")
+        if gltype:
+            type = type.replace("GLtype", gltype)
+        elif type.find("GLtype") != -1:
+            raise SpecError("parameter %s has unresolved type" % self.name)
+
+        self.type = type
+
+    def base_type(self):
+        """Return the base GL type by stripping qualifiers."""
+        return [t for t in self.type.split(" ") if t.startswith("GL")][0]
+
+
+class Checker(object):
+    """A checker is the collection of all descriptions on the same level.
+    Descriptions of the same parameter are concatenated.
+    """
+
+    def __init__(self):
+        self.switches = {}
+        self.switch_constants = {}
+
+    def add_desc(self, desc):
+        """Add a description."""
+        # TODO allow index to vary
+        const_attrs = ["index", "error", "convert", "size_str"]
+        if desc.name not in self.switches:
+            self.switches[desc.name] = []
+            self.switch_constants[desc.name] = {}
+            for attr in const_attrs:
+                self.switch_constants[desc.name][attr] = None
+
+        # some attributes, like error code, should be the same for all descs
+        consts = self.switch_constants[desc.name]
+        for attr in const_attrs:
+            if getattr(desc, attr) is not None:
+                if (consts[attr] is not None and
+                    consts[attr] != getattr(desc, attr)):
+                    raise SpecError("mismatch %s for %s" % (attr, desc.name))
+                consts[attr] = getattr(desc, attr)
+
+        self.switches[desc.name].append(desc)
+
+    def validate(self, func, param_nodes):
+        """Validate the checker against a function."""
+        tmp = Checker()
+
+        for switch in self.switches.itervalues():
+            valid_descs = []
+            for desc in switch:
+                if desc.validate(func, param_nodes):
+                    valid_descs.append(desc)
+            # no possible values
+            if not valid_descs:
+                return False
+            for desc in valid_descs:
+                if not desc._is_noop:
+                    tmp.add_desc(desc)
+
+        self.switches = tmp.switches
+        self.switch_constants = tmp.switch_constants
+        return True
+
+    def flatten(self, name=None):
+        """Return a flat list of all descriptions of the named parameter."""
+        flat_list = []
+        for switch in self.switches.itervalues():
+            for desc in switch:
+                if not name or desc.name == name:
+                    flat_list.append(desc)
+                flat_list.extend(desc.checker.flatten(name))
+        return flat_list
+
+    def always_check(self, name):
+        """Return true if the parameter is checked in all possible pathes."""
+        if name in self.switches:
+            return True
+
+        # a param is always checked if any of the switch always checks it
+        for switch in self.switches.itervalues():
+            # a switch always checks it if all of the descs always check it
+            always = True
+            for desc in switch:
+                if not desc.checker.always_check(name):
+                    always = False
+                    break
+            if always:
+                return True
+        return False
+
+    def _c_switch(self, name, indent="\t"):
+        """Output C switch-statement for the named parameter, for debug."""
+        switch = self.switches.get(name, [])
+        # make sure there are valid values
+        need_switch = False
+        for desc in switch:
+            if desc.values:
+                need_switch = True
+        if not need_switch:
+            return []
+
+        stmts = []
+        var = switch[0].name
+        if switch[0].index >= 0:
+            var += "[%d]" % switch[0].index
+        stmts.append("switch (%s) { /* assume GLenum */" % var)
+
+        for desc in switch:
+            if desc.values:
+                for val in desc.values:
+                    stmts.append("case %s:" % val)
+                for dep_name in desc.checker.switches.iterkeys():
+                    dep_stmts = [indent + s for s in desc.checker._c_switch(dep_name, indent)]
+                    stmts.extend(dep_stmts)
+                stmts.append(indent + "break;")
+
+        stmts.append("default:")
+        stmts.append(indent + "ON_ERROR(%s);" % switch[0].error);
+        stmts.append(indent + "break;")
+        stmts.append("}")
+
+        return stmts
+
+    def dump(self, indent="\t"):
+        """Dump the descriptions in C code."""
+        stmts = []
+        for name in self.switches.iterkeys():
+            c_switch = self._c_switch(name)
+            print "\n".join(c_switch)
+
+
+class Description(object):
+    """A description desribes a parameter and its relationship with other
+    parameters.
+    """
+
+    def __init__(self, desc_node, categories=[]):
+        self._categories = categories
+        self._is_noop = False
+
+        self.name = desc_node.prop("name")
+        self.index = -1
+
+        self.error = desc_node.prop("error") or "GL_INVALID_ENUM"
+        # vector_size may be C code
+        self.size_str = desc_node.prop("vector_size")
+
+        self._has_enum = False
+        self.values = []
+        dep_nodes = []
+
+        # parse <desc>
+        valid_names = ["value", "range", "desc"]
+        node = desc_node.children
+        while node:
+            if node.type == "element":
+                if node.name in valid_names:
+                    # ignore nodes that require unsupported categories
+                    if (node.prop("category") and
+                        node.prop("category") not in self._categories):
+                        node = node.next
+                        continue
+                else:
+                    raise SpecError("unexpected node %s in desc" % node.name)
+
+                if node.name == "value":
+                    val = node.prop("name")
+                    if not self._has_enum and val.startswith("GL_"):
+                        self._has_enum = True
+                    self.values.append(val)
+                elif node.name == "range":
+                    first = int(node.prop("from"))
+                    last = int(node.prop("to"))
+                    base = node.prop("base") or ""
+                    if not self._has_enum and base.startswith("GL_"):
+                        self._has_enum = True
+                    # expand range
+                    for i in xrange(first, last + 1):
+                        self.values.append("%s%d" % (base, i))
+                else: # dependent desc
+                    dep_nodes.append(node)
+            node = node.next
+
+        # default to convert if there is no enum
+        self.convert = not self._has_enum
+        if desc_node.hasProp("convert"):
+            self.convert = (desc_node.prop("convert") == "true")
+
+        self._init_deps(dep_nodes)
+
+    def _init_deps(self, dep_nodes):
+        """Parse and initialize dependents."""
+        self.checker = Checker()
+
+        for dep_node in dep_nodes:
+            # recursion!
+            dep = Description(dep_node, self._categories)
+            self.checker.add_desc(dep)
+
+    def _search_param_node(self, param_nodes, name=None):
+        """Search the template parameters for the named node."""
+        param_node = None
+        param_index = -1
+
+        if not name:
+            name = self.name
+        for node in param_nodes:
+            if name == node.prop("name"):
+                param_node = node
+            elif node.name == "vector":
+                child = node.children
+                idx = 0
+                while child:
+                    if child.type == "element" and child.name == "param":
+                        if name == child.prop("name"):
+                            param_node = node
+                            param_index = idx
+                            break
+                        idx += 1
+                    child = child.next
+            if param_node:
+                break
+        return (param_node, param_index)
+
+    def _find_final(self, func, param_nodes):
+        """Find the final parameter."""
+        param = func.get_param(self.name)
+        param_index = -1
+
+        # the described param is not in the final function
+        if not param:
+            # search the template parameters
+            node, index = self._search_param_node(param_nodes)
+            if not node:
+                raise SpecError("invalid desc %s in %s" %
+                        (self.name, func.name))
+
+            # a named parameter of a vector
+            if index >= 0:
+                param = func.get_param(node.prop("name"))
+                param_index = index
+            elif node.name == "vector":
+                # must be an expanded vector, check its size
+                if self.size_str and self.size_str.isdigit():
+                    size = int(self.size_str)
+                    expanded_size = func.param_node_size(node)
+                    if size != expanded_size:
+                        return (False, None, -1)
+            # otherwise, it is a valid, but no-op, description
+
+        return (True, param, param_index)
+
+    def validate(self, func, param_nodes):
+        """Validate a description against certain function."""
+        if self.checker.switches and not self.values:
+            raise SpecError("no valid values for %s" % self.name)
+
+        valid, param, param_index = self._find_final(func, param_nodes)
+        if not valid:
+            return False
+
+        # the description is valid, but the param is gone
+        # mark it no-op so that it will be skipped
+        if not param:
+            self._is_noop = True
+            return True
+
+        if param.is_vector:
+            # if param was known, this should have been done in __init__
+            if self._has_enum:
+                self.size_str = "1"
+            # size mismatch
+            if (param.size and self.size_str and self.size_str.isdigit() and
+                param.size != int(self.size_str)):
+                return False
+        elif self.size_str:
+            # only vector accepts vector_size
+            raise SpecError("vector_size is invalid for %s" % param.name)
+
+        if not self.checker.validate(func, param_nodes):
+            return False
+
+        # update the description
+        self.name = param.name
+        self.index = param_index
+
+        return True
+
+
+def main():
+    import libxml2
+
+    filename = "APIspec.xml"
+    apinames = ["GLES1.1", "GLES2.0"]
+
+    doc = libxml2.readFile(filename, None,
+            libxml2.XML_PARSE_DTDLOAD +
+            libxml2.XML_PARSE_DTDVALID +
+            libxml2.XML_PARSE_NOBLANKS)
+
+    spec = Spec(doc)
+    impl = spec.get_impl()
+    for apiname in apinames:
+        spec.get_api(apiname)
+
+    doc.freeDoc()
+
+    print "%s is successfully parsed" % filename
+
+
+if __name__ == "__main__":
+    main()
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
new file mode 100644 (file)
index 0000000..7e77eb7
--- /dev/null
@@ -0,0 +1,4336 @@
+<?xml version="1.0"?>
+<!DOCTYPE apispec SYSTEM "APIspec.dtd">
+
+<!-- A function is generated from a template.  Multiple functions can be
+     generated from a single template with different arguments.  For example,
+     glColor3f can be generated from
+
+     <function name="Color3f" template="Color" gltype="GLfloat" vector_size="3" expand_vector="true"/>
+
+     and glColor4iv can be generated from
+
+     <function name="Color4iv" template="Color" gltype="GLint" vector_size="4"/>
+
+     In a template, there are <desc>s that describe the properties of
+     parameters.  A <desc> can enumerate the valid values of a parameter.  It
+     can also specify the error code when an invalid value is given, and etc.
+     By nesting <desc>s, they can create dependency between parameters.
+
+     A function can be marked as external.  It means that the function cannot
+     be dispatched to the corresponding mesa function, if one exists, directly,
+     and requires an external implementation.
+-->
+
+<apispec>
+
+<template name="Color">
+       <proto>
+               <return type="void"/>
+               <vector name="v" type="const GLtype *" size="dynamic">
+                       <param name="red" type="GLtype"/>
+                       <param name="green" type="GLtype"/>
+                       <param name="blue" type="GLtype"/>
+                       <param name="alpha" type="GLtype"/>
+               </vector>
+       </proto>
+</template>
+
+<template name="ClipPlane">
+       <proto>
+               <return type="void"/>
+               <param name="plane" type="GLenum"/>
+               <vector name="equation" type="const GLtype *" size="4"/>
+       </proto>
+
+       <desc name="plane">
+               <range base="GL_CLIP_PLANE" from="0" to="5"/>
+       </desc>
+</template>
+
+<template name="CullFace">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_FRONT"/>
+               <value name="GL_BACK"/>
+               <value name="GL_FRONT_AND_BACK"/>
+       </desc>
+</template>
+
+<template name="Fog">
+       <proto>
+               <return type="void"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="const GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+        <desc name="pname">
+               <value name="GL_FOG_MODE"/>
+               <desc name="param">
+                       <value name="GL_EXP"/>
+                       <value name="GL_EXP2"/>
+                       <value name="GL_LINEAR"/>
+               </desc>
+        </desc>
+
+       <desc name="pname">
+               <value name="GL_FOG_COLOR"/>
+
+               <desc name="params" vector_size="4"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_FOG_DENSITY"/>
+               <value name="GL_FOG_START"/>
+               <value name="GL_FOG_END"/>
+
+               <desc name="params" vector_size="1"/>
+       </desc>
+</template>
+
+<template name="FrontFace">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_CW"/>
+               <value name="GL_CCW"/>
+       </desc>
+</template>
+
+<template name="Hint">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="mode" type="GLenum"/>
+       </proto>
+
+       <desc name="target" category="GLES1.1">
+               <value name="GL_FOG_HINT"/>
+               <value name="GL_LINE_SMOOTH_HINT"/>
+               <value name="GL_PERSPECTIVE_CORRECTION_HINT"/>
+               <value name="GL_POINT_SMOOTH_HINT"/>
+       </desc>
+       <desc name="target" category="OES_standard_derivatives">
+               <value name="GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES"/>
+       </desc>
+       <desc name="target">
+               <value name="GL_GENERATE_MIPMAP_HINT"/>
+       </desc>
+
+       <desc name="mode">
+               <value name="GL_FASTEST"/>
+               <value name="GL_NICEST"/>
+               <value name="GL_DONT_CARE"/>
+       </desc>
+</template>
+
+<template name="Light">
+       <proto>
+               <return type="void"/>
+               <param name="light" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="const GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="light">
+               <range base="GL_LIGHT" from="0" to="7"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_AMBIENT"/>
+               <value name="GL_DIFFUSE"/>
+               <value name="GL_SPECULAR"/>
+               <value name="GL_POSITION"/>
+
+               <desc name="params" vector_size="4"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_SPOT_DIRECTION"/>
+
+               <desc name="params" vector_size="3"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_SPOT_EXPONENT"/>
+               <value name="GL_SPOT_CUTOFF"/>
+               <value name="GL_CONSTANT_ATTENUATION"/>
+               <value name="GL_LINEAR_ATTENUATION"/>
+               <value name="GL_QUADRATIC_ATTENUATION"/>
+
+               <desc name="params" vector_size="1"/>
+       </desc>
+</template>
+
+<template name="LightModel">
+       <proto>
+               <return type="void"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="const GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="pname">
+               <value name="GL_LIGHT_MODEL_AMBIENT"/>
+
+               <desc name="params" vector_size="4"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_LIGHT_MODEL_TWO_SIDE"/>
+               <desc name="param">
+                       <value name="GL_TRUE"/>
+                       <value name="GL_FALSE"/>
+               </desc>
+       </desc>
+</template>
+
+<template name="LineWidth">
+       <proto>
+               <return type="void"/>
+               <param name="width" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="Material">
+       <proto>
+               <return type="void"/>
+               <param name="face" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="const GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="face">
+               <value name="GL_FRONT_AND_BACK"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_AMBIENT"/>
+               <value name="GL_DIFFUSE"/>
+               <value name="GL_AMBIENT_AND_DIFFUSE"/>
+               <value name="GL_SPECULAR"/>
+               <value name="GL_EMISSION"/>
+
+               <desc name="params" vector_size="4"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_SHININESS"/>
+
+               <desc name="params" vector_size="1"/>
+       </desc>
+</template>
+
+<template name="PointSize">
+       <proto>
+               <return type="void"/>
+               <param name="size" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="PointSizePointer">
+       <proto>
+               <return type="void"/>
+               <param name="type" type="GLenum"/>
+               <param name="stride" type="GLsizei"/>
+               <param name="pointer" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="type">
+               <value name="GL_FLOAT"/>
+               <value name="GL_FIXED"/>
+       </desc>
+</template>
+
+<template name="Scissor">
+       <proto>
+               <return type="void"/>
+               <param name="x" type="GLint"/>
+               <param name="y" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+       </proto>
+</template>
+
+<template name="ShadeModel">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_FLAT"/>
+               <value name="GL_SMOOTH"/>
+       </desc>
+</template>
+
+<template name="TexParameter">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="const GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_TEXTURE_WRAP_S"/>
+               <value name="GL_TEXTURE_WRAP_T"/>
+               <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/>
+
+               <desc name="param">
+                       <value name="GL_CLAMP_TO_EDGE"/>
+                       <value name="GL_REPEAT"/>
+                       <value name="GL_MIRRORED_REPEAT" category="GLES2.0"/>
+                       <value name="GL_MIRRORED_REPEAT_OES" category="OES_texture_mirrored_repeat"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_TEXTURE_MIN_FILTER"/>
+
+               <desc name="param">
+                       <value name="GL_NEAREST"/>
+                       <value name="GL_LINEAR"/>
+                       <value name="GL_NEAREST_MIPMAP_NEAREST"/>
+                       <value name="GL_NEAREST_MIPMAP_LINEAR"/>
+                       <value name="GL_LINEAR_MIPMAP_NEAREST"/>
+                       <value name="GL_LINEAR_MIPMAP_LINEAR"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_TEXTURE_MAG_FILTER"/>
+
+               <desc name="param">
+                       <value name="GL_NEAREST"/>
+                       <value name="GL_LINEAR"/>
+               </desc>
+       </desc>
+
+       <desc name="pname" category="GLES1.1">
+               <value name="GL_GENERATE_MIPMAP"/>
+
+               <desc name="param">
+                       <value name="GL_TRUE"/>
+                       <value name="GL_FALSE"/>
+               </desc>
+       </desc>
+
+       <desc name="pname" category="EXT_texture_filter_anisotropic">
+               <value name="GL_TEXTURE_MAX_ANISOTROPY_EXT"/>
+               <desc name="params" vector_size="1"/>
+       </desc>
+
+       <desc name="pname" category="OES_draw_texture">
+               <value name="GL_TEXTURE_CROP_RECT_OES"/>
+               <desc name="params" vector_size="4"/>
+       </desc>
+</template>
+
+<template name="TexImage2D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="internalFormat" type="GLint"/> <!-- should be GLenum -->
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="border" type="GLint"/>
+               <param name="format" type="GLenum"/>
+               <param name="type" type="GLenum"/>
+               <param name="pixels" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
+       </desc>
+
+       <desc name="internalFormat" error="GL_INVALID_VALUE">
+               <value name="GL_ALPHA"/>
+               <value name="GL_RGB"/>
+               <value name="GL_RGBA"/>
+               <value name="GL_LUMINANCE"/>
+               <value name="GL_LUMINANCE_ALPHA"/>
+               <value name="GL_DEPTH_COMPONENT" category="OES_depth_texture"/>
+               <value name="GL_DEPTH_STENCIL_OES" category="OES_packed_depth_stencil"/>
+       </desc>
+
+       <desc name="border" error="GL_INVALID_VALUE">
+               <value name="0"/>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_ALPHA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGB"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGBA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
+                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+                       <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE_ALPHA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format" category="OES_depth_texture">
+               <value name="GL_DEPTH_COMPONENT"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_SHORT"/>
+                       <value name="GL_UNSIGNED_INT"/>
+               </desc>
+       </desc>
+
+       <desc name="format" category="OES_packed_depth_stencil">
+               <value name="GL_DEPTH_STENCIL_OES"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_INT_24_8_OES"/>
+               </desc>
+       </desc>
+</template>
+
+<template name="TexEnv">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="const GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="target" category="OES_point_sprite">
+               <value name="GL_POINT_SPRITE_OES"/>
+
+               <desc name="pname">
+                       <value name="GL_COORD_REPLACE_OES"/>
+               </desc>
+       </desc>
+
+       <desc name="pname" category="OES_point_sprite">
+               <value name="GL_COORD_REPLACE_OES"/>
+
+               <desc name="param">
+                       <value name="GL_TRUE"/>
+                       <value name="GL_FALSE"/>
+               </desc>
+       </desc>
+
+       <desc name="target" category="EXT_texture_lod_bias">
+               <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/>
+
+               <desc name="pname">
+                       <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
+               </desc>
+       </desc>
+
+       <desc name="pname" category="EXT_texture_lod_bias">
+               <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
+               <desc name="params" vector_size="1"/>
+       </desc>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_ENV"/>
+
+               <desc name="pname">
+                       <value name="GL_TEXTURE_ENV_MODE"/>
+                       <value name="GL_COMBINE_RGB"/>
+                       <value name="GL_COMBINE_ALPHA"/>
+                       <value name="GL_RGB_SCALE"/>
+                       <value name="GL_ALPHA_SCALE"/>
+                       <value name="GL_SRC0_RGB"/>
+                       <value name="GL_SRC1_RGB"/>
+                       <value name="GL_SRC2_RGB"/>
+                       <value name="GL_SRC0_ALPHA"/>
+                       <value name="GL_SRC1_ALPHA"/>
+                       <value name="GL_SRC2_ALPHA"/>
+                       <value name="GL_OPERAND0_RGB"/>
+                       <value name="GL_OPERAND1_RGB"/>
+                       <value name="GL_OPERAND2_RGB"/>
+                       <value name="GL_OPERAND0_ALPHA"/>
+                       <value name="GL_OPERAND1_ALPHA"/>
+                       <value name="GL_OPERAND2_ALPHA"/>
+                       <value name="GL_TEXTURE_ENV_COLOR"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_TEXTURE_ENV_MODE"/>
+
+               <desc name="param">
+                       <value name="GL_REPLACE"/>
+                       <value name="GL_MODULATE"/>
+                       <value name="GL_DECAL"/>
+                       <value name="GL_BLEND"/>
+                       <value name="GL_ADD"/>
+                       <value name="GL_COMBINE"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_COMBINE_RGB"/>
+
+               <desc name="param">
+                       <value name="GL_REPLACE"/>
+                       <value name="GL_MODULATE"/>
+                       <value name="GL_ADD"/>
+                       <value name="GL_ADD_SIGNED"/>
+                       <value name="GL_INTERPOLATE"/>
+                       <value name="GL_SUBTRACT"/>
+                       <value name="GL_DOT3_RGB"/>
+                       <value name="GL_DOT3_RGBA"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_COMBINE_ALPHA"/>
+
+               <desc name="param">
+                       <value name="GL_REPLACE"/>
+                       <value name="GL_MODULATE"/>
+                       <value name="GL_ADD"/>
+                       <value name="GL_ADD_SIGNED"/>
+                       <value name="GL_INTERPOLATE"/>
+                       <value name="GL_SUBTRACT"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_RGB_SCALE"/>
+               <value name="GL_ALPHA_SCALE"/>
+
+               <desc name="param" convert="true" error="GL_INVALID_VALUE">
+                       <value name="1.0"/>
+                       <value name="2.0"/>
+                       <value name="4.0"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_SRC0_RGB"/>
+               <value name="GL_SRC1_RGB"/>
+               <value name="GL_SRC2_RGB"/>
+               <value name="GL_SRC0_ALPHA"/>
+               <value name="GL_SRC1_ALPHA"/>
+               <value name="GL_SRC2_ALPHA"/>
+
+               <desc name="param">
+                       <value name="GL_TEXTURE"/>
+                       <value name="GL_CONSTANT"/>
+                       <value name="GL_PRIMARY_COLOR"/>
+                       <value name="GL_PREVIOUS"/>
+
+                       <range base="GL_TEXTURE" from="0" to="31" category="OES_texture_env_crossbar"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_OPERAND0_RGB"/>
+               <value name="GL_OPERAND1_RGB"/>
+               <value name="GL_OPERAND2_RGB"/>
+
+               <desc name="param">
+                       <value name="GL_SRC_COLOR"/>
+                       <value name="GL_ONE_MINUS_SRC_COLOR"/>
+                       <value name="GL_SRC_ALPHA"/>
+                       <value name="GL_ONE_MINUS_SRC_ALPHA"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_OPERAND0_ALPHA"/>
+               <value name="GL_OPERAND1_ALPHA"/>
+               <value name="GL_OPERAND2_ALPHA"/>
+
+               <desc name="param">
+                       <value name="GL_SRC_ALPHA"/>
+                       <value name="GL_ONE_MINUS_SRC_ALPHA"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_TEXTURE_ENV_COLOR"/>
+
+               <desc name="params" vector_size="4"/>
+       </desc>
+</template>
+
+<template name="TexGen">
+       <proto>
+               <return type="void"/>
+               <param name="coord" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="const GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="coord" category="OES_texture_cube_map">
+               <value name="GL_TEXTURE_GEN_STR_OES"/>
+       </desc>
+
+       <desc name="pname" category="OES_texture_cube_map">
+               <value name="GL_TEXTURE_GEN_MODE_OES"/>
+
+               <desc name="param">
+                       <value name="GL_NORMAL_MAP_OES"/>
+                       <value name="GL_REFLECTION_MAP_OES"/>
+               </desc>
+       </desc>
+</template>
+
+<template name="Clear">
+       <proto>
+               <return type="void"/>
+               <param name="mask" type="GLbitfield"/>
+       </proto>
+
+       <desc name="mask" error="GL_INVALID_VALUE">
+               <value name="0"/>
+               <value name="(GL_COLOR_BUFFER_BIT)"/>
+               <value name="(GL_DEPTH_BUFFER_BIT)"/>
+               <value name="(GL_STENCIL_BUFFER_BIT)"/>
+               <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)"/>
+               <value name="(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
+               <value name="(GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
+               <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
+       </desc>
+</template>
+
+<template name="ClearColor">
+       <proto>
+               <return type="void"/>
+               <param name="red" type="GLtype"/>
+               <param name="green" type="GLtype"/>
+               <param name="blue" type="GLtype"/>
+               <param name="alpha" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="ClearStencil">
+       <proto>
+               <return type="void"/>
+               <param name="s" type="GLint"/>
+       </proto>
+</template>
+
+<template name="ClearDepth">
+       <proto>
+               <return type="void"/>
+               <param name="depth" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="StencilMask">
+       <proto>
+               <return type="void"/>
+               <param name="mask" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="StencilMaskSeparate">
+       <proto>
+               <return type="void"/>
+               <param name="face" type="GLenum"/>
+               <param name="mask" type="GLuint"/>
+       </proto>
+
+       <desc name="face">
+               <value name="GL_FRONT"/>
+               <value name="GL_BACK"/>
+               <value name="GL_FRONT_AND_BACK"/>
+       </desc>
+</template>
+
+<template name="ColorMask">
+       <proto>
+               <return type="void"/>
+               <param name="red" type="GLboolean"/>
+               <param name="green" type="GLboolean"/>
+               <param name="blue" type="GLboolean"/>
+               <param name="alpha" type="GLboolean"/>
+       </proto>
+</template>
+
+<template name="DepthMask">
+       <proto>
+               <return type="void"/>
+               <param name="flag" type="GLboolean"/>
+       </proto>
+</template>
+
+<template name="Disable">
+       <proto>
+               <return type="void"/>
+               <param name="cap" type="GLenum"/>
+       </proto>
+
+       <desc name="cap" category="GLES1.1">
+               <value name="GL_NORMALIZE"/>
+               <value name="GL_RESCALE_NORMAL"/>
+
+               <range base="GL_CLIP_PLANE" from="0" to="5"/>
+
+               <value name="GL_FOG"/>
+               <value name="GL_LIGHTING"/>
+               <value name="GL_COLOR_MATERIAL"/>
+
+               <range base="GL_LIGHT" from="0" to="7"/>
+
+               <value name="GL_POINT_SMOOTH"/>
+               <value name="GL_LINE_SMOOTH"/>
+               <value name="GL_CULL_FACE"/>
+               <value name="GL_POLYGON_OFFSET_FILL"/>
+               <value name="GL_MULTISAMPLE"/>
+               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
+               <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
+               <value name="GL_SAMPLE_COVERAGE"/>
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_SCISSOR_TEST"/>
+               <value name="GL_ALPHA_TEST"/>
+               <value name="GL_STENCIL_TEST"/>
+               <value name="GL_DEPTH_TEST"/>
+               <value name="GL_BLEND"/>
+               <value name="GL_DITHER"/>
+               <value name="GL_COLOR_LOGIC_OP"/>
+
+               <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
+               <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
+               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
+       </desc>
+
+       <desc name="cap" category="GLES2.0">
+               <value name="GL_CULL_FACE"/>
+               <value name="GL_SCISSOR_TEST"/>
+               <value name="GL_POLYGON_OFFSET_FILL"/>
+               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
+               <value name="GL_SAMPLE_COVERAGE"/>
+               <value name="GL_STENCIL_TEST"/>
+               <value name="GL_DEPTH_TEST"/>
+               <value name="GL_DITHER"/>
+               <value name="GL_BLEND"/>
+       </desc>
+</template>
+
+<!-- it is exactly the same as Disable -->
+<template name="Enable">
+       <proto>
+               <return type="void"/>
+               <param name="cap" type="GLenum"/>
+       </proto>
+
+       <desc name="cap" category="GLES1.1">
+               <value name="GL_NORMALIZE"/>
+               <value name="GL_RESCALE_NORMAL"/>
+
+               <range base="GL_CLIP_PLANE" from="0" to="5"/>
+
+               <value name="GL_FOG"/>
+               <value name="GL_LIGHTING"/>
+               <value name="GL_COLOR_MATERIAL"/>
+
+               <range base="GL_LIGHT" from="0" to="7"/>
+
+               <value name="GL_POINT_SMOOTH"/>
+               <value name="GL_LINE_SMOOTH"/>
+               <value name="GL_CULL_FACE"/>
+               <value name="GL_POLYGON_OFFSET_FILL"/>
+               <value name="GL_MULTISAMPLE"/>
+               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
+               <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
+               <value name="GL_SAMPLE_COVERAGE"/>
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_SCISSOR_TEST"/>
+               <value name="GL_ALPHA_TEST"/>
+               <value name="GL_STENCIL_TEST"/>
+               <value name="GL_DEPTH_TEST"/>
+               <value name="GL_BLEND"/>
+               <value name="GL_DITHER"/>
+               <value name="GL_COLOR_LOGIC_OP"/>
+
+               <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
+               <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
+               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
+       </desc>
+
+       <desc name="cap" category="GLES2.0">
+               <value name="GL_CULL_FACE"/>
+               <value name="GL_SCISSOR_TEST"/>
+               <value name="GL_POLYGON_OFFSET_FILL"/>
+               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
+               <value name="GL_SAMPLE_COVERAGE"/>
+               <value name="GL_STENCIL_TEST"/>
+               <value name="GL_DEPTH_TEST"/>
+               <value name="GL_DITHER"/>
+               <value name="GL_BLEND"/>
+       </desc>
+</template>
+
+<template name="Finish">
+       <proto>
+               <return type="void"/>
+       </proto>
+</template>
+
+<template name="Flush">
+       <proto>
+               <return type="void"/>
+       </proto>
+</template>
+
+<template name="AlphaFunc">
+       <proto>
+               <return type="void"/>
+               <param name="func" type="GLenum"/>
+               <param name="ref" type="GLtype"/>
+       </proto>
+       <desc name="func">
+               <value name="GL_NEVER"/>
+               <value name="GL_LESS"/>
+               <value name="GL_EQUAL"/>
+               <value name="GL_LEQUAL"/>
+               <value name="GL_GREATER"/>
+               <value name="GL_NOTEQUAL"/>
+               <value name="GL_GEQUAL"/>
+               <value name="GL_ALWAYS"/>
+       </desc>
+</template>
+
+<template name="BlendFunc">
+       <proto>
+               <return type="void"/>
+               <param name="sfactor" type="GLenum"/>
+               <param name="dfactor" type="GLenum"/>
+       </proto>
+
+       <desc name="sfactor">
+               <value name="GL_ZERO"/>
+               <value name="GL_ONE"/>
+               <value name="GL_SRC_COLOR"/>
+               <value name="GL_ONE_MINUS_SRC_COLOR"/>
+               <value name="GL_SRC_ALPHA"/>
+               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
+               <value name="GL_DST_ALPHA"/>
+               <value name="GL_ONE_MINUS_DST_ALPHA"/>
+               <value name="GL_DST_COLOR"/>
+               <value name="GL_ONE_MINUS_DST_COLOR"/>
+               <value name="GL_SRC_ALPHA_SATURATE"/>
+
+               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
+       </desc>
+
+       <desc name="dfactor">
+               <value name="GL_ZERO"/>
+               <value name="GL_ONE"/>
+               <value name="GL_SRC_COLOR"/>
+               <value name="GL_ONE_MINUS_SRC_COLOR"/>
+               <value name="GL_SRC_ALPHA"/>
+               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
+               <value name="GL_DST_ALPHA"/>
+               <value name="GL_ONE_MINUS_DST_ALPHA"/>
+               <value name="GL_DST_COLOR"/>
+               <value name="GL_ONE_MINUS_DST_COLOR"/>
+
+               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
+       </desc>
+</template>
+
+<template name="LogicOp">
+       <proto>
+               <return type="void"/>
+               <param name="opcode" type="GLenum"/>
+       </proto>
+
+       <desc name="opcode">
+               <value name="GL_CLEAR"/>
+               <value name="GL_SET"/>
+               <value name="GL_COPY"/>
+               <value name="GL_COPY_INVERTED"/>
+               <value name="GL_NOOP"/>
+               <value name="GL_INVERT"/>
+               <value name="GL_AND"/>
+               <value name="GL_NAND"/>
+               <value name="GL_OR"/>
+               <value name="GL_NOR"/>
+               <value name="GL_XOR"/>
+               <value name="GL_EQUIV"/>
+               <value name="GL_AND_REVERSE"/>
+               <value name="GL_AND_INVERTED"/>
+               <value name="GL_OR_REVERSE"/>
+               <value name="GL_OR_INVERTED"/>
+       </desc>
+</template>
+
+<template name="StencilFunc">
+       <proto>
+               <return type="void"/>
+               <param name="func" type="GLenum"/>
+               <param name="ref" type="GLint"/>
+               <param name="mask" type="GLuint"/>
+       </proto>
+
+       <desc name="func">
+               <value name="GL_NEVER"/>
+               <value name="GL_LESS"/>
+               <value name="GL_LEQUAL"/>
+               <value name="GL_GREATER"/>
+               <value name="GL_GEQUAL"/>
+               <value name="GL_EQUAL"/>
+               <value name="GL_NOTEQUAL"/>
+               <value name="GL_ALWAYS"/>
+       </desc>
+</template>
+
+<template name="StencilFuncSeparate">
+       <proto>
+               <return type="void"/>
+               <param name="face" type="GLenum"/>
+               <param name="func" type="GLenum"/>
+               <param name="ref" type="GLint"/>
+               <param name="mask" type="GLuint"/>
+       </proto>
+
+       <desc name="face">
+               <value name="GL_FRONT"/>
+               <value name="GL_BACK"/>
+               <value name="GL_FRONT_AND_BACK"/>
+       </desc>
+
+       <desc name="func">
+               <value name="GL_NEVER"/>
+               <value name="GL_LESS"/>
+               <value name="GL_LEQUAL"/>
+               <value name="GL_GREATER"/>
+               <value name="GL_GEQUAL"/>
+               <value name="GL_EQUAL"/>
+               <value name="GL_NOTEQUAL"/>
+               <value name="GL_ALWAYS"/>
+       </desc>
+</template>
+
+<template name="StencilOp">
+       <proto>
+               <return type="void"/>
+               <param name="fail" type="GLenum"/>
+               <param name="zfail" type="GLenum"/>
+               <param name="zpass" type="GLenum"/>
+       </proto>
+
+       <desc name="fail">
+               <value name="GL_KEEP"/>
+               <value name="GL_ZERO"/>
+               <value name="GL_REPLACE"/>
+               <value name="GL_INCR"/>
+               <value name="GL_DECR"/>
+               <value name="GL_INVERT"/>
+               <value name="GL_INCR_WRAP" category="GLES2.0"/>
+               <value name="GL_DECR_WRAP" category="GLES2.0"/>
+               <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/>
+               <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/>
+       </desc>
+
+       <desc name="zfail">
+               <value name="GL_KEEP"/>
+               <value name="GL_ZERO"/>
+               <value name="GL_REPLACE"/>
+               <value name="GL_INCR"/>
+               <value name="GL_DECR"/>
+               <value name="GL_INVERT"/>
+               <value name="GL_INCR_WRAP" category="GLES2.0"/>
+               <value name="GL_DECR_WRAP" category="GLES2.0"/>
+               <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/>
+               <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/>
+       </desc>
+
+       <desc name="zpass">
+               <value name="GL_KEEP"/>
+               <value name="GL_ZERO"/>
+               <value name="GL_REPLACE"/>
+               <value name="GL_INCR"/>
+               <value name="GL_DECR"/>
+               <value name="GL_INVERT"/>
+               <value name="GL_INCR_WRAP" category="GLES2.0"/>
+               <value name="GL_DECR_WRAP" category="GLES2.0"/>
+               <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/>
+               <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/>
+       </desc>
+</template>
+
+<template name="StencilOpSeparate">
+       <proto>
+               <return type="void"/>
+               <param name="face" type="GLenum"/>
+               <param name="fail" type="GLenum"/>
+               <param name="zfail" type="GLenum"/>
+               <param name="zpass" type="GLenum"/>
+       </proto>
+
+       <desc name="face">
+               <value name="GL_FRONT"/>
+               <value name="GL_BACK"/>
+               <value name="GL_FRONT_AND_BACK"/>
+       </desc>
+
+       <desc name="fail">
+               <value name="GL_KEEP"/>
+               <value name="GL_ZERO"/>
+               <value name="GL_REPLACE"/>
+               <value name="GL_INCR"/>
+               <value name="GL_DECR"/>
+               <value name="GL_INVERT"/>
+               <value name="GL_INCR_WRAP"/>
+               <value name="GL_DECR_WRAP"/>
+       </desc>
+
+       <desc name="zfail">
+               <value name="GL_KEEP"/>
+               <value name="GL_ZERO"/>
+               <value name="GL_REPLACE"/>
+               <value name="GL_INCR"/>
+               <value name="GL_DECR"/>
+               <value name="GL_INVERT"/>
+               <value name="GL_INCR_WRAP"/>
+               <value name="GL_DECR_WRAP"/>
+       </desc>
+
+       <desc name="zpass">
+               <value name="GL_KEEP"/>
+               <value name="GL_ZERO"/>
+               <value name="GL_REPLACE"/>
+               <value name="GL_INCR"/>
+               <value name="GL_DECR"/>
+               <value name="GL_INVERT"/>
+               <value name="GL_INCR_WRAP"/>
+               <value name="GL_DECR_WRAP"/>
+       </desc>
+</template>
+
+<template name="DepthFunc">
+       <proto>
+               <return type="void"/>
+               <param name="func" type="GLenum"/>
+       </proto>
+
+       <desc name="func">
+               <value name="GL_NEVER"/>
+               <value name="GL_LESS"/>
+               <value name="GL_EQUAL"/>
+               <value name="GL_LEQUAL"/>
+               <value name="GL_GREATER"/>
+               <value name="GL_NOTEQUAL"/>
+               <value name="GL_GEQUAL"/>
+               <value name="GL_ALWAYS"/>
+       </desc>
+</template>
+
+<template name="PixelStore">
+       <proto>
+               <return type="void"/>
+               <param name="pname" type="GLenum"/>
+               <param name="param" type="GLtype"/>
+       </proto>
+
+       <desc name="pname">
+               <value name="GL_PACK_ALIGNMENT"/>
+               <value name="GL_UNPACK_ALIGNMENT"/>
+       </desc>
+
+       <desc name="param" error="GL_INVALID_VALUE">
+               <value name="1"/>
+               <value name="2"/>
+               <value name="4"/>
+               <value name="8"/>
+       </desc>
+</template>
+
+<template name="ReadPixels" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="x" type="GLint"/>
+               <param name="y" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="format" type="GLenum"/>
+               <param name="type" type="GLenum"/>
+               <param name="pixels" type="GLvoid *"/>
+       </proto>
+
+       <!-- Technically, only two combinations are actually allowed:
+            GL_RGBA/GL_UNSIGNED_BYTE, and some implementation-specific
+            internal preferred combination.  I don't know what that is, so I'm
+            allowing any valid combination for now; the underlying support
+            should fail when necessary.-->
+       <desc name="format">
+               <value name="GL_ALPHA"/>
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGB"/>
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGBA"/>
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
+                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE"/>
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE_ALPHA"/>
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+               </desc>
+       </desc>
+
+       <desc name="format" category="EXT_read_format_bgra">
+               <value name="GL_BGRA_EXT"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT"/>
+                       <value name="GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT"/>
+               </desc>
+       </desc>
+</template>
+
+<template name="GetClipPlane" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="plane" type="GLenum"/>
+               <vector name="equation" type="GLtype *" size="4"/>
+       </proto>
+
+       <desc name="plane">
+               <range base="GL_CLIP_PLANE" from="0" to="5"/>
+       </desc>
+</template>
+
+<template name="GetError" direction="get">
+       <proto>
+               <return type="GLenum"/>
+       </proto>
+</template>
+
+<!-- template for GetFloatv, GetIntegerv, GetBoolean, and GetFixedv -->
+<template name="GetState" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+       <!-- param checking is done in mesa -->
+</template>
+
+<template name="GetLight" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="light" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="light">
+               <range base="GL_LIGHT" from="0" to="7"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_AMBIENT"/>
+               <value name="GL_DIFFUSE"/>
+               <value name="GL_SPECULAR"/>
+               <value name="GL_POSITION"/>
+
+               <desc name="params" vector_size="4"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_SPOT_DIRECTION"/>
+
+               <desc name="params" vector_size="3"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_SPOT_EXPONENT"/>
+               <value name="GL_SPOT_CUTOFF"/>
+               <value name="GL_CONSTANT_ATTENUATION"/>
+               <value name="GL_LINEAR_ATTENUATION"/>
+               <value name="GL_QUADRATIC_ATTENUATION"/>
+
+               <desc name="params" vector_size="1"/>
+       </desc>
+</template>
+
+<template name="GetMaterial" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="face" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="face">
+               <value name="GL_FRONT"/>
+               <value name="GL_BACK"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_SHININESS"/>
+               <desc name="params" vector_size="1"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_AMBIENT"/>
+               <value name="GL_DIFFUSE"/>
+               <value name="GL_AMBIENT_AND_DIFFUSE"/>
+               <value name="GL_SPECULAR"/>
+               <value name="GL_EMISSION"/>
+
+               <desc name="params" vector_size="4"/>
+       </desc>
+</template>
+
+<template name="GetString" direction="get">
+       <proto>
+               <return type="const GLubyte *"/>
+               <param name="name" type="GLenum"/>
+       </proto>
+
+       <desc name="name">
+               <value name="GL_VENDOR"/>
+               <value name="GL_RENDERER"/>
+               <value name="GL_VERSION"/>
+               <value name="GL_EXTENSIONS"/>
+               <value name="GL_SHADING_LANGUAGE_VERSION" category="GLES2.0"/>
+       </desc>
+</template>
+
+<template name="GetTexEnv" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="target" category="OES_point_sprite">
+               <value name="GL_POINT_SPRITE_OES"/>
+               <desc name="pname">
+                       <value name="GL_COORD_REPLACE_OES"/>
+               </desc>
+       </desc>
+
+       <desc name="pname" category="OES_point_sprite">
+               <value name="GL_COORD_REPLACE_OES"/>
+               <desc name="params" vector_size="1" convert="false"/>
+       </desc>
+
+       <desc name="target" category="EXT_texture_lod_bias">
+               <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/>
+
+               <desc name="pname">
+                       <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
+               </desc>
+       </desc>
+
+       <desc name="pname" category="EXT_texture_lod_bias">
+               <value name="GL_TEXTURE_LOD_BIAS_EXT"/>
+               <desc name="params" vector_size="1"/>
+       </desc>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_ENV"/>
+
+               <desc name="pname">
+                       <value name="GL_TEXTURE_ENV_COLOR"/>
+                       <value name="GL_RGB_SCALE"/>
+                       <value name="GL_ALPHA_SCALE"/>
+                       <value name="GL_TEXTURE_ENV_MODE"/>
+                       <value name="GL_COMBINE_RGB"/>
+                       <value name="GL_COMBINE_ALPHA"/>
+                       <value name="GL_SRC0_RGB"/>
+                       <value name="GL_SRC1_RGB"/>
+                       <value name="GL_SRC2_RGB"/>
+                       <value name="GL_SRC0_ALPHA"/>
+                       <value name="GL_SRC1_ALPHA"/>
+                       <value name="GL_SRC2_ALPHA"/>
+                       <value name="GL_OPERAND0_RGB"/>
+                       <value name="GL_OPERAND1_RGB"/>
+                       <value name="GL_OPERAND2_RGB"/>
+                       <value name="GL_OPERAND0_ALPHA"/>
+                       <value name="GL_OPERAND1_ALPHA"/>
+                       <value name="GL_OPERAND2_ALPHA"/>
+               </desc>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_TEXTURE_ENV_COLOR"/>
+               <desc name="params" vector_size="4"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_RGB_SCALE"/>
+               <value name="GL_ALPHA_SCALE"/>
+
+               <desc name="params" vector_size="1"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_TEXTURE_ENV_MODE"/>
+               <value name="GL_COMBINE_RGB"/>
+               <value name="GL_COMBINE_ALPHA"/>
+               <value name="GL_SRC0_RGB"/>
+               <value name="GL_SRC1_RGB"/>
+               <value name="GL_SRC2_RGB"/>
+               <value name="GL_SRC0_ALPHA"/>
+               <value name="GL_SRC1_ALPHA"/>
+               <value name="GL_SRC2_ALPHA"/>
+               <value name="GL_OPERAND0_RGB"/>
+               <value name="GL_OPERAND1_RGB"/>
+               <value name="GL_OPERAND2_RGB"/>
+               <value name="GL_OPERAND0_ALPHA"/>
+               <value name="GL_OPERAND1_ALPHA"/>
+               <value name="GL_OPERAND2_ALPHA"/>
+
+               <desc name="params" vector_size="1" convert="false"/>
+       </desc>
+</template>
+
+<template name="GetTexGen" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="coord" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="coord">
+               <value name="GL_TEXTURE_GEN_STR_OES"/>
+       </desc>
+       <desc name="pname">
+               <value name="GL_TEXTURE_GEN_MODE_OES"/>
+               <desc name="params" vector_size="1" convert="false"/>
+       </desc>
+</template>
+
+<template name="GetTexParameter" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_TEXTURE_WRAP_S"/>
+               <value name="GL_TEXTURE_WRAP_T"/>
+               <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/>
+               <value name="GL_TEXTURE_MIN_FILTER"/>
+               <value name="GL_TEXTURE_MAG_FILTER"/>
+               <value name="GL_GENERATE_MIPMAP" category="GLES1.1"/>
+
+               <desc name="params" vector_size="1" convert="false"/>
+       </desc>
+
+       <desc name="pname" category="OES_draw_texture">
+               <value name="GL_TEXTURE_CROP_RECT_OES"/>
+               <desc name="params" vector_size="4"/>
+       </desc>
+</template>
+
+<template name="IsEnabled" direction="get">
+       <proto>
+               <return type="GLboolean"/>
+               <param name="cap" type="GLenum"/>
+       </proto>
+
+       <desc name="cap" category="GLES1.1">
+               <value name="GL_NORMALIZE"/>
+               <value name="GL_RESCALE_NORMAL"/>
+
+               <range base="GL_CLIP_PLANE" from="0" to="5"/>
+
+               <value name="GL_FOG"/>
+               <value name="GL_LIGHTING"/>
+               <value name="GL_COLOR_MATERIAL"/>
+
+               <range base="GL_LIGHT" from="0" to="7"/>
+
+               <value name="GL_POINT_SMOOTH"/>
+               <value name="GL_LINE_SMOOTH"/>
+               <value name="GL_CULL_FACE"/>
+               <value name="GL_POLYGON_OFFSET_FILL"/>
+               <value name="GL_MULTISAMPLE"/>
+               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
+               <value name="GL_SAMPLE_ALPHA_TO_ONE"/>
+               <value name="GL_SAMPLE_COVERAGE"/>
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_SCISSOR_TEST"/>
+               <value name="GL_ALPHA_TEST"/>
+               <value name="GL_STENCIL_TEST"/>
+               <value name="GL_DEPTH_TEST"/>
+               <value name="GL_BLEND"/>
+               <value name="GL_DITHER"/>
+               <value name="GL_COLOR_LOGIC_OP"/>
+
+               <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/>
+               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
+
+               <value name="GL_VERTEX_ARRAY"/>
+               <value name="GL_NORMAL_ARRAY"/>
+               <value name="GL_COLOR_ARRAY"/>
+               <value name="GL_TEXTURE_COORD_ARRAY"/>
+               <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
+               <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
+               <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
+       </desc>
+
+       <desc name="cap" category="GLES2.0">
+               <value name="GL_CULL_FACE"/>
+               <value name="GL_SCISSOR_TEST"/>
+               <value name="GL_POLYGON_OFFSET_FILL"/>
+               <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/>
+               <value name="GL_SAMPLE_COVERAGE"/>
+               <value name="GL_STENCIL_TEST"/>
+               <value name="GL_DEPTH_TEST"/>
+               <value name="GL_DITHER"/>
+               <value name="GL_BLEND"/>
+       </desc>
+</template>
+
+<template name="DepthRange">
+       <proto>
+               <return type="void"/>
+               <param name="zNear" type="GLtype"/>
+               <param name="zFar" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="Frustum">
+       <proto>
+               <return type="void"/>
+               <param name="left" type="GLtype"/>
+               <param name="right" type="GLtype"/>
+               <param name="bottom" type="GLtype"/>
+               <param name="top" type="GLtype"/>
+               <param name="zNear" type="GLtype"/>
+               <param name="zFar" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="LoadIdentity">
+       <proto>
+               <return type="void"/>
+       </proto>
+</template>
+
+<template name="LoadMatrix">
+       <proto>
+               <return type="void"/>
+               <vector name="m" type="const GLtype *" size="16"/>
+       </proto>
+</template>
+
+<template name="MatrixMode">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_MODELVIEW"/>
+               <value name="GL_PROJECTION"/>
+               <value name="GL_TEXTURE"/>
+               <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
+       </desc>
+</template>
+
+<template name="MultMatrix">
+       <proto>
+               <return type="void"/>
+               <vector name="m" type="const GLtype *" size="16"/>
+       </proto>
+</template>
+
+<template name="Ortho">
+       <proto>
+               <return type="void"/>
+               <param name="left" type="GLtype"/>
+               <param name="right" type="GLtype"/>
+               <param name="bottom" type="GLtype"/>
+               <param name="top" type="GLtype"/>
+               <param name="zNear" type="GLtype"/>
+               <param name="zFar" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="PopMatrix">
+       <proto>
+               <return type="void"/>
+       </proto>
+</template>
+
+<template name="PushMatrix">
+       <proto>
+               <return type="void"/>
+       </proto>
+</template>
+
+<template name="Rotate">
+       <proto>
+               <return type="void"/>
+               <param name="angle" type="GLtype"/>
+               <param name="x" type="GLtype"/>
+               <param name="y" type="GLtype"/>
+               <param name="z" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="Scale">
+       <proto>
+               <return type="void"/>
+               <param name="x" type="GLtype"/>
+               <param name="y" type="GLtype"/>
+               <param name="z" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="Translate">
+       <proto>
+               <return type="void"/>
+               <param name="x" type="GLtype"/>
+               <param name="y" type="GLtype"/>
+               <param name="z" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="Viewport">
+       <proto>
+               <return type="void"/>
+               <param name="x" type="GLint"/>
+               <param name="y" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+       </proto>
+</template>
+
+<template name="ColorPointer">
+       <proto>
+               <return type="void"/>
+               <param name="size" type="GLint"/>
+               <param name="type" type="GLenum"/>
+               <param name="stride" type="GLsizei"/>
+               <param name="pointer" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="size" error="GL_INVALID_VALUE">
+               <value name="4"/>
+       </desc>
+
+       <desc name="type">
+               <value name="GL_UNSIGNED_BYTE"/>
+               <value name="GL_FLOAT"/>
+               <value name="GL_FIXED"/>
+               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
+       </desc>
+</template>
+
+<template name="DisableClientState">
+       <proto>
+               <return type="void"/>
+               <param name="array" type="GLenum"/>
+       </proto>
+
+       <desc name="array">
+               <value name="GL_VERTEX_ARRAY"/>
+               <value name="GL_NORMAL_ARRAY"/>
+               <value name="GL_COLOR_ARRAY"/>
+               <value name="GL_TEXTURE_COORD_ARRAY"/>
+               <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
+               <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
+               <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
+       </desc>
+</template>
+
+<template name="DrawArrays">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+               <param name="first" type="GLint"/>
+               <param name="count" type="GLsizei"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_POINTS"/>
+               <value name="GL_LINES"/>
+               <value name="GL_LINE_LOOP"/>
+               <value name="GL_LINE_STRIP"/>
+               <value name="GL_TRIANGLES"/>
+               <value name="GL_TRIANGLE_STRIP"/>
+               <value name="GL_TRIANGLE_FAN"/>
+       </desc>
+</template>
+
+<template name="DrawElements">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+               <param name="count" type="GLsizei"/>
+               <param name="type" type="GLenum"/>
+               <param name="indices" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_POINTS"/>
+               <value name="GL_LINES"/>
+               <value name="GL_LINE_LOOP"/>
+               <value name="GL_LINE_STRIP"/>
+               <value name="GL_TRIANGLES"/>
+               <value name="GL_TRIANGLE_STRIP"/>
+               <value name="GL_TRIANGLE_FAN"/>
+       </desc>
+
+       <desc name="type">
+               <value name="GL_UNSIGNED_BYTE"/>
+               <value name="GL_UNSIGNED_SHORT"/>
+               <!-- GL_UNSIGNED_INT is not defined in GLES1.1 headers -->
+               <value name="(0x1405 /* GL_UNSIGNED_INT */)" category="OES_element_index_uint"/>
+       </desc>
+</template>
+
+<template name="EnableClientState">
+       <proto>
+               <return type="void"/>
+               <param name="array" type="GLenum"/>
+       </proto>
+
+       <desc name="array">
+               <value name="GL_VERTEX_ARRAY"/>
+               <value name="GL_NORMAL_ARRAY"/>
+               <value name="GL_COLOR_ARRAY"/>
+               <value name="GL_TEXTURE_COORD_ARRAY"/>
+               <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
+               <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
+               <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
+       </desc>
+</template>
+
+<template name="GetPointer" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLvoid **" size="dynamic"/>
+       </proto>
+
+       <desc name="pname">
+               <value name="GL_VERTEX_ARRAY_POINTER"/>
+               <value name="GL_NORMAL_ARRAY_POINTER"/>
+               <value name="GL_COLOR_ARRAY_POINTER"/>
+               <value name="GL_TEXTURE_COORD_ARRAY_POINTER"/>
+               <value name="GL_MATRIX_INDEX_ARRAY_POINTER_OES" category="OES_matrix_palette"/>
+               <value name="GL_WEIGHT_ARRAY_POINTER_OES" category="OES_matrix_palette"/>
+               <value name="GL_POINT_SIZE_ARRAY_POINTER_OES" category="OES_point_size_array"/>
+       </desc>
+</template>
+
+<template name="Normal">
+       <proto>
+               <return type="void"/>
+               <vector name="v" type="const GLtype *" size="3">
+                       <param name="nx" type="GLtype"/>
+                       <param name="ny" type="GLtype"/>
+                       <param name="nz" type="GLtype"/>
+               </vector>
+       </proto>
+</template>
+
+<template name="NormalPointer">
+       <proto>
+               <return type="void"/>
+               <param name="type" type="GLenum"/>
+               <param name="stride" type="GLsizei"/>
+               <param name="pointer" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="type">
+               <value name="GL_BYTE"/>
+               <value name="GL_SHORT"/>
+               <value name="GL_FLOAT"/>
+               <value name="GL_FIXED"/>
+               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
+       </desc>
+</template>
+
+<template name="TexCoordPointer">
+       <proto>
+               <return type="void"/>
+               <param name="size" type="GLint"/>
+               <param name="type" type="GLenum"/>
+               <param name="stride" type="GLsizei"/>
+               <param name="pointer" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="size" error="GL_INVALID_VALUE">
+               <value name="2"/>
+               <value name="3"/>
+               <value name="4"/>
+       </desc>
+
+       <desc name="type">
+               <value name="GL_BYTE"/>
+               <value name="GL_SHORT"/>
+               <value name="GL_FLOAT"/>
+               <value name="GL_FIXED"/>
+               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
+       </desc>
+</template>
+
+<template name="VertexPointer">
+       <proto>
+               <return type="void"/>
+               <param name="size" type="GLint"/>
+               <param name="type" type="GLenum"/>
+               <param name="stride" type="GLsizei"/>
+               <param name="pointer" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="size" error="GL_INVALID_VALUE">
+               <value name="2"/>
+               <value name="3"/>
+               <value name="4"/>
+       </desc>
+
+       <desc name="type">
+               <value name="GL_BYTE"/>
+               <value name="GL_SHORT"/>
+               <value name="GL_FLOAT"/>
+               <value name="GL_FIXED"/>
+               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
+       </desc>
+</template>
+
+<template name="PolygonOffset">
+       <proto>
+               <return type="void"/>
+               <param name="factor" type="GLtype"/>
+               <param name="units" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="CopyTexImage2D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="internalFormat" type="GLenum"/>
+               <param name="x" type="GLint"/>
+               <param name="y" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="border" type="GLint"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
+       </desc>
+
+       <desc name="internalFormat" error="GL_INVALID_VALUE">
+               <value name="GL_ALPHA"/>
+               <value name="GL_RGB"/>
+               <value name="GL_RGBA"/>
+               <value name="GL_LUMINANCE"/>
+               <value name="GL_LUMINANCE_ALPHA"/>
+       </desc>
+
+       <desc name="border" error="GL_INVALID_VALUE">
+               <value name="0"/>
+       </desc>
+</template>
+
+<template name="CopyTexSubImage2D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="xoffset" type="GLint"/>
+               <param name="yoffset" type="GLint"/>
+               <param name="x" type="GLint"/>
+               <param name="y" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
+       </desc>
+</template>
+
+<template name="TexSubImage2D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="xoffset" type="GLint"/>
+               <param name="yoffset" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="format" type="GLenum"/>
+               <param name="type" type="GLenum"/>
+               <param name="pixels" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_ALPHA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGB"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGBA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
+                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+                       <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE_ALPHA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format" category="OES_depth_texture">
+               <value name="GL_DEPTH_COMPONENT"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_SHORT"/>
+                       <value name="GL_UNSIGNED_INT"/>
+               </desc>
+       </desc>
+
+       <desc name="format" category="OES_packed_depth_stencil">
+               <value name="GL_DEPTH_STENCIL_OES"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_INT_24_8_OES"/>
+               </desc>
+       </desc>
+</template>
+
+<template name="BindTexture">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="texture" type="GLuint"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+       </desc>
+</template>
+
+<template name="DeleteTextures">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="textures" type="const GLuint *"/>
+       </proto>
+</template>
+
+<template name="GenTextures" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="textures" type="GLuint *"/>
+       </proto>
+</template>
+
+<template name="IsTexture" direction="get">
+       <proto>
+               <return type="GLboolean"/>
+               <param name="texture" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="BlendColor">
+       <proto>
+               <return type="void"/>
+               <param name="red" type="GLtype"/>
+               <param name="green" type="GLtype"/>
+               <param name="blue" type="GLtype"/>
+               <param name="alpha" type="GLtype"/>
+       </proto>
+</template>
+
+<template name="BlendEquation">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_FUNC_ADD" category="GLES2.0"/>
+               <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/>
+               <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/>
+               <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/>
+               <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/>
+               <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/>
+
+               <value name="GL_MIN_EXT" category="EXT_blend_minmax"/>
+               <value name="GL_MAX_EXT" category="EXT_blend_minmax"/>
+       </desc>
+</template>
+
+<template name="BlendEquationSeparate">
+       <proto>
+               <return type="void"/>
+               <param name="modeRGB" type="GLenum"/>
+               <param name="modeAlpha" type="GLenum"/>
+       </proto>
+
+       <desc name="modeRGB">
+               <value name="GL_FUNC_ADD" category="GLES2.0"/>
+               <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/>
+               <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/>
+               <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/>
+               <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/>
+               <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/>
+
+               <value name="GL_MIN_EXT" category="EXT_blend_minmax"/>
+               <value name="GL_MAX_EXT" category="EXT_blend_minmax"/>
+       </desc>
+
+       <desc name="modeAlpha">
+               <value name="GL_FUNC_ADD" category="GLES2.0"/>
+               <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/>
+               <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/>
+               <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/>
+               <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/>
+               <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/>
+
+               <value name="GL_MIN_EXT" category="EXT_blend_minmax"/>
+               <value name="GL_MAX_EXT" category="EXT_blend_minmax"/>
+       </desc>
+</template>
+
+<template name="TexImage3D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="internalFormat" type="GLenum"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="depth" type="GLsizei"/>
+               <param name="border" type="GLint"/>
+               <param name="format" type="GLenum"/>
+               <param name="type" type="GLenum"/>
+               <param name="pixels" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_3D_OES"/>
+       </desc>
+
+       <desc name="internalFormat">
+               <value name="GL_ALPHA"/>
+               <value name="GL_RGB"/>
+               <value name="GL_RGBA"/>
+               <value name="GL_LUMINANCE"/>
+               <value name="GL_LUMINANCE_ALPHA"/>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_ALPHA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGB"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGBA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
+                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+                       <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE_ALPHA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+</template>
+
+<template name="TexSubImage3D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="xoffset" type="GLint"/>
+               <param name="yoffset" type="GLint"/>
+               <param name="zoffset" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="depth" type="GLsizei"/>
+               <param name="format" type="GLenum"/>
+               <param name="type" type="GLenum"/>
+               <param name="pixels" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_3D_OES"/>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_ALPHA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGB"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_5_6_5"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_RGBA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
+                       <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+                       <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_LUMINANCE_ALPHA"/>
+
+               <desc name="type" error="GL_INVALID_OPERATION">
+                       <value name="GL_UNSIGNED_BYTE"/>
+                       <value name="GL_FLOAT" category="OES_texture_float"/>
+                       <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
+               </desc>
+       </desc>
+</template>
+
+<template name="CopyTexSubImage3D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="xoffset" type="GLint"/>
+               <param name="yoffset" type="GLint"/>
+               <param name="zoffset" type="GLint"/>
+               <param name="x" type="GLint"/>
+               <param name="y" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_3D_OES"/>
+       </desc>
+</template>
+
+<template name="MultiTexCoord">
+       <proto>
+               <return type="void"/>
+               <param name="texture" type="GLenum"/>
+               <vector name="v" type="const GLtype *" size="dynamic">
+                       <param name="s" type="GLtype"/>
+                       <param name="t" type="GLtype"/>
+                       <param name="r" type="GLtype"/>
+                       <param name="q" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="texture">
+               <range base="GL_TEXTURE" from="0" to="31"/>
+       </desc>
+</template>
+
+<template name="CompressedTexImage3D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="internalFormat" type="GLenum"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="depth" type="GLsizei"/>
+               <param name="border" type="GLint"/>
+               <param name="imagesize" type="GLsizei"/>
+               <param name="data" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_3D_OES"/>
+       </desc>
+
+       <desc name="internalFormat">
+               <value name="GL_3DC_X_AMD" category="AMD_compressed_3DC_texture"/>
+               <value name="GL_3DC_XY_AMD" category="AMD_compressed_3DC_texture"/>
+               <value name="GL_ATC_RGB_AMD" category="AMD_compressed_ATC_texture"/>
+               <value name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD" category="AMD_compressed_ATC_texture"/>
+               <value name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD" category="AMD_compressed_ATC_texture"/>
+       </desc>
+</template>
+
+<template name="CompressedTexSubImage3D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="xoffset" type="GLint"/>
+               <param name="yoffset" type="GLint"/>
+               <param name="zoffset" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="depth" type="GLsizei"/>
+               <param name="format" type="GLenum"/>
+               <param name="imagesize" type="GLsizei"/>
+               <param name="data" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_3D_OES"/>
+       </desc>
+</template>
+
+<template name="ActiveTexture">
+       <proto>
+               <return type="void"/>
+               <param name="texture" type="GLenum"/>
+       </proto>
+
+       <desc name="texture">
+               <range base="GL_TEXTURE" from="0" to="31"/>
+       </desc>
+</template>
+
+<template name="ClientActiveTexture">
+       <proto>
+               <return type="void"/>
+               <param name="texture" type="GLenum"/>
+       </proto>
+
+       <desc name="texture">
+               <range base="GL_TEXTURE" from="0" to="31"/>
+       </desc>
+</template>
+
+<template name="SampleCoverage">
+       <proto>
+               <return type="void"/>
+               <param name="value" type="GLtype"/>
+               <param name="invert" type="GLboolean"/>
+       </proto>
+</template>
+
+<template name="CompressedTexImage2D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="internalFormat" type="GLenum"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="border" type="GLint"/>
+               <param name="imageSize" type="GLsizei"/>
+               <param name="data" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
+       </desc>
+
+       <desc name="internalFormat">
+               <value name="GL_ETC1_RGB8_OES" category="OES_compressed_ETC1_RGB8_texture"/>
+
+               <value name="GL_PALETTE4_RGB8_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE4_RGBA8_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE4_R5_G6_B5_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE4_RGBA4_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE4_RGB5_A1_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE8_RGB8_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE8_RGBA8_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE8_R5_G6_B5_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE8_RGBA4_OES" category="OES_compressed_paletted_texture"/>
+               <value name="GL_PALETTE8_RGB5_A1_OES" category="OES_compressed_paletted_texture"/>
+
+               <value name="GL_3DC_X_AMD" category="AMD_compressed_3DC_texture"/>
+               <value name="GL_3DC_XY_AMD" category="AMD_compressed_3DC_texture"/>
+
+               <value name="GL_ATC_RGB_AMD" category="AMD_compressed_ATC_texture"/>
+               <value name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD" category="AMD_compressed_ATC_texture"/>
+               <value name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD" category="AMD_compressed_ATC_texture"/>
+
+               <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
+               <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
+       </desc>
+
+       <desc name="border" error="GL_INVALID_VALUE">
+               <value name="0"/>
+       </desc>
+</template>
+
+<template name="CompressedTexSubImage2D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="level" type="GLint"/>
+               <param name="xoffset" type="GLint"/>
+               <param name="yoffset" type="GLint"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+               <param name="format" type="GLenum"/>
+               <param name="imageSize" type="GLsizei"/>
+               <param name="data" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
+       </desc>
+
+       <desc name="format">
+               <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
+               <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
+       </desc>
+</template>
+
+<template name="BlendFuncSeparate">
+       <proto>
+               <return type="void"/>
+               <param name="srcRGB" type="GLenum"/>
+               <param name="dstRGB" type="GLenum"/>
+               <param name="srcAlpha" type="GLenum"/>
+               <param name="dstAlpha" type="GLenum"/>
+       </proto>
+
+       <desc name="srcRGB">
+               <value name="GL_ZERO"/>
+               <value name="GL_ONE"/>
+               <value name="GL_SRC_COLOR"/>
+               <value name="GL_ONE_MINUS_SRC_COLOR"/>
+               <value name="GL_SRC_ALPHA"/>
+               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
+               <value name="GL_DST_ALPHA"/>
+               <value name="GL_ONE_MINUS_DST_ALPHA"/>
+               <value name="GL_DST_COLOR"/>
+               <value name="GL_ONE_MINUS_DST_COLOR"/>
+               <value name="GL_SRC_ALPHA_SATURATE"/>
+
+               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
+       </desc>
+
+       <desc name="dstRGB">
+               <value name="GL_ZERO"/>
+               <value name="GL_ONE"/>
+               <value name="GL_SRC_COLOR"/>
+               <value name="GL_ONE_MINUS_SRC_COLOR"/>
+               <value name="GL_SRC_ALPHA"/>
+               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
+               <value name="GL_DST_ALPHA"/>
+               <value name="GL_ONE_MINUS_DST_ALPHA"/>
+               <value name="GL_DST_COLOR"/>
+               <value name="GL_ONE_MINUS_DST_COLOR"/>
+
+               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
+       </desc>
+
+       <desc name="srcAlpha">
+               <value name="GL_ZERO"/>
+               <value name="GL_ONE"/>
+               <value name="GL_SRC_COLOR"/>
+               <value name="GL_ONE_MINUS_SRC_COLOR"/>
+               <value name="GL_SRC_ALPHA"/>
+               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
+               <value name="GL_DST_ALPHA"/>
+               <value name="GL_ONE_MINUS_DST_ALPHA"/>
+               <value name="GL_DST_COLOR"/>
+               <value name="GL_ONE_MINUS_DST_COLOR"/>
+               <value name="GL_SRC_ALPHA_SATURATE"/>
+
+               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
+       </desc>
+
+       <desc name="dstAlpha">
+               <value name="GL_ZERO"/>
+               <value name="GL_ONE"/>
+               <value name="GL_SRC_COLOR"/>
+               <value name="GL_ONE_MINUS_SRC_COLOR"/>
+               <value name="GL_SRC_ALPHA"/>
+               <value name="GL_ONE_MINUS_SRC_ALPHA"/>
+               <value name="GL_DST_ALPHA"/>
+               <value name="GL_ONE_MINUS_DST_ALPHA"/>
+               <value name="GL_DST_COLOR"/>
+               <value name="GL_ONE_MINUS_DST_COLOR"/>
+
+               <value name="GL_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/>
+               <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/>
+               <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/>
+       </desc>
+</template>
+
+<template name="PointParameter">
+       <proto>
+               <return type="void"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="const GLtype *" size="dynamic">
+                       <param name="param" type="GLtype"/>
+               </vector>
+       </proto>
+
+       <desc name="pname">
+               <value name="GL_POINT_SIZE_MIN"/>
+               <value name="GL_POINT_SIZE_MAX"/>
+               <value name="GL_POINT_FADE_THRESHOLD_SIZE"/>
+
+               <desc name="params" vector_size="1"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_POINT_DISTANCE_ATTENUATION"/>
+               <desc name="params" vector_size="3"/>
+       </desc>
+</template>
+
+<template name="VertexAttrib">
+       <proto>
+               <return type="void"/>
+               <param name="index" type="GLuint"/>
+               <vector name="v" type="const GLtype *" size="dynamic">
+                       <param name="x" type="GLtype"/>
+                       <param name="y" type="GLtype"/>
+                       <param name="z" type="GLtype"/>
+                       <param name="w" type="GLtype"/>
+               </vector>
+       </proto>
+</template>
+
+<template name="VertexAttribPointer">
+       <proto>
+               <return type="void"/>
+               <param name="index" type="GLuint"/>
+               <param name="size" type="GLint"/>
+               <param name="type" type="GLenum"/>
+               <param name="normalized" type="GLboolean"/>
+               <param name="stride" type="GLsizei"/>
+               <param name="pointer" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="size" error="GL_INVALID_VALUE">
+               <value name="1"/>
+               <value name="2"/>
+               <value name="3"/>
+               <value name="4"/>
+       </desc>
+
+       <desc name="type" error="GL_INVALID_VALUE">
+               <value name="GL_BYTE"/>
+               <value name="GL_UNSIGNED_BYTE"/>
+               <value name="GL_SHORT"/>
+               <value name="GL_UNSIGNED_SHORT"/>
+               <value name="GL_FLOAT"/>
+               <value name="GL_FIXED"/>
+               <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
+               <value name="GL_UNSIGNED_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/>
+               <value name="GL_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/>
+       </desc>
+
+       <desc name="type" category="OES_vertex_type_10_10_10_2">
+               <value name="GL_UNSIGNED_INT_10_10_10_2_OES"/>
+               <value name="GL_INT_10_10_10_2_OES"/>
+
+               <desc name="size">
+                       <value name="3"/>
+                       <value name="4"/>
+               </desc>
+       </desc>
+</template>
+
+<template name="EnableVertexAttribArray">
+       <proto>
+               <return type="void"/>
+               <param name="index" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="DisableVertexAttribArray">
+       <proto>
+               <return type="void"/>
+               <param name="index" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="IsProgram" direction="get">
+       <proto>
+               <return type="GLboolean"/>
+               <param name="program" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="GetProgram" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="pname">
+               <value name="GL_DELETE_STATUS"/>
+               <value name="GL_LINK_STATUS"/>
+               <value name="GL_VALIDATE_STATUS"/>
+               <value name="GL_INFO_LOG_LENGTH"/>
+               <value name="GL_ATTACHED_SHADERS"/>
+               <value name="GL_ACTIVE_ATTRIBUTES"/>
+               <value name="GL_ACTIVE_ATTRIBUTE_MAX_LENGTH"/>
+               <value name="GL_ACTIVE_UNIFORMS"/>
+               <value name="GL_ACTIVE_UNIFORM_MAX_LENGTH"/>
+               <value name="GL_PROGRAM_BINARY_LENGTH_OES" category="OES_get_program_binary"/>
+
+               <desc name="params" convert="false"/>
+       </desc>
+</template>
+
+<template name="GetVertexAttrib" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="index" type="GLuint"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="pname">
+               <value name="GL_VERTEX_ATTRIB_ARRAY_ENABLED"/>
+               <value name="GL_VERTEX_ATTRIB_ARRAY_SIZE"/>
+               <value name="GL_VERTEX_ATTRIB_ARRAY_STRIDE"/>
+               <value name="GL_VERTEX_ATTRIB_ARRAY_TYPE"/>
+               <value name="GL_VERTEX_ATTRIB_ARRAY_NORMALIZED"/>
+               <value name="GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"/>
+
+               <desc name="params" vector_size="1" convert="false"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_CURRENT_VERTEX_ATTRIB"/>
+               <desc name="params" vector_size="16?" convert="false"/>
+       </desc>
+</template>
+
+<template name="GetVertexAttribPointer" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="index" type="GLuint"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="pointer" type="GLvoid **" size="dynamic"/>
+       </proto>
+
+       <desc name="pname">
+               <value name="GL_VERTEX_ATTRIB_ARRAY_POINTER"/>
+       </desc>
+</template>
+
+<template name="GetBufferPointer" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLvoid **" size="dynamic"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_ARRAY_BUFFER"/>
+               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_BUFFER_MAP_POINTER_OES"/>
+       </desc>
+</template>
+
+<template name="MapBuffer" direction="get">
+       <proto>
+               <return type="void *"/>
+               <param name="target" type="GLenum"/>
+               <param name="access" type="GLenum"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_ARRAY_BUFFER"/>
+               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
+       </desc>
+
+       <desc name="access">
+               <value name="GL_WRITE_ONLY_OES"/>
+       </desc>
+</template>
+
+<template name="UnmapBuffer" direction="get">
+       <proto>
+               <return type="GLboolean"/>
+               <param name="target" type="GLenum"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_ARRAY_BUFFER"/>
+               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
+       </desc>
+</template>
+
+<template name="BindBuffer">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="buffer" type="GLuint"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_ARRAY_BUFFER"/>
+               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
+       </desc>
+</template>
+
+<template name="BufferData">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="size" type="GLsizeiptr"/>
+               <param name="data" type="const GLvoid *"/>
+               <param name="usage" type="GLenum"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_ARRAY_BUFFER"/>
+               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
+       </desc>
+
+       <desc name="usage">
+               <value name="GL_STATIC_DRAW"/>
+               <value name="GL_DYNAMIC_DRAW"/>
+               <value name="GL_STREAM_DRAW" category="GLES2.0"/>
+       </desc>
+</template>
+
+<template name="BufferSubData">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="offset" type="GLintptr"/>
+               <param name="size" type="GLsizeiptr"/>
+               <param name="data" type="const GLvoid *"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_ARRAY_BUFFER"/>
+               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
+       </desc>
+</template>
+
+<template name="DeleteBuffers">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="buffer" type="const GLuint *"/>
+       </proto>
+</template>
+
+<template name="GenBuffers" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="buffer" type="GLuint *"/>
+       </proto>
+</template>
+
+<template name="GetBufferParameter" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_ARRAY_BUFFER"/>
+               <value name="GL_ELEMENT_ARRAY_BUFFER"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_BUFFER_SIZE"/>
+               <value name="GL_BUFFER_USAGE"/>
+               <value name="GL_BUFFER_ACCESS_OES" category="OES_mapbuffer"/>
+               <value name="GL_BUFFER_MAPPED_OES" category="OES_mapbuffer"/>
+       </desc>
+</template>
+
+<template name="IsBuffer" direction="get">
+       <proto>
+               <return type="GLboolean"/>
+               <param name="buffer" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="CreateShader">
+       <proto>
+               <return type="GLuint"/>
+               <param name="type" type="GLenum"/>
+       </proto>
+
+       <desc name="type">
+               <value name="GL_VERTEX_SHADER"/>
+               <value name="GL_FRAGMENT_SHADER"/>
+       </desc>
+</template>
+
+<template name="ShaderSource">
+       <proto>
+               <return type="void"/>
+               <param name="shader" type="GLuint"/>
+               <param name="count" type="GLsizei"/>
+               <param name="string" type="const GLchar **"/>
+               <param name="length" type="const int *"/>
+       </proto>
+</template>
+
+<template name="CompileShader">
+       <proto>
+               <return type="void"/>
+               <param name="shader" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="ReleaseShaderCompiler">
+       <proto>
+               <return type="void"/>
+       </proto>
+</template>
+
+<template name="DeleteShader">
+       <proto>
+               <return type="void"/>
+               <param name="shader" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="ShaderBinary">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="shaders" type="const GLuint *"/>
+               <param name="binaryformat" type="GLenum"/>
+               <param name="binary" type="const GLvoid *"/>
+               <param name="length" type="GLsizei"/>
+       </proto>
+</template>
+
+<template name="CreateProgram">
+       <proto>
+               <return type="GLuint"/>
+       </proto>
+</template>
+
+<template name="AttachShader">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="shader" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="DetachShader">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="shader" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="LinkProgram">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="UseProgram">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="DeleteProgram">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="GetActiveAttrib" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="index" type="GLuint"/>
+               <param name="bufSize" type="GLsizei"/>
+               <param name="length" type="GLsizei *"/>
+               <param name="size" type="GLint *"/>
+               <param name="type" type="GLenum *"/>
+               <param name="name" type="GLchar *"/>
+       </proto>
+</template>
+
+<template name="GetAttribLocation" direction="get">
+       <proto>
+               <return type="GLint"/>
+               <param name="program" type="GLuint"/>
+               <param name="name" type="const char *"/>
+       </proto>
+</template>
+
+<template name="BindAttribLocation">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="index" type="GLuint"/>
+               <param name="name" type="const char *"/>
+       </proto>
+</template>
+
+<template name="GetUniformLocation" direction="get">
+       <proto>
+               <return type="GLint"/>
+               <param name="program" type="GLuint"/>
+               <param name="name" type="const char *"/>
+       </proto>
+</template>
+
+<template name="GetActiveUniform" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="index" type="GLuint"/>
+               <param name="bufSize" type="GLsizei"/>
+               <param name="length" type="GLsizei *"/>
+               <param name="size" type="GLint *"/>
+               <param name="type" type="GLenum *"/>
+               <param name="name" type="GLchar *"/>
+       </proto>
+</template>
+
+<template name="Uniform">
+       <proto>
+               <return type="void"/>
+               <param name="location" type="GLint"/>
+               <param name="count" type="GLsizei" hide_if_expanded="true"/>
+               <vector name="values" type="const GLtype *" size="dynamic">
+                       <param name="v0" type="GLtype"/>
+                       <param name="v1" type="GLtype"/>
+                       <param name="v2" type="GLtype"/>
+                       <param name="v3" type="GLtype"/>
+               </vector>
+       </proto>
+</template>
+
+<template name="UniformMatrix">
+       <proto>
+               <return type="void"/>
+               <param name="location" type="GLint"/>
+               <param name="count" type="GLsizei"/>
+               <param name="transpose" type="GLboolean"/>
+               <vector name="value" type="const GLtype *" size="dynamic"/>
+       </proto>
+</template>
+
+<template name="ValidateProgram">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="GenerateMipmap">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+       </desc>
+</template>
+
+<template name="BindFramebuffer">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="framebuffer" type="GLuint"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
+       </desc>
+</template>
+
+<template name="DeleteFramebuffers">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="framebuffers" type="const GLuint *"/>
+       </proto>
+</template>
+
+<template name="GenFramebuffers">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="ids" type="GLuint *"/>
+       </proto>
+</template>
+
+<template name="BindRenderbuffer">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="renderbuffer" type="GLuint"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
+       </desc>
+</template>
+
+<template name="DeleteRenderbuffers">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="renderbuffers" type="const GLuint *"/>
+       </proto>
+</template>
+
+<template name="GenRenderbuffers">
+       <proto>
+               <return type="void"/>
+               <param name="n" type="GLsizei"/>
+               <param name="renderbuffers" type="GLuint *"/>
+       </proto>
+</template>
+
+<template name="RenderbufferStorage">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="internalFormat" type="GLenum"/>
+               <param name="width" type="GLsizei"/>
+               <param name="height" type="GLsizei"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
+       </desc>
+
+       <desc name="internalFormat">
+               <value name="GL_DEPTH_COMPONENT16_OES" category="OES_framebuffer_object"/>
+               <value name="GL_RGBA4_OES" category="OES_framebuffer_object"/>
+               <value name="GL_RGB5_A1_OES" category="OES_framebuffer_object"/>
+               <value name="GL_RGB565_OES" category="OES_framebuffer_object"/>
+               <value name="GL_STENCIL_INDEX8_OES" category="OES_stencil8"/>
+
+               <value name="GL_DEPTH_COMPONENT16" category="GLES2.0"/>
+               <value name="GL_RGBA4" category="GLES2.0"/>
+               <value name="GL_RGB5_A1" category="GLES2.0"/>
+               <value name="GL_RGB565" category="GLES2.0"/>
+               <value name="GL_STENCIL_INDEX8" category="GLES2.0"/>
+
+               <value name="GL_DEPTH_COMPONENT24_OES" category="OES_depth24"/>
+               <value name="GL_DEPTH_COMPONENT32_OES" category="OES_depth32"/>
+               <value name="GL_RGB8_OES" category="OES_rgb8_rgba8"/>
+               <value name="GL_RGBA8_OES" category="OES_rgb8_rgba8"/>
+               <value name="GL_STENCIL_INDEX1_OES" category="OES_stencil1"/>
+               <value name="GL_STENCIL_INDEX4_OES" category="OES_stencil4"/>
+               <value name="GL_DEPTH24_STENCIL8_OES" category="OES_packed_depth_stencil"/>
+       </desc>
+</template>
+
+<template name="FramebufferRenderbuffer">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="attachment" type="GLenum"/>
+               <param name="renderbuffertarget" type="GLenum"/>
+               <param name="renderbuffer" type="GLuint"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
+       </desc>
+
+       <desc name="attachment">
+               <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
+               <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
+               <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
+               <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
+               <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
+               <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
+       </desc>
+
+       <desc name="renderbuffertarget">
+               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
+       </desc>
+</template>
+
+<template name="FramebufferTexture2D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="attachment" type="GLenum"/>
+               <param name="textarget" type="GLenum"/>
+               <param name="texture" type="GLuint"/>
+               <param name="level" type="GLint"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
+       </desc>
+
+       <desc name="attachment">
+               <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
+               <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
+               <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
+               <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
+               <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
+               <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
+       </desc>
+
+       <desc name="textarget" error="GL_INVALID_OPERATION">
+               <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
+       </desc>
+       <!-- According to the base specification, "level" must be 0.  But
+            extension GL_OES_fbo_render_mipmap lifts that restriction,
+            so no restriction is placed here. -->
+</template>
+
+<template name="FramebufferTexture3D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="attachment" type="GLenum"/>
+               <param name="textarget" type="GLenum"/>
+               <param name="texture" type="GLuint"/>
+               <param name="level" type="GLint"/>
+               <param name="zoffset" type="GLint"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
+       </desc>
+
+       <desc name="attachment">
+               <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/>
+               <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/>
+               <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/>
+               <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/>
+               <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/>
+               <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/>
+       </desc>
+
+       <desc name="textarget" error="GL_INVALID_OPERATION">
+               <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+       </desc>
+</template>
+
+<template name="CheckFramebufferStatus" direction="get">
+       <proto>
+               <return type="GLenum"/>
+               <param name="target" type="GLenum"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
+       </desc>
+</template>
+
+<template name="GetFramebufferAttachmentParameter" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="attachment" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER" category="GLES2.0"/>
+       </desc>
+
+       <desc name="pname">
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES" category="OES_framebuffer_object"/>
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES" category="OES_framebuffer_object"/>
+
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE" category="GLES2.0"/>
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME" category="GLES2.0"/>
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL" category="GLES2.0"/>
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE" category="GLES2.0"/>
+               <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" category="OES_texture_3D"/>
+
+               <desc name="params" vector_size="1" convert="false"/>
+       </desc>
+</template>
+
+<template name="GetRenderbufferParameter" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
+       </desc>
+
+       <desc name="pname" category="OES_framebuffer_object">
+               <value name="GL_RENDERBUFFER_WIDTH_OES"/>
+               <value name="GL_RENDERBUFFER_HEIGHT_OES"/>
+               <value name="GL_RENDERBUFFER_INTERNAL_FORMAT_OES"/>
+               <value name="GL_RENDERBUFFER_RED_SIZE_OES"/>
+               <value name="GL_RENDERBUFFER_GREEN_SIZE_OES"/>
+               <value name="GL_RENDERBUFFER_BLUE_SIZE_OES"/>
+               <value name="GL_RENDERBUFFER_ALPHA_SIZE_OES"/>
+               <value name="GL_RENDERBUFFER_DEPTH_SIZE_OES"/>
+               <value name="GL_RENDERBUFFER_STENCIL_SIZE_OES"/>
+
+               <desc name="params" vector_size="1" convert="false"/>
+       </desc>
+
+       <desc name="pname" category="GLES2.0">
+               <value name="GL_RENDERBUFFER_WIDTH"/>
+               <value name="GL_RENDERBUFFER_HEIGHT"/>
+               <value name="GL_RENDERBUFFER_INTERNAL_FORMAT"/>
+               <value name="GL_RENDERBUFFER_RED_SIZE"/>
+               <value name="GL_RENDERBUFFER_GREEN_SIZE"/>
+               <value name="GL_RENDERBUFFER_BLUE_SIZE"/>
+               <value name="GL_RENDERBUFFER_ALPHA_SIZE"/>
+               <value name="GL_RENDERBUFFER_DEPTH_SIZE"/>
+               <value name="GL_RENDERBUFFER_STENCIL_SIZE"/>
+
+               <desc name="params" vector_size="1" convert="false"/>
+       </desc>
+</template>
+
+<template name="IsRenderbuffer" direction="get">
+       <proto>
+               <return type="GLboolean"/>
+               <param name="renderbuffer" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="IsFramebuffer" direction="get">
+       <proto>
+               <return type="GLboolean"/>
+               <param name="framebuffer" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="IsShader" direction="get">
+       <proto>
+               <return type="GLboolean"/>
+               <param name="shader" type="GLuint"/>
+       </proto>
+</template>
+
+<template name="GetShader" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="shader" type="GLuint"/>
+               <param name="pname" type="GLenum"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+
+       <desc name="pname">
+               <value name="GL_SHADER_TYPE"/>
+               <value name="GL_COMPILE_STATUS"/>
+               <value name="GL_DELETE_STATUS"/>
+               <value name="GL_INFO_LOG_LENGTH"/>
+               <value name="GL_SHADER_SOURCE_LENGTH"/>
+       </desc>
+</template>
+
+<template name="GetAttachedShaders" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="maxCount" type="GLsizei"/>
+               <param name="count" type="GLsizei *"/>
+               <param name="shaders" type="GLuint *"/>
+       </proto>
+</template>
+
+<template name="GetShaderInfoLog" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="shader" type="GLuint"/>
+               <param name="bufSize" type="GLsizei"/>
+               <param name="length" type="GLsizei *"/>
+               <param name="infoLog" type="GLchar *"/>
+       </proto>
+</template>
+
+<template name="GetProgramInfoLog" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="bufSize" type="GLsizei"/>
+               <param name="length" type="GLsizei *"/>
+               <param name="infoLog" type="GLchar *"/>
+       </proto>
+</template>
+
+<template name="GetShaderSource" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="shader" type="GLuint"/>
+               <param name="bufSize" type="GLsizei"/>
+               <param name="length" type="GLsizei *"/>
+               <param name="source" type="GLchar *"/>
+       </proto>
+</template>
+
+<template name="GetShaderPrecisionFormat" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="shadertype" type="GLenum"/>
+               <param name="precisiontype" type="GLenum"/>
+               <param name="range" type="GLint *"/>
+               <param name="precision" type="GLint *"/>
+       </proto>
+
+       <desc name="shadertype">
+               <value name="GL_VERTEX_SHADER"/>
+               <value name="GL_FRAGMENT_SHADER"/>
+       </desc>
+
+       <desc name="precisiontype">
+               <value name="GL_LOW_FLOAT"/>
+               <value name="GL_MEDIUM_FLOAT"/>
+               <value name="GL_HIGH_FLOAT"/>
+               <value name="GL_LOW_INT"/>
+               <value name="GL_MEDIUM_INT"/>
+               <value name="GL_HIGH_INT"/>
+       </desc>
+</template>
+
+<template name="GetUniform" direction="get">
+       <proto>
+               <return type="void"/>
+               <param name="program" type="GLuint"/>
+               <param name="location" type="GLint"/>
+               <vector name="params" type="GLtype *" size="dynamic"/>
+       </proto>
+</template>
+
+<template name="QueryMatrix" direction="get">
+       <proto>
+               <return type="GLbitfield"/>
+               <vector name="mantissa" type="GLtype *" size="16"/>
+               <vector name="exponent" type="GLint *" size="16"/>
+       </proto>
+</template>
+
+<template name="DrawTex">
+       <proto>
+               <return type="void"/>
+               <vector name="coords" type="const GLtype *" size="5">
+                       <param name="x" type="GLtype"/>
+                       <param name="y" type="GLtype"/>
+                       <param name="z" type="GLtype"/>
+                       <param name="w" type="GLtype"/>
+                       <param name="h" type="GLtype"/>
+               </vector>
+       </proto>
+</template>
+
+<template name="MultiDrawArrays">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+               <param name="first" type="GLint *"/>
+               <param name="count" type="GLsizei *"/>
+               <param name="primcount" type="GLsizei"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_POINTS"/>
+               <value name="GL_LINES"/>
+               <value name="GL_LINE_LOOP"/>
+               <value name="GL_LINE_STRIP"/>
+               <value name="GL_TRIANGLES"/>
+               <value name="GL_TRIANGLE_STRIP"/>
+               <value name="GL_TRIANGLE_FAN"/>
+       </desc>
+</template>
+
+<template name="MultiDrawElements">
+       <proto>
+               <return type="void"/>
+               <param name="mode" type="GLenum"/>
+               <param name="count" type="const GLsizei *"/>
+               <param name="type" type="GLenum"/>
+               <param name="indices" type="const GLvoid **"/>
+               <param name="primcount" type="GLsizei"/>
+       </proto>
+
+       <desc name="mode">
+               <value name="GL_POINTS"/>
+               <value name="GL_LINES"/>
+               <value name="GL_LINE_LOOP"/>
+               <value name="GL_LINE_STRIP"/>
+               <value name="GL_TRIANGLES"/>
+               <value name="GL_TRIANGLE_STRIP"/>
+               <value name="GL_TRIANGLE_FAN"/>
+       </desc>
+
+       <desc name="type">
+               <value name="GL_UNSIGNED_BYTE"/>
+               <value name="GL_UNSIGNED_SHORT"/>
+               <!-- GL_UNSIGNED_INT is not defined in GLES1.1 headers -->
+               <value name="(0x1405 /* GL_UNSIGNED_INT */)" category="OES_element_index_uint"/>
+       </desc>
+</template>
+
+<template name="EGLImageTargetTexture2D">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="image" type="GLeglImageOES"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_TEXTURE_2D"/>
+       </desc>
+</template>
+
+<template name="EGLImageTargetRenderbufferStorage">
+       <proto>
+               <return type="void"/>
+               <param name="target" type="GLenum"/>
+               <param name="image" type="GLeglImageOES"/>
+       </proto>
+
+       <desc name="target">
+               <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/>
+               <value name="GL_RENDERBUFFER" category="GLES2.0"/>
+       </desc>
+</template>
+
+<api name="mesa" implementation="true">
+       <category name="MESA"/>
+
+       <function name="Color4f"  default_prefix="_vbo_" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="ClipPlane" template="ClipPlane" gltype="GLdouble"/>
+       <function name="CullFace" template="CullFace"/>
+
+       <function name="Fogf" template="Fog" gltype="GLfloat" expand_vector="true"/>
+       <function name="Fogfv" template="Fog" gltype="GLfloat"/>
+
+       <function name="FrontFace" template="FrontFace"/>
+       <function name="Hint" template="Hint"/>
+
+       <function name="Lightf" template="Light" gltype="GLfloat" expand_vector="true"/>
+       <function name="Lightfv" template="Light" gltype="GLfloat"/>
+
+       <function name="LightModelf" template="LightModel" gltype="GLfloat" expand_vector="true"/>
+       <function name="LightModelfv" template="LightModel" gltype="GLfloat"/>
+
+       <function name="LineWidth" template="LineWidth" gltype="GLfloat"/>
+
+       <function name="Materialf" default_prefix="_vbo_" template="Material" gltype="GLfloat" expand_vector="true"/>
+       <function name="Materialfv" default_prefix="_vbo_" template="Material" gltype="GLfloat"/>
+
+       <function name="PointSize" template="PointSize" gltype="GLfloat"/>
+       <function name="PointSizePointer" template="PointSizePointer"/>
+
+       <function name="Scissor" template="Scissor"/>
+       <function name="ShadeModel" template="ShadeModel"/>
+
+       <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/>
+       <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/>
+       <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/>
+       <function name="TexParameteriv" template="TexParameter" gltype="GLint"/>
+
+       <function name="TexImage2D" template="TexImage2D"/>
+
+       <function name="TexEnvf" template="TexEnv" gltype="GLfloat" expand_vector="true"/>
+       <function name="TexEnvi" template="TexEnv" gltype="GLint" expand_vector="true"/>
+       <function name="TexEnvfv" template="TexEnv" gltype="GLfloat"/>
+       <function name="TexEnviv" template="TexEnv" gltype="GLint"/>
+
+       <function name="TexGenf" template="TexGen" gltype="GLfloat" expand_vector="true"/>
+       <function name="TexGenfv" template="TexGen" gltype="GLfloat"/>
+
+       <function name="Clear" template="Clear"/>
+       <function name="ClearColor" template="ClearColor" gltype="GLclampf"/>
+       <function name="ClearStencil" template="ClearStencil"/>
+       <function name="ClearDepth" template="ClearDepth" gltype="GLclampd"/>
+
+       <function name="StencilMask" template="StencilMask"/>
+       <function name="StencilMaskSeparate" template="StencilMaskSeparate"/>
+       <function name="ColorMask" template="ColorMask"/>
+       <function name="DepthMask" template="DepthMask"/>
+       <function name="Disable" template="Disable"/>
+       <function name="Enable" template="Enable"/>
+       <function name="Finish" template="Finish"/>
+       <function name="Flush" template="Flush"/>
+
+       <function name="AlphaFunc" template="AlphaFunc" gltype="GLclampf"/>
+
+       <function name="BlendFunc" template="BlendFunc"/>
+       <function name="LogicOp" template="LogicOp"/>
+       <function name="StencilFunc" template="StencilFunc"/>
+       <function name="StencilFuncSeparate" template="StencilFuncSeparate"/>
+       <function name="StencilOp" template="StencilOp"/>
+       <function name="StencilOpSeparate" template="StencilOpSeparate"/>
+       <function name="DepthFunc" template="DepthFunc"/>
+       <function name="PixelStorei" template="PixelStore" gltype="GLint"/>
+
+       <function name="ReadPixels" template="ReadPixels"/>
+       <function name="GetBooleanv" template="GetState" gltype="GLboolean"/>
+       <function name="GetClipPlane" template="GetClipPlane" gltype="GLdouble"/>
+       <function name="GetError" template="GetError"/>
+       <function name="GetFloatv" template="GetState" gltype="GLfloat"/>
+       <function name="GetFixedv" template="GetState" gltype="GLfixed"/>
+       <function name="GetIntegerv" template="GetState" gltype="GLint"/>
+
+       <function name="GetLightfv" template="GetLight" gltype="GLfloat"/>
+       <function name="GetMaterialfv" template="GetMaterial" gltype="GLfloat"/>
+       <function name="GetMaterialiv" template="GetMaterial" gltype="GLint"/>
+
+       <function name="GetString" template="GetString"/>
+
+       <function name="GetTexEnvfv" template="GetTexEnv" gltype="GLfloat"/>
+       <function name="GetTexEnviv" template="GetTexEnv" gltype="GLint"/>
+       <function name="GetTexGenfv" template="GetTexGen" gltype="GLfloat"/>
+       <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/>
+       <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/>
+
+       <function name="IsEnabled" template="IsEnabled"/>
+
+       <function name="DepthRange" template="DepthRange" gltype="GLclampd"/>
+       <function name="Frustum" template="Frustum" gltype="GLdouble"/>
+
+       <function name="LoadIdentity" template="LoadIdentity"/>
+       <function name="LoadMatrixf" template="LoadMatrix" gltype="GLfloat"/>
+       <function name="MatrixMode" template="MatrixMode"/>
+
+       <function name="MultMatrixf" template="MultMatrix" gltype="GLfloat"/>
+       <function name="Ortho" template="Ortho" gltype="GLdouble"/>
+       <function name="PopMatrix" template="PopMatrix"/>
+       <function name="PushMatrix" template="PushMatrix"/>
+
+       <function name="Rotatef" template="Rotate" gltype="GLfloat"/>
+       <function name="Scalef" template="Scale" gltype="GLfloat"/>
+       <function name="Translatef" template="Translate" gltype="GLfloat"/>
+
+       <function name="Viewport" template="Viewport"/>
+
+       <function name="ColorPointer" template="ColorPointer"/>
+       <function name="DisableClientState" template="DisableClientState"/>
+       <function name="DrawArrays" template="DrawArrays"/>
+       <function name="DrawElements" template="DrawElements"/>
+       <function name="EnableClientState" template="EnableClientState"/>
+
+       <function name="GetPointerv" template="GetPointer"/>
+       <function name="Normal3f" default_prefix="_vbo_" template="Normal" gltype="GLfloat" expand_vector="true"/>
+       <function name="NormalPointer" template="NormalPointer"/>
+       <function name="TexCoordPointer" template="TexCoordPointer"/>
+       <function name="VertexPointer" template="VertexPointer"/>
+
+       <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/>
+       <function name="CopyTexImage2D" template="CopyTexImage2D"/>
+       <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/>
+       <function name="TexSubImage2D" template="TexSubImage2D"/>
+
+       <function name="BindTexture" template="BindTexture"/>
+       <function name="DeleteTextures" template="DeleteTextures"/>
+       <function name="GenTextures" template="GenTextures"/>
+       <function name="IsTexture" template="IsTexture"/>
+
+       <function name="BlendColor" template="BlendColor" gltype="GLclampf"/>
+       <function name="BlendEquation" template="BlendEquation"/>
+       <function name="BlendEquationSeparateEXT" template="BlendEquationSeparate"/>
+
+       <function name="TexImage3D" template="TexImage3D"/>
+       <function name="TexSubImage3D" template="TexSubImage3D"/>
+       <function name="CopyTexSubImage3D" template="CopyTexSubImage3D"/>
+
+       <function name="CompressedTexImage3DARB" template="CompressedTexImage3D"/>
+       <function name="CompressedTexSubImage3DARB" template="CompressedTexSubImage3D"/>
+
+       <function name="ActiveTextureARB" template="ActiveTexture"/>
+       <function name="ClientActiveTextureARB" template="ClientActiveTexture"/>
+
+       <function name="MultiTexCoord4f" default_prefix="_vbo_" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+
+       <function name="SampleCoverageARB" template="SampleCoverage" gltype="GLclampf"/>
+
+       <function name="CompressedTexImage2DARB" template="CompressedTexImage2D"/>
+       <function name="CompressedTexSubImage2DARB" template="CompressedTexSubImage2D"/>
+
+       <function name="BlendFuncSeparateEXT" template="BlendFuncSeparate"/>
+
+       <function name="PointParameterf" template="PointParameter" gltype="GLfloat" expand_vector="true"/>
+       <function name="PointParameterfv" template="PointParameter" gltype="GLfloat"/>
+
+       <function name="VertexAttrib1f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
+       <function name="VertexAttrib2f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
+       <function name="VertexAttrib3f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
+       <function name="VertexAttrib4f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="VertexAttrib1fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
+       <function name="VertexAttrib2fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
+       <function name="VertexAttrib3fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
+       <function name="VertexAttrib4fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="4"/>
+
+       <function name="VertexAttribPointerARB" template="VertexAttribPointer"/>
+       <function name="EnableVertexAttribArrayARB" template="EnableVertexAttribArray"/>
+       <function name="DisableVertexAttribArrayARB" template="DisableVertexAttribArray"/>
+
+       <function name="IsProgram" template="IsProgram"/>
+       <function name="GetProgramiv" template="GetProgram" gltype="GLint"/>
+
+       <function name="GetVertexAttribfvARB" template="GetVertexAttrib" gltype="GLfloat"/>
+       <function name="GetVertexAttribivARB" template="GetVertexAttrib" gltype="GLint"/>
+       <function name="GetVertexAttribPointervARB" template="GetVertexAttribPointer"/>
+
+       <function name="GetBufferPointervARB" template="GetBufferPointer"/>
+       <function name="MapBufferARB" template="MapBuffer"/>
+       <function name="UnmapBufferARB" template="UnmapBuffer"/>
+       <function name="BindBufferARB" template="BindBuffer"/>
+       <function name="BufferDataARB" template="BufferData"/>
+       <function name="BufferSubDataARB" template="BufferSubData"/>
+       <function name="DeleteBuffersARB" template="DeleteBuffers"/>
+       <function name="GenBuffersARB" template="GenBuffers"/>
+       <function name="GetBufferParameterivARB" template="GetBufferParameter" gltype="GLint"/>
+       <function name="IsBufferARB" template="IsBuffer"/>
+
+       <function name="CreateShader" template="CreateShader"/>
+       <function name="ShaderSourceARB" template="ShaderSource"/>
+       <function name="CompileShaderARB" template="CompileShader"/>
+       <function name="ReleaseShaderCompiler" template="ReleaseShaderCompiler"/>
+       <function name="DeleteShader" template="DeleteShader"/>
+       <function name="ShaderBinary" template="ShaderBinary"/>
+       <function name="CreateProgram" template="CreateProgram"/>
+       <function name="AttachShader" template="AttachShader"/>
+       <function name="DetachShader" template="DetachShader"/>
+       <function name="LinkProgramARB" template="LinkProgram"/>
+       <function name="UseProgramObjectARB" template="UseProgram"/>
+       <function name="DeleteProgram" template="DeleteProgram"/>
+
+       <function name="GetActiveAttribARB" template="GetActiveAttrib"/>
+       <function name="GetAttribLocationARB" template="GetAttribLocation"/>
+       <function name="BindAttribLocationARB" template="BindAttribLocation"/>
+       <function name="GetUniformLocationARB" template="GetUniformLocation"/>
+       <function name="GetActiveUniformARB" template="GetActiveUniform"/>
+
+       <function name="Uniform1fARB" template="Uniform" gltype="GLfloat" vector_size="1" expand_vector="true"/>
+       <function name="Uniform2fARB" template="Uniform" gltype="GLfloat" vector_size="2" expand_vector="true"/>
+       <function name="Uniform3fARB" template="Uniform" gltype="GLfloat" vector_size="3" expand_vector="true"/>
+       <function name="Uniform4fARB" template="Uniform" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="Uniform1iARB" template="Uniform" gltype="GLint" vector_size="1" expand_vector="true"/>
+       <function name="Uniform2iARB" template="Uniform" gltype="GLint" vector_size="2" expand_vector="true"/>
+       <function name="Uniform3iARB" template="Uniform" gltype="GLint" vector_size="3" expand_vector="true"/>
+       <function name="Uniform4iARB" template="Uniform" gltype="GLint" vector_size="4" expand_vector="true"/>
+       <function name="Uniform1fvARB" template="Uniform" gltype="GLfloat" vector_size="1"/>
+       <function name="Uniform2fvARB" template="Uniform" gltype="GLfloat" vector_size="2"/>
+       <function name="Uniform3fvARB" template="Uniform" gltype="GLfloat" vector_size="3"/>
+       <function name="Uniform4fvARB" template="Uniform" gltype="GLfloat" vector_size="4"/>
+       <function name="Uniform1ivARB" template="Uniform" gltype="GLint" vector_size="1"/>
+       <function name="Uniform2ivARB" template="Uniform" gltype="GLint" vector_size="2"/>
+       <function name="Uniform3ivARB" template="Uniform" gltype="GLint" vector_size="3"/>
+       <function name="Uniform4ivARB" template="Uniform" gltype="GLint" vector_size="4"/>
+
+       <function name="UniformMatrix2fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="2"/>
+       <function name="UniformMatrix3fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="3"/>
+       <function name="UniformMatrix4fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="4"/>
+
+       <function name="ValidateProgramARB" template="ValidateProgram"/>
+
+       <function name="GenerateMipmapEXT" template="GenerateMipmap"/>
+       <function name="BindFramebufferEXT" template="BindFramebuffer"/>
+       <function name="DeleteFramebuffersEXT" template="DeleteFramebuffers"/>
+       <function name="GenFramebuffersEXT" template="GenFramebuffers"/>
+       <function name="BindRenderbufferEXT" template="BindRenderbuffer"/>
+       <function name="DeleteRenderbuffersEXT" template="DeleteRenderbuffers"/>
+       <function name="GenRenderbuffersEXT" template="GenRenderbuffers"/>
+       <function name="RenderbufferStorageEXT" template="RenderbufferStorage"/>
+       <function name="FramebufferRenderbufferEXT" template="FramebufferRenderbuffer"/>
+       <function name="FramebufferTexture2DEXT" template="FramebufferTexture2D"/>
+       <function name="FramebufferTexture3DEXT" template="FramebufferTexture3D"/>
+       <function name="CheckFramebufferStatusEXT" template="CheckFramebufferStatus"/>
+       <function name="GetFramebufferAttachmentParameterivEXT" template="GetFramebufferAttachmentParameter" gltype="GLint"/>
+       <function name="GetRenderbufferParameterivEXT" template="GetRenderbufferParameter" gltype="GLint"/>
+       <function name="IsRenderbufferEXT" template="IsRenderbuffer"/>
+       <function name="IsFramebufferEXT" template="IsFramebuffer"/>
+
+       <function name="IsShader" template="IsShader"/>
+       <function name="GetShaderiv" template="GetShader" gltype="GLint"/>
+       <function name="GetAttachedShaders" template="GetAttachedShaders"/>
+       <function name="GetShaderInfoLog" template="GetShaderInfoLog"/>
+       <function name="GetProgramInfoLog" template="GetProgramInfoLog"/>
+       <function name="GetShaderSourceARB" template="GetShaderSource"/>
+       <function name="GetShaderPrecisionFormat" template="GetShaderPrecisionFormat"/>
+       <function name="GetUniformfvARB" template="GetUniform" gltype="GLfloat"/>
+       <function name="GetUniformivARB" template="GetUniform" gltype="GLint"/>
+
+       <function name="DrawTexf" template="DrawTex" gltype="GLfloat" expand_vector="true"/>
+       <function name="DrawTexfv" template="DrawTex" gltype="GLfloat"/>
+       <function name="DrawTexi" template="DrawTex" gltype="GLint" expand_vector="true"/>
+       <function name="DrawTexiv" template="DrawTex" gltype="GLint"/>
+       <function name="DrawTexs" template="DrawTex" gltype="GLshort" expand_vector="true"/>
+       <function name="DrawTexsv" template="DrawTex" gltype="GLshort"/>
+
+        <!-- EXT_multi_draw_arrays -->
+        <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/>
+        <function name="MultiDrawElementsEXT" template="MultiDrawElements"/>
+
+        <!-- OES_EGL_image -->
+        <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/>
+        <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/>
+</api>
+
+<api name="GLES1.1">
+       <category name="GLES1.1"/>
+
+       <category name="OES_byte_coordinates"/>
+       <category name="OES_fixed_point"/>
+       <category name="OES_single_precision"/>
+       <category name="OES_matrix_get"/>
+       <category name="OES_read_format"/>
+       <category name="OES_compressed_paletted_texture"/>
+       <category name="OES_point_size_array"/>
+       <category name="OES_point_sprite"/>
+       <category name="OES_query_matrix"/>
+       <category name="OES_draw_texture"/>
+       <category name="OES_blend_equation_separate"/>
+       <category name="OES_blend_func_separate"/>
+       <category name="OES_blend_subtract"/>
+       <category name="OES_stencil_wrap"/>
+       <category name="OES_texture_cube_map"/>
+       <category name="OES_texture_env_crossbar"/>
+       <category name="OES_texture_mirrored_repeat"/>
+       <category name="OES_framebuffer_object"/>
+       <category name="OES_depth24"/>
+       <category name="OES_depth32"/>
+       <category name="OES_fbo_render_mipmap"/>
+       <category name="OES_rgb8_rgba8"/>
+       <category name="OES_stencil1"/>
+       <category name="OES_stencil4"/>
+       <category name="OES_stencil8"/>
+       <category name="OES_element_index_uint"/>
+       <category name="OES_mapbuffer"/>
+       <category name="EXT_texture_filter_anisotropic"/>
+
+       <category name="ARB_texture_non_power_of_two"/>
+       <!-- disabled due to missing enums
+       <category name="EXT_texture_compression_dxt1"/>
+       <category name="EXT_texture_lod_bias"/>
+       <category name="EXT_blend_minmax"/>
+       -->
+       <category name="EXT_multi_draw_arrays"/>
+       <category name="OES_EGL_image"/>
+
+       <category name="OES_matrix_palette"/>
+
+       <function name="Color4f" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="Color4ub" template="Color" gltype="GLubyte" vector_size="4" expand_vector="true"/>
+       <function name="Color4x" template="Color" gltype="GLfixed" vector_size="4" expand_vector="true"/>
+
+       <function name="ClipPlanef" template="ClipPlane" gltype="GLfloat"/>
+       <function name="ClipPlanex" template="ClipPlane" gltype="GLfixed"/>
+
+       <function name="CullFace" template="CullFace"/>
+
+       <function name="Fogf" template="Fog" gltype="GLfloat" expand_vector="true"/>
+       <function name="Fogx" template="Fog" gltype="GLfixed" expand_vector="true"/>
+       <function name="Fogfv" template="Fog" gltype="GLfloat"/>
+       <function name="Fogxv" template="Fog" gltype="GLfixed"/>
+
+       <function name="FrontFace" template="FrontFace"/>
+       <function name="Hint" template="Hint"/>
+
+       <function name="Lightf" template="Light" gltype="GLfloat" expand_vector="true"/>
+       <function name="Lightx" template="Light" gltype="GLfixed" expand_vector="true"/>
+       <function name="Lightfv" template="Light" gltype="GLfloat"/>
+       <function name="Lightxv" template="Light" gltype="GLfixed"/>
+
+       <function name="LightModelf" template="LightModel" gltype="GLfloat" expand_vector="true"/>
+       <function name="LightModelx" template="LightModel" gltype="GLfixed" expand_vector="true"/>
+       <function name="LightModelfv" template="LightModel" gltype="GLfloat"/>
+       <function name="LightModelxv" template="LightModel" gltype="GLfixed"/>
+
+       <function name="LineWidth" template="LineWidth" gltype="GLfloat"/>
+       <function name="LineWidthx" template="LineWidth" gltype="GLfixed"/>
+
+       <function name="Materialf" template="Material" gltype="GLfloat" expand_vector="true"/>
+       <function name="Materialfv" template="Material" gltype="GLfloat"/>
+       <function name="Materialx" template="Material" gltype="GLfixed" expand_vector="true"/>
+       <function name="Materialxv" template="Material" gltype="GLfixed"/>
+
+       <function name="PointSize" template="PointSize" gltype="GLfloat"/>
+       <function name="PointSizex" template="PointSize" gltype="GLfixed"/>
+       <function name="PointSizePointerOES" template="PointSizePointer"/>
+
+       <function name="Scissor" template="Scissor"/>
+       <function name="ShadeModel" template="ShadeModel"/>
+
+       <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/>
+       <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/>
+       <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/>
+       <function name="TexParameteriv" template="TexParameter" gltype="GLint"/>
+       <function name="TexParameterx" template="TexParameter" gltype="GLfixed" expand_vector="true"/>
+       <function name="TexParameterxv" template="TexParameter" gltype="GLfixed"/>
+
+       <function name="TexImage2D" template="TexImage2D"/>
+
+       <function name="TexEnvf" template="TexEnv" gltype="GLfloat" expand_vector="true"/>
+       <function name="TexEnvfv" template="TexEnv" gltype="GLfloat"/>
+       <function name="TexEnvi" template="TexEnv" gltype="GLint" expand_vector="true"/>
+       <function name="TexEnviv" template="TexEnv" gltype="GLint"/>
+       <function name="TexEnvx" template="TexEnv" gltype="GLfixed" expand_vector="true"/>
+       <function name="TexEnvxv" template="TexEnv" gltype="GLfixed"/>
+
+       <function name="TexGenfOES" external="true" template="TexGen" gltype="GLfloat" expand_vector="true"/>
+       <function name="TexGenfvOES" external="true" template="TexGen" gltype="GLfloat"/>
+       <function name="TexGeniOES" external="true" template="TexGen" gltype="GLint" expand_vector="true"/>
+       <function name="TexGenivOES" external="true" template="TexGen" gltype="GLint"/>
+       <function name="TexGenxOES" external="true" template="TexGen" gltype="GLfixed" expand_vector="true"/>
+       <function name="TexGenxvOES" external="true" template="TexGen" gltype="GLfixed"/>
+
+       <function name="Clear" template="Clear"/>
+       <function name="ClearColor" template="ClearColor" gltype="GLclampf"/>
+       <function name="ClearColorx" template="ClearColor" gltype="GLclampx"/>
+
+       <function name="ClearStencil" template="ClearStencil"/>
+       <function name="ClearDepthf" template="ClearDepth" gltype="GLclampf"/>
+       <function name="ClearDepthx" template="ClearDepth" gltype="GLclampx"/>
+
+       <function name="StencilMask" template="StencilMask"/>
+       <function name="ColorMask" template="ColorMask"/>
+       <function name="DepthMask" template="DepthMask"/>
+
+       <function name="Disable" external="true" template="Disable"/>
+       <function name="Enable" external="true" template="Enable"/>
+       <function name="Finish" template="Finish"/>
+       <function name="Flush" template="Flush"/>
+
+       <function name="AlphaFunc" template="AlphaFunc" gltype="GLclampf"/>
+       <function name="AlphaFuncx" template="AlphaFunc" gltype="GLclampx"/>
+
+       <function name="BlendFunc" template="BlendFunc"/>
+       <function name="LogicOp" template="LogicOp"/>
+       <function name="StencilFunc" template="StencilFunc"/>
+
+       <function name="StencilOp" template="StencilOp"/>
+       <function name="DepthFunc" template="DepthFunc"/>
+
+       <function name="PixelStorei" template="PixelStore" gltype="GLint"/>
+       <function name="ReadPixels" template="ReadPixels"/>
+
+       <function name="GetBooleanv" template="GetState" gltype="GLboolean"/>
+
+       <function name="GetClipPlanef" template="GetClipPlane" gltype="GLfloat"/>
+       <function name="GetClipPlanex" template="GetClipPlane" gltype="GLfixed"/>
+
+       <function name="GetError" template="GetError"/>
+       <function name="GetFloatv" template="GetState" gltype="GLfloat"/>
+       <function name="GetFixedv" template="GetState" gltype="GLfixed"/>
+       <function name="GetIntegerv" template="GetState" gltype="GLint"/>
+
+       <function name="GetLightfv" template="GetLight" gltype="GLfloat"/>
+       <function name="GetLightxv" template="GetLight" gltype="GLfixed"/>
+
+       <function name="GetMaterialfv" template="GetMaterial" gltype="GLfloat"/>
+       <function name="GetMaterialxv" template="GetMaterial" gltype="GLfixed"/>
+
+       <function name="GetString" template="GetString"/>
+
+       <function name="GetTexEnvfv" template="GetTexEnv" gltype="GLfloat"/>
+       <function name="GetTexEnviv" template="GetTexEnv" gltype="GLint"/>
+       <function name="GetTexEnvxv" template="GetTexEnv" gltype="GLfixed"/>
+
+       <function name="GetTexGenfvOES" external="true" template="GetTexGen" gltype="GLfloat"/>
+       <function name="GetTexGenivOES" external="true" template="GetTexGen" gltype="GLint"/>
+       <function name="GetTexGenxvOES" external="true" template="GetTexGen" gltype="GLfixed"/>
+
+       <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/>
+       <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/>
+       <function name="GetTexParameterxv" template="GetTexParameter" gltype="GLfixed"/>
+
+       <function name="IsEnabled" external="true" template="IsEnabled"/>
+
+       <function name="DepthRangef" template="DepthRange" gltype="GLclampf"/>
+       <function name="DepthRangex" template="DepthRange" gltype="GLclampx"/>
+
+       <function name="Frustumf" template="Frustum" gltype="GLfloat"/>
+       <function name="Frustumx" template="Frustum" gltype="GLfixed"/>
+
+       <function name="LoadIdentity" template="LoadIdentity"/>
+       <function name="LoadMatrixf" template="LoadMatrix" gltype="GLfloat"/>
+       <function name="LoadMatrixx" template="LoadMatrix" gltype="GLfixed"/>
+       <function name="MatrixMode" template="MatrixMode"/>
+
+       <function name="MultMatrixf" template="MultMatrix" gltype="GLfloat"/>
+       <function name="MultMatrixx" template="MultMatrix" gltype="GLfixed"/>
+       <function name="Orthof" template="Ortho" gltype="GLfloat"/>
+       <function name="Orthox" template="Ortho" gltype="GLfixed"/>
+
+       <function name="PopMatrix" template="PopMatrix"/>
+       <function name="PushMatrix" template="PushMatrix"/>
+
+       <function name="Rotatef" template="Rotate" gltype="GLfloat"/>
+       <function name="Rotatex" template="Rotate" gltype="GLfixed"/>
+       <function name="Scalef" template="Scale" gltype="GLfloat"/>
+       <function name="Scalex" template="Scale" gltype="GLfixed"/>
+       <function name="Translatef" template="Translate" gltype="GLfloat"/>
+       <function name="Translatex" template="Translate" gltype="GLfixed"/>
+
+       <function name="Viewport" template="Viewport"/>
+       <function name="ColorPointer" template="ColorPointer"/>
+       <function name="DisableClientState" template="DisableClientState"/>
+       <function name="DrawArrays" template="DrawArrays"/>
+       <function name="DrawElements" template="DrawElements"/>
+       <function name="EnableClientState" template="EnableClientState"/>
+
+       <function name="GetPointerv" template="GetPointer"/>
+
+       <function name="Normal3f" template="Normal" gltype="GLfloat" expand_vector="true"/>
+       <function name="Normal3x" template="Normal" gltype="GLfixed" expand_vector="true"/>
+       <function name="NormalPointer" template="NormalPointer"/>
+       <function name="TexCoordPointer" template="TexCoordPointer"/>
+       <function name="VertexPointer" template="VertexPointer"/>
+
+       <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/>
+       <function name="PolygonOffsetx" template="PolygonOffset" gltype="GLfixed"/>
+
+       <function name="CopyTexImage2D" template="CopyTexImage2D"/>
+       <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/>
+
+       <function name="TexSubImage2D" template="TexSubImage2D"/>
+
+       <function name="BindTexture" template="BindTexture"/>
+       <function name="DeleteTextures" template="DeleteTextures"/>
+       <function name="GenTextures" template="GenTextures"/>
+       <function name="IsTexture" template="IsTexture"/>
+
+       <function name="BlendEquationOES" template="BlendEquation"/>
+       <function name="BlendEquationSeparateOES" template="BlendEquationSeparate"/>
+
+       <function name="MultiTexCoord4x" template="MultiTexCoord" gltype="GLfixed" vector_size="4" expand_vector="true"/>
+
+       <function name="ActiveTexture" template="ActiveTexture"/>
+       <function name="ClientActiveTexture" template="ClientActiveTexture"/>
+
+       <function name="MultiTexCoord4f" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+
+       <function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/>
+       <function name="SampleCoveragex" template="SampleCoverage" gltype="GLclampx"/>
+
+       <!-- CompressedTexImage2D calls out to two different functions based on
+            whether the image is a paletted image or not -->
+       <function name="CompressedTexImage2D" external="true" template="CompressedTexImage2D"/>
+       <function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/>
+
+       <function name="BlendFuncSeparateOES" template="BlendFuncSeparate"/>
+
+       <function name="PointParameterf" template="PointParameter" gltype="GLfloat" expand_vector="true"/>
+       <function name="PointParameterfv" template="PointParameter" gltype="GLfloat"/>
+       <function name="PointParameterx" template="PointParameter" gltype="GLfixed" expand_vector="true"/>
+       <function name="PointParameterxv" template="PointParameter" gltype="GLfixed"/>
+
+       <!-- OES_mapbuffer -->
+       <function name="GetBufferPointervOES" template="GetBufferPointer"/>
+       <function name="MapBufferOES" template="MapBuffer"/>
+       <function name="UnmapBufferOES" template="UnmapBuffer"/>
+
+       <function name="BindBuffer" template="BindBuffer"/>
+       <function name="BufferData" template="BufferData"/>
+       <function name="BufferSubData" template="BufferSubData"/>
+       <function name="DeleteBuffers" template="DeleteBuffers"/>
+       <function name="GenBuffers" template="GenBuffers"/>
+       <function name="GetBufferParameteriv" template="GetBufferParameter" gltype="GLint"/>
+       <function name="IsBuffer" template="IsBuffer"/>
+
+       <!-- OES_framebuffer_object -->
+       <function name="GenerateMipmapOES" template="GenerateMipmap"/>
+       <function name="BindFramebufferOES" template="BindFramebuffer"/>
+       <function name="DeleteFramebuffersOES" template="DeleteFramebuffers"/>
+       <function name="GenFramebuffersOES" template="GenFramebuffers"/>
+       <function name="BindRenderbufferOES" template="BindRenderbuffer"/>
+       <function name="DeleteRenderbuffersOES" template="DeleteRenderbuffers"/>
+       <function name="GenRenderbuffersOES" template="GenRenderbuffers"/>
+       <function name="RenderbufferStorageOES" external="true" template="RenderbufferStorage"/>
+       <function name="FramebufferRenderbufferOES" template="FramebufferRenderbuffer"/>
+       <function name="FramebufferTexture2DOES" template="FramebufferTexture2D"/>
+       <function name="CheckFramebufferStatusOES" template="CheckFramebufferStatus"/>
+       <function name="GetFramebufferAttachmentParameterivOES" template="GetFramebufferAttachmentParameter" gltype="GLint"/>
+       <function name="GetRenderbufferParameterivOES" template="GetRenderbufferParameter" gltype="GLint"/>
+       <function name="IsRenderbufferOES" template="IsRenderbuffer"/>
+       <function name="IsFramebufferOES" template="IsFramebuffer"/>
+
+       <!-- OES_query_matrix -->
+       <!-- QueryMatrixx returns values in an unusual, decomposed, fixed-value
+            form; it has its own code for this -->
+       <function name="QueryMatrixxOES" external="true" template="QueryMatrix" gltype="GLfixed"/>
+
+       <!-- OES_draw_texture -->
+       <function name="DrawTexfOES" template="DrawTex" gltype="GLfloat" expand_vector="true"/>
+       <function name="DrawTexiOES" template="DrawTex" gltype="GLint" expand_vector="true"/>
+       <function name="DrawTexsOES" template="DrawTex" gltype="GLshort" expand_vector="true"/>
+       <function name="DrawTexxOES" template="DrawTex" gltype="GLfixed" expand_vector="true"/>
+       <function name="DrawTexfvOES" template="DrawTex" gltype="GLfloat"/>
+       <function name="DrawTexivOES" template="DrawTex" gltype="GLint"/>
+       <function name="DrawTexsvOES" template="DrawTex" gltype="GLshort"/>
+       <function name="DrawTexxvOES" template="DrawTex" gltype="GLfixed"/>
+
+        <!-- EXT_multi_draw_arrays -->
+        <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/>
+        <function name="MultiDrawElementsEXT" template="MultiDrawElements"/>
+
+        <!-- OES_EGL_image -->
+        <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/>
+        <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/>
+</api>
+
+<api name="GLES2.0">
+       <category name="GLES2.0"/>
+
+       <category name="OES_compressed_paletted_texture"/>
+       <category name="OES_depth24"/>
+       <category name="OES_depth32"/>
+       <category name="OES_fbo_render_mipmap"/>
+       <category name="OES_rgb8_rgba8"/>
+       <category name="OES_stencil1"/>
+       <category name="OES_stencil4"/>
+       <category name="OES_element_index_uint"/>
+       <category name="OES_mapbuffer"/>
+       <category name="OES_texture_3D"/>
+       <category name="OES_texture_npot"/>
+       <category name="EXT_texture_filter_anisotropic"/>
+       <category name="EXT_texture_type_2_10_10_10_REV"/>
+       <category name="OES_depth_texture"/>
+       <category name="OES_packed_depth_stencil"/>
+       <category name="OES_standard_derivatives"/>
+
+       <!-- disabled due to missing enums
+       <category name="EXT_texture_compression_dxt1"/>
+       <category name="EXT_blend_minmax"/>
+       -->
+       <category name="EXT_multi_draw_arrays"/>
+       <category name="OES_EGL_image"/>
+
+       <function name="CullFace" template="CullFace"/>
+
+       <function name="FrontFace" template="FrontFace"/>
+       <function name="Hint" template="Hint"/>
+
+       <function name="LineWidth" template="LineWidth" gltype="GLfloat"/>
+
+       <function name="Scissor" template="Scissor"/>
+
+       <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/>
+       <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/>
+       <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/>
+       <function name="TexParameteriv" template="TexParameter" gltype="GLint"/>
+
+       <function name="TexImage2D" template="TexImage2D"/>
+
+       <function name="Clear" template="Clear"/>
+       <function name="ClearColor" template="ClearColor" gltype="GLclampf"/>
+       <function name="ClearStencil" template="ClearStencil"/>
+       <function name="ClearDepthf" template="ClearDepth" gltype="GLclampf"/>
+
+       <function name="StencilMask" template="StencilMask"/>
+       <function name="StencilMaskSeparate" template="StencilMaskSeparate"/>
+       <function name="ColorMask" template="ColorMask"/>
+       <function name="DepthMask" template="DepthMask"/>
+       <function name="Disable" template="Disable"/>
+       <function name="Enable" template="Enable"/>
+       <function name="Finish" template="Finish"/>
+       <function name="Flush" template="Flush"/>
+
+       <function name="BlendFunc" template="BlendFunc"/>
+
+       <function name="StencilFunc" template="StencilFunc"/>
+       <function name="StencilFuncSeparate" template="StencilFuncSeparate"/>
+       <function name="StencilOp" template="StencilOp"/>
+       <function name="StencilOpSeparate" template="StencilOpSeparate"/>
+
+       <function name="DepthFunc" template="DepthFunc"/>
+
+       <function name="PixelStorei" template="PixelStore" gltype="GLint"/>
+       <function name="ReadPixels" template="ReadPixels"/>
+
+       <function name="GetBooleanv" template="GetState" gltype="GLboolean"/>
+       <function name="GetError" template="GetError"/>
+       <function name="GetFloatv" template="GetState" gltype="GLfloat"/>
+       <function name="GetIntegerv" template="GetState" gltype="GLint"/>
+
+       <function name="GetString" template="GetString"/>
+
+       <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/>
+       <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/>
+
+       <function name="IsEnabled" template="IsEnabled"/>
+
+       <function name="DepthRangef" template="DepthRange" gltype="GLclampf"/>
+
+       <function name="Viewport" template="Viewport"/>
+
+       <function name="DrawArrays" template="DrawArrays"/>
+       <function name="DrawElements" template="DrawElements"/>
+
+       <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/>
+       <function name="CopyTexImage2D" template="CopyTexImage2D"/>
+       <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/>
+       <function name="TexSubImage2D" template="TexSubImage2D"/>
+
+       <function name="BindTexture" template="BindTexture"/>
+       <function name="DeleteTextures" template="DeleteTextures"/>
+       <function name="GenTextures" template="GenTextures"/>
+       <function name="IsTexture" template="IsTexture"/>
+
+       <function name="BlendColor" template="BlendColor" gltype="GLclampf"/>
+       <function name="BlendEquation" template="BlendEquation"/>
+       <function name="BlendEquationSeparate" template="BlendEquationSeparate"/>
+
+       <function name="TexImage3DOES" template="TexImage3D"/>
+       <function name="TexSubImage3DOES" template="TexSubImage3D"/>
+       <function name="CopyTexSubImage3DOES" template="CopyTexSubImage3D"/>
+
+       <function name="CompressedTexImage3DOES" template="CompressedTexImage3D"/>
+       <function name="CompressedTexSubImage3DOES" template="CompressedTexSubImage3D"/>
+
+       <function name="ActiveTexture" template="ActiveTexture"/>
+
+       <function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/>
+
+       <function name="CompressedTexImage2D" external="true" template="CompressedTexImage2D"/>
+       <function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/>
+
+       <function name="BlendFuncSeparate" template="BlendFuncSeparate"/>
+
+       <function name="VertexAttrib1f" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/>
+       <function name="VertexAttrib2f" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/>
+       <function name="VertexAttrib3f" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/>
+       <function name="VertexAttrib4f" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="VertexAttrib1fv" template="VertexAttrib" gltype="GLfloat" vector_size="1"/>
+       <function name="VertexAttrib2fv" template="VertexAttrib" gltype="GLfloat" vector_size="2"/>
+       <function name="VertexAttrib3fv" template="VertexAttrib" gltype="GLfloat" vector_size="3"/>
+       <function name="VertexAttrib4fv" template="VertexAttrib" gltype="GLfloat" vector_size="4"/>
+
+       <function name="VertexAttribPointer" template="VertexAttribPointer"/>
+
+       <function name="EnableVertexAttribArray" template="EnableVertexAttribArray"/>
+       <function name="DisableVertexAttribArray" template="DisableVertexAttribArray"/>
+
+       <function name="IsProgram" template="IsProgram"/>
+       <function name="GetProgramiv" template="GetProgram" gltype="GLint"/>
+
+       <function name="GetVertexAttribfv" template="GetVertexAttrib" gltype="GLfloat"/>
+       <function name="GetVertexAttribiv" template="GetVertexAttrib" gltype="GLint"/>
+       <function name="GetVertexAttribPointerv" template="GetVertexAttribPointer"/>
+
+       <function name="GetBufferPointervOES" template="GetBufferPointer"/>
+       <function name="MapBufferOES" template="MapBuffer"/>
+       <function name="UnmapBufferOES" template="UnmapBuffer"/>
+       <function name="BindBuffer" template="BindBuffer"/>
+       <function name="BufferData" template="BufferData"/>
+       <function name="BufferSubData" template="BufferSubData"/>
+       <function name="DeleteBuffers" template="DeleteBuffers"/>
+       <function name="GenBuffers" template="GenBuffers"/>
+       <function name="GetBufferParameteriv" template="GetBufferParameter" gltype="GLint"/>
+       <function name="IsBuffer" template="IsBuffer"/>
+
+       <function name="CreateShader" template="CreateShader"/>
+       <function name="ShaderSource" template="ShaderSource"/>
+       <function name="CompileShader" template="CompileShader"/>
+       <function name="ReleaseShaderCompiler" template="ReleaseShaderCompiler"/>
+       <function name="DeleteShader" template="DeleteShader"/>
+       <function name="ShaderBinary" template="ShaderBinary"/>
+       <function name="CreateProgram" template="CreateProgram"/>
+       <function name="AttachShader" template="AttachShader"/>
+       <function name="DetachShader" template="DetachShader"/>
+       <function name="LinkProgram" template="LinkProgram"/>
+       <function name="UseProgram" template="UseProgram"/>
+       <function name="DeleteProgram" template="DeleteProgram"/>
+
+       <function name="GetActiveAttrib" template="GetActiveAttrib"/>
+       <function name="GetAttribLocation" template="GetAttribLocation"/>
+       <function name="BindAttribLocation" template="BindAttribLocation"/>
+       <function name="GetUniformLocation" template="GetUniformLocation"/>
+       <function name="GetActiveUniform" template="GetActiveUniform"/>
+
+       <function name="Uniform1f" template="Uniform" gltype="GLfloat" vector_size="1" expand_vector="true"/>
+       <function name="Uniform2f" template="Uniform" gltype="GLfloat" vector_size="2" expand_vector="true"/>
+       <function name="Uniform3f" template="Uniform" gltype="GLfloat" vector_size="3" expand_vector="true"/>
+       <function name="Uniform4f" template="Uniform" gltype="GLfloat" vector_size="4" expand_vector="true"/>
+       <function name="Uniform1i" template="Uniform" gltype="GLint" vector_size="1" expand_vector="true"/>
+       <function name="Uniform2i" template="Uniform" gltype="GLint" vector_size="2" expand_vector="true"/>
+       <function name="Uniform3i" template="Uniform" gltype="GLint" vector_size="3" expand_vector="true"/>
+       <function name="Uniform4i" template="Uniform" gltype="GLint" vector_size="4" expand_vector="true"/>
+
+       <function name="Uniform1fv" template="Uniform" gltype="GLfloat" vector_size="1"/>
+       <function name="Uniform2fv" template="Uniform" gltype="GLfloat" vector_size="2"/>
+       <function name="Uniform3fv" template="Uniform" gltype="GLfloat" vector_size="3"/>
+       <function name="Uniform4fv" template="Uniform" gltype="GLfloat" vector_size="4"/>
+       <function name="Uniform1iv" template="Uniform" gltype="GLint" vector_size="1"/>
+       <function name="Uniform2iv" template="Uniform" gltype="GLint" vector_size="2"/>
+       <function name="Uniform3iv" template="Uniform" gltype="GLint" vector_size="3"/>
+       <function name="Uniform4iv" template="Uniform" gltype="GLint" vector_size="4"/>
+
+       <function name="UniformMatrix2fv" template="UniformMatrix" gltype="GLfloat" vector_size="2"/>
+       <function name="UniformMatrix3fv" template="UniformMatrix" gltype="GLfloat" vector_size="3"/>
+       <function name="UniformMatrix4fv" template="UniformMatrix" gltype="GLfloat" vector_size="4"/>
+
+       <function name="ValidateProgram" template="ValidateProgram"/>
+
+       <function name="GenerateMipmap" template="GenerateMipmap"/>
+       <function name="BindFramebuffer" template="BindFramebuffer"/>
+       <function name="DeleteFramebuffers" template="DeleteFramebuffers"/>
+       <function name="GenFramebuffers" template="GenFramebuffers"/>
+       <function name="BindRenderbuffer" template="BindRenderbuffer"/>
+       <function name="DeleteRenderbuffers" template="DeleteRenderbuffers"/>
+       <function name="GenRenderbuffers" template="GenRenderbuffers"/>
+       <function name="RenderbufferStorage" external="true" template="RenderbufferStorage"/>
+       <function name="FramebufferRenderbuffer" template="FramebufferRenderbuffer"/>
+       <function name="FramebufferTexture2D" template="FramebufferTexture2D"/>
+       <function name="FramebufferTexture3DOES" template="FramebufferTexture3D"/>
+       <function name="CheckFramebufferStatus" template="CheckFramebufferStatus"/>
+       <function name="GetFramebufferAttachmentParameteriv" template="GetFramebufferAttachmentParameter" gltype="GLint"/>
+       <function name="GetRenderbufferParameteriv" template="GetRenderbufferParameter" gltype="GLint"/>
+       <function name="IsRenderbuffer" template="IsRenderbuffer"/>
+       <function name="IsFramebuffer" template="IsFramebuffer"/>
+
+       <function name="IsShader" template="IsShader"/>
+       <function name="GetShaderiv" template="GetShader" gltype="GLint"/>
+       <function name="GetAttachedShaders" template="GetAttachedShaders"/>
+       <function name="GetShaderInfoLog" template="GetShaderInfoLog"/>
+       <function name="GetProgramInfoLog" template="GetProgramInfoLog"/>
+       <function name="GetShaderSource" template="GetShaderSource"/>
+       <function name="GetShaderPrecisionFormat" template="GetShaderPrecisionFormat"/>
+       <function name="GetUniformfv" template="GetUniform" gltype="GLfloat"/>
+       <function name="GetUniformiv" template="GetUniform" gltype="GLint"/>
+
+        <!-- EXT_multi_draw_arrays -->
+        <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/>
+        <function name="MultiDrawElementsEXT" template="MultiDrawElements"/>
+
+        <!-- OES_EGL_image -->
+        <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/>
+        <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/>
+</api>
+
+</apispec>
diff --git a/src/mesa/main/APIspecutil.py b/src/mesa/main/APIspecutil.py
new file mode 100644 (file)
index 0000000..27a8fe8
--- /dev/null
@@ -0,0 +1,265 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
+#
+# 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.
+"""
+Minimal apiutil.py interface for use by es_generator.py.
+"""
+
+import sys
+import libxml2
+
+import APIspec
+
+__spec = {}
+__functions = {}
+__aliases = {}
+
+def _ParseXML(filename, apiname):
+    conversions = {
+        # from           to
+        'GLfloat':  [ 'GLdouble' ],
+        'GLclampf': [ 'GLclampd' ],
+        'GLubyte':  [ 'GLfloat', 'GLdouble' ],
+        'GLint':    [ 'GLfloat', 'GLdouble' ],
+        'GLfixed':  [ 'GLfloat', 'GLdouble' ],
+        'GLclampx': [ 'GLclampf', 'GLclampd' ],
+    }
+
+    doc = libxml2.readFile(filename, None,
+            libxml2.XML_PARSE_DTDLOAD +
+            libxml2.XML_PARSE_DTDVALID +
+            libxml2.XML_PARSE_NOBLANKS)
+    spec = APIspec.Spec(doc)
+    impl = spec.get_impl()
+    api = spec.get_api(apiname)
+    doc.freeDoc()
+
+    __spec["impl"] = impl
+    __spec["api"] = api
+
+    for func in api.functions:
+        alias, need_conv = impl.match(func, conversions)
+        if not alias:
+            # external functions are manually dispatched
+            if not func.is_external:
+                print >>sys.stderr, "Error: unable to dispatch %s" % func.name
+            alias = func
+            need_conv = False
+
+        __functions[func.name] = func
+        __aliases[func.name] = (alias, need_conv)
+
+
+def AllSpecials(notused=None):
+    """Return a list of all external functions in the API."""
+    api = __spec["api"]
+
+    specials = []
+    for func in api.functions:
+        if func.is_external:
+            specials.append(func.name)
+
+    return specials
+
+
+def GetAllFunctions(filename, api):
+    """Return sorted list of all functions in the API."""
+    if not __spec:
+        _ParseXML(filename, api)
+
+    api = __spec["api"]
+    names = []
+    for func in api.functions:
+        names.append(func.name)
+    names.sort()
+    return names
+
+
+def ReturnType(funcname):
+    """Return the C return type of named function."""
+    func = __functions[funcname]
+    return func.return_type
+
+
+def Properties(funcname):
+    """Return list of properties of the named GL function."""
+    func = __functions[funcname]
+    return [func.direction]
+
+
+def _ValidValues(func, param):
+    """Return the valid values of a parameter."""
+    valid_values = []
+    switch = func.checker.switches.get(param.name, [])
+    for desc in switch:
+        # no dependent vector
+        if not desc.checker.switches:
+            for val in desc.values:
+                valid_values.append((val, None, None, [], desc.error, None))
+            continue
+
+        items = desc.checker.switches.items()
+        if len(items) > 1:
+            print >>sys.stderr, "%s: more than one parameter depend on %s" % \
+                    (func.name, desc.name)
+        dep_name, dep_switch = items[0]
+
+        for dep_desc in dep_switch:
+            if dep_desc.index >= 0 and dep_desc.index != 0:
+                print >>sys.stderr, "%s: not first element of a vector" % func.name
+            if dep_desc.checker.switches:
+                print >>sys.stderr, "%s: deep nested dependence" % func.name
+
+            convert = None if dep_desc.convert else "noconvert"
+            for val in desc.values:
+                valid_values.append((val, dep_desc.size_str, dep_desc.name,
+                                     dep_desc.values, dep_desc.error, convert))
+    return valid_values
+
+
+def _Conversion(func, src_param):
+    """Return the destination type of the conversion, or None."""
+    alias, need_conv = __aliases[func.name]
+    if need_conv:
+        dst_param = alias.get_param(src_param.name)
+        if src_param.type == dst_param.type:
+            need_conv = False
+    if not need_conv:
+        return (None, "none")
+
+    converts = { True: 0, False: 0 }
+
+    # In Fogx, for example,  pname may be GL_FOG_DENSITY/GL_FOG_START/GL_FOG_END
+    # or GL_FOG_MODE.  In the former three cases, param is not checked and the
+    # default is to convert.
+    if not func.checker.always_check(src_param.name):
+        converts[True] += 1
+
+    for desc in func.checker.flatten(src_param.name):
+        converts[desc.convert] += 1
+        if converts[True] and converts[False]:
+            break
+
+    # it should be "never", "sometimes", and "always"...
+    if converts[False]:
+        if converts[True]:
+            conversion = "some"
+        else:
+            conversion = "none"
+    else:
+        conversion = "all"
+
+    return (dst_param.base_type(), conversion)
+
+
+def _MaxVecSize(func, param):
+    """Return the largest possible size of a vector."""
+    if not param.is_vector:
+        return 0
+    if param.size:
+        return param.size
+
+    # need to look at all descriptions
+    size = 0
+    for desc in func.checker.flatten(param.name):
+        if desc.size_str and desc.size_str.isdigit():
+            s = int(desc.size_str)
+            if s > size:
+                size = s
+    if not size:
+        need_conv = __aliases[func.name][1]
+        if need_conv:
+            print >>sys.stderr, \
+                    "Error: unable to dicide the max size of %s in %s" % \
+                    (param.name, func.name)
+    return size
+
+
+def _ParameterTuple(func, param):
+    """Return a parameter tuple.
+
+    [0] -- parameter name
+    [1] -- parameter type
+    [2] -- max vector size or 0
+    [3] -- dest type the parameter converts to, or None
+    [4] -- valid values
+    [5] -- how often does the conversion happen
+
+    """
+    vec_size = _MaxVecSize(func, param)
+    dst_type, conversion = _Conversion(func, param)
+    valid_values = _ValidValues(func, param)
+
+    return (param.name, param.type, vec_size, dst_type, valid_values, conversion)
+
+
+def Parameters(funcname):
+    """Return list of tuples of function parameters."""
+    func = __functions[funcname]
+    params = []
+    for param in func.params:
+        params.append(_ParameterTuple(func, param))
+
+    return params
+
+
+def FindParamIndex(params, paramname):
+    """Find the index of a named parameter."""
+    for i in xrange(len(params)):
+        if params[i][0] == paramname:
+            return i
+    return None
+
+
+def MakeDeclarationString(params):
+    """Return a C-style parameter declaration string."""
+    string = []
+    for p in params:
+        sep = "" if p[1].endswith("*") else " "
+        string.append("%s%s%s" % (p[1], sep, p[0]))
+    if not string:
+        return "void"
+    return ", ".join(string)
+
+
+def AliasPrefix(funcname):
+    """Return the prefix of the function the named function is an alias of."""
+    alias = __aliases[funcname][0]
+    return alias.prefix
+
+
+def Alias(funcname):
+    """Return the name of the function the named function is an alias of."""
+    alias, need_conv = __aliases[funcname]
+    return alias.name if not need_conv else None
+
+
+def ConversionFunction(funcname):
+    """Return the name of the function the named function converts to."""
+    alias, need_conv = __aliases[funcname]
+    return alias.name if need_conv else None
+
+
+def Categories(funcname):
+    """Return all the categories of the named GL function."""
+    api = __spec["api"]
+    return [api.name]
index dd8d500865b94531861cad6949239ec5631cbd47..29c953f31bec0d981dcc326d4e2e032ef2cdc6cc 100644 (file)
@@ -35,5 +35,11 @@ _mesa_alloc_dispatch_table(int size);
 extern struct _glapi_table *
 _mesa_create_exec_table(void);
 
+extern struct _glapi_table *
+_mesa_create_exec_table_es1(void);
+
+extern struct _glapi_table *
+_mesa_create_exec_table_es2(void);
+
 
 #endif
index 8d71cefdcf39f477c42facac571da7dfb29d7c68..0963e75f35ebcc4172d1a9aecb04ac2984ffacdb 100644 (file)
@@ -394,7 +394,25 @@ one_time_init( GLcontext *ctx )
 
       _mesa_get_cpu_features();
 
-      _mesa_init_remap_table();
+      switch (ctx->API) {
+#if FEATURE_GL
+      case API_OPENGL:
+        _mesa_init_remap_table();
+        break;
+#endif
+#if FEATURE_ES1
+      case API_OPENGLES:
+        _mesa_init_remap_table_es1();
+        break;
+#endif
+#if FEATURE_ES2
+      case API_OPENGLES2:
+        _mesa_init_remap_table_es2();
+        break;
+#endif
+      default:
+        break;
+      }
 
       _mesa_init_sqrt_table();
 
@@ -812,9 +830,6 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
    assert(driverFunctions->NewTextureObject);
    assert(driverFunctions->FreeTexImageData);
 
-   /* misc one-time initializations */
-   one_time_init(ctx);
-
    ctx->API = api;
    ctx->Visual = *visual;
    ctx->DrawBuffer = NULL;
@@ -822,6 +837,9 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
    ctx->WinSysDrawBuffer = NULL;
    ctx->WinSysReadBuffer = NULL;
 
+   /* misc one-time initializations */
+   one_time_init(ctx);
+
    /* Plug in driver functions and context pointer here.
     * This is important because when we call alloc_shared_state() below
     * we'll call ctx->Driver.NewTextureObject() to create the default
@@ -853,7 +871,27 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
 
 #if FEATURE_dispatch
    /* setup the API dispatch tables */
-   ctx->Exec = _mesa_create_exec_table();
+   switch (ctx->API) {
+#if FEATURE_GL
+   case API_OPENGL:
+      ctx->Exec = _mesa_create_exec_table();
+      break;
+#endif
+#if FEATURE_ES1
+   case API_OPENGLES:
+      ctx->Exec = _mesa_create_exec_table_es1();
+      break;
+#endif
+#if FEATURE_ES2
+   case API_OPENGLES2:
+      ctx->Exec = _mesa_create_exec_table_es2();
+      break;
+#endif
+   default:
+      _mesa_problem(ctx, "unknown or unsupported API");
+      break;
+   }
+
    if (!ctx->Exec) {
       _mesa_release_shared_state(ctx, ctx->Shared);
       return GL_FALSE;
diff --git a/src/mesa/main/es_generator.py b/src/mesa/main/es_generator.py
new file mode 100644 (file)
index 0000000..1282a1c
--- /dev/null
@@ -0,0 +1,726 @@
+#*************************************************************************
+# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+# 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
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# 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 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 NONINFRINGEMENT.  IN NO EVENT SHALL
+# TUNGSTEN GRAPHICS 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.
+#*************************************************************************
+
+
+import sys, os
+import APIspecutil as apiutil
+
+# These dictionary entries are used for automatic conversion.
+# The string will be used as a format string with the conversion
+# variable.
+Converters = {
+    'GLfloat': {
+        'GLdouble': "(GLdouble) (%s)",
+        'GLfixed' : "(GLint) (%s * 65536)",
+    },
+    'GLfixed': {
+        'GLfloat': "(GLfloat) (%s / 65536.0f)",
+        'GLdouble': "(GLdouble) (%s / 65536.0)",
+    },
+    'GLdouble': {
+        'GLfloat': "(GLfloat) (%s)",
+        'GLfixed': "(GLfixed) (%s * 65536)",
+    },
+    'GLclampf': {
+        'GLclampd': "(GLclampd) (%s)",
+        'GLclampx': "(GLclampx) (%s * 65536)",
+    },
+    'GLclampx': {
+        'GLclampf': "(GLclampf) (%s / 65536.0f)",
+        'GLclampd': "(GLclampd) (%s / 65536.0)",
+    },
+    'GLubyte': {
+        'GLfloat': "(GLfloat) (%s / 255.0f)",
+    },
+}
+
+def GetBaseType(type):
+    typeTokens = type.split(' ')
+    baseType = None
+    typeModifiers = []
+    for t in typeTokens:
+        if t in ['const', '*']:
+            typeModifiers.append(t)
+        else:
+            baseType = t
+    return (baseType, typeModifiers)
+
+def ConvertValue(value, fromType, toType):
+    """Returns a string that represents the given parameter string, 
+    type-converted if necessary."""
+
+    if not Converters.has_key(fromType):
+        print >> sys.stderr, "No base converter for type '%s' found.  Ignoring." % fromType
+        return value
+
+    if not Converters[fromType].has_key(toType):
+        print >> sys.stderr, "No converter found for type '%s' to type '%s'.  Ignoring." % (fromType, toType)
+        return value
+
+    # This part is simple.  Return the proper conversion.
+    conversionString = Converters[fromType][toType]
+    return conversionString % value
+
+FormatStrings = {
+    'GLenum' : '0x%x',
+    'GLfloat' : '%f',
+    'GLint' : '%d',
+    'GLbitfield' : '0x%x',
+}
+def GetFormatString(type):
+    if FormatStrings.has_key(type):
+        return FormatStrings[type]
+    else:
+        return None
+
+
+######################################################################
+# Version-specific values to be used in the main script
+# header: which header file to include
+# api: what text specifies an API-level function
+VersionSpecificValues = {
+    'GLES1.1' : {
+        'description' : 'GLES1.1 functions',
+        'header' : 'GLES/gl.h',
+        'extheader' : 'GLES/glext.h',
+        'shortname' : 'es1'
+    },
+    'GLES2.0': {
+        'description' : 'GLES2.0 functions',
+        'header' : 'GLES2/gl2.h',
+        'extheader' : 'GLES2/gl2ext.h',
+        'shortname' : 'es2'
+    }
+}
+
+
+######################################################################
+# Main code for the script begins here.
+
+# Get the name of the program (without the directory part) for use in
+# error messages.
+program = os.path.basename(sys.argv[0])
+
+# Set default values
+verbose = 0
+functionList = "APIspec.xml"
+version = "GLES1.1"
+
+# Allow for command-line switches
+import getopt, time
+options = "hvV:S:"
+try:
+    optlist, args = getopt.getopt(sys.argv[1:], options)
+except getopt.GetoptError, message:
+    sys.stderr.write("%s: %s.  Use -h for help.\n" % (program, message))
+    sys.exit(1)
+
+for option, optarg in optlist:
+    if option == "-h":
+        sys.stderr.write("Usage: %s [-%s]\n" % (program, options))
+        sys.stderr.write("Parse an API specification file and generate wrapper functions for a given GLES version\n")
+        sys.stderr.write("-h gives help\n")
+        sys.stderr.write("-v is verbose\n")
+        sys.stderr.write("-V specifies GLES version to generate [%s]:\n" % version)
+        for key in VersionSpecificValues.keys():
+            sys.stderr.write("    %s - %s\n" % (key, VersionSpecificValues[key]['description']))
+        sys.stderr.write("-S specifies API specification file to use [%s]\n" % functionList)
+        sys.exit(1)
+    elif option == "-v":
+        verbose += 1
+    elif option == "-V":
+        version = optarg
+    elif option == "-S":
+        functionList = optarg
+
+# Beyond switches, we support no further command-line arguments
+if len(args) >  0:
+    sys.stderr.write("%s: only switch arguments are supported - use -h for help\n" % program)
+    sys.exit(1)
+
+# If we don't have a valid version, abort.
+if not VersionSpecificValues.has_key(version):
+    sys.stderr.write("%s: version '%s' is not valid - use -h for help\n" % (program, version))
+    sys.exit(1)
+
+# Grab the version-specific items we need to use
+versionHeader = VersionSpecificValues[version]['header']
+versionExtHeader = VersionSpecificValues[version]['extheader']
+shortname = VersionSpecificValues[version]['shortname']
+
+# If we get to here, we're good to go.  The "version" parameter
+# directs GetDispatchedFunctions to only allow functions from
+# that "category" (version in our parlance).  This allows 
+# functions with different declarations in different categories
+# to exist (glTexImage2D, for example, is different between
+# GLES1 and GLES2).
+keys = apiutil.GetAllFunctions(functionList, version)
+
+allSpecials = apiutil.AllSpecials()
+
+print """/* DO NOT EDIT *************************************************
+ * THIS FILE AUTOMATICALLY GENERATED BY THE %s SCRIPT
+ * API specification file:   %s
+ * GLES version:             %s
+ * date:                     %s
+ */
+""" % (program, functionList, version, time.strftime("%Y-%m-%d %H:%M:%S"))
+
+# The headers we choose are version-specific.
+print """
+#include "%s"
+#include "%s"
+""" % (versionHeader, versionExtHeader)
+
+# Everyone needs these types.
+print """
+/* These types are needed for the Mesa veneer, but are not defined in
+ * the standard GLES headers.
+ */
+typedef double GLdouble;
+typedef double GLclampd;
+
+/* This type is normally in glext.h, but needed here */
+typedef char GLchar;
+
+/* Mesa error handling requires these */
+extern void *_mesa_get_current_context(void);
+extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
+
+#include "main/compiler.h"
+#include "main/api_exec.h"
+#include "main/remap.h"
+
+#ifdef IN_DRI_DRIVER
+#define _GLAPI_USE_REMAP_TABLE
+#endif
+
+#include "es/glapi/glapi-%s/glapi/glapitable.h"
+#include "es/glapi/glapi-%s/glapi/glapioffsets.h"
+#include "es/glapi/glapi-%s/glapi/glapidispatch.h"
+
+#if FEATURE_remap_table
+
+#define need_MESA_remap_table
+
+#include "es/glapi/glapi-%s/main/remap_helper.h"
+
+void
+_mesa_init_remap_table_%s(void)
+{
+   _mesa_do_init_remap_table(_mesa_function_pool,
+                             driDispatchRemapTable_size,
+                             MESA_remap_table_functions);
+}
+
+void
+_mesa_map_static_functions_%s(void)
+{
+}
+
+#endif
+
+typedef void (*_glapi_proc)(void); /* generic function pointer */
+""" % (shortname, shortname, shortname, shortname, shortname, shortname);
+
+# Finally we get to the all-important functions
+print """/*************************************************************
+ * Generated functions begin here
+ */
+"""
+for funcName in keys:
+    if verbose > 0: sys.stderr.write("%s: processing function %s\n" % (program, funcName))
+
+    # start figuring out what this function will look like.
+    returnType = apiutil.ReturnType(funcName)
+    props = apiutil.Properties(funcName)
+    params = apiutil.Parameters(funcName)
+    declarationString = apiutil.MakeDeclarationString(params)
+
+    # In case of error, a function may have to return.  Make
+    # sure we have valid return values in this case.
+    if returnType == "void":
+        errorReturn = "return"
+    elif returnType == "GLboolean":
+        errorReturn = "return GL_FALSE"
+    else:
+        errorReturn = "return (%s) 0" % returnType
+
+    # These are the output of this large calculation block.
+    # passthroughDeclarationString: a typed set of parameters that
+    # will be used to create the "extern" reference for the
+    # underlying Mesa or support function.  Note that as generated
+    # these have an extra ", " at the beginning, which will be
+    # removed before use.
+    # 
+    # passthroughDeclarationString: an untyped list of parameters
+    # that will be used to call the underlying Mesa or support
+    # function (including references to converted parameters).
+    # This will also be generated with an extra ", " at the
+    # beginning, which will be removed before use.
+    #
+    # variables: C code to create any local variables determined to
+    # be necessary.
+    # conversionCodeOutgoing: C code to convert application parameters
+    # to a necessary type before calling the underlying support code.
+    # May be empty if no conversion is required.  
+    # conversionCodeIncoming: C code to do the converse: convert 
+    # values returned by underlying Mesa code to the types needed
+    # by the application.
+    # Note that *either* the conversionCodeIncoming will be used (for
+    # generated query functions), *or* the conversionCodeOutgoing will
+    # be used (for generated non-query functions), never both.
+    passthroughFuncName = ""
+    passthroughDeclarationString = ""
+    passthroughCallString = ""
+    variables = []
+    conversionCodeOutgoing = []
+    conversionCodeIncoming = []
+    switchCode = []
+
+    # Calculate the name of the underlying support function to call.
+    # By default, the passthrough function is named _mesa_<funcName>.
+    # We're allowed to override the prefix and/or the function name
+    # for each function record, though.  The "ConversionFunction"
+    # utility is poorly named, BTW...
+    if funcName in allSpecials:
+        # perform checks and pass through
+        funcPrefix = "_check_"
+        aliasprefix = "_es_"
+    else:
+        funcPrefix = "_es_"
+        aliasprefix = apiutil.AliasPrefix(funcName)
+    alias = apiutil.ConversionFunction(funcName)
+    if not alias:
+        # There may still be a Mesa alias for the function
+        if apiutil.Alias(funcName):
+            passthroughFuncName = "%s%s" % (aliasprefix, apiutil.Alias(funcName))
+        else:
+            passthroughFuncName = "%s%s" % (aliasprefix, funcName)
+    else: # a specific alias is provided
+        passthroughFuncName = "%s%s" % (aliasprefix, alias)
+
+    # Look at every parameter: each one may have only specific
+    # allowed values, or dependent parameters to check, or 
+    # variant-sized vector arrays to calculate
+    for (paramName, paramType, paramMaxVecSize, paramConvertToType, paramValidValues, paramValueConversion) in params:
+        # We'll need this below if we're doing conversions
+        (paramBaseType, paramTypeModifiers) = GetBaseType(paramType)
+
+        # Conversion management.
+        # We'll handle three cases, easiest to hardest: a parameter
+        # that doesn't require conversion, a scalar parameter that
+        # requires conversion, and a vector parameter that requires
+        # conversion.
+        if paramConvertToType == None:
+            # Unconverted parameters are easy, whether they're vector
+            # or scalar - just add them to the call list.  No conversions
+            # or anything to worry about.
+            passthroughDeclarationString += ", %s %s" % (paramType, paramName)
+            passthroughCallString += ", %s" % paramName
+
+        elif paramMaxVecSize == 0: # a scalar parameter that needs conversion
+            # A scalar to hold a converted parameter
+            variables.append("    %s converted_%s;" % (paramConvertToType, paramName))
+
+            # Outgoing conversion depends on whether we have to conditionally
+            # perform value conversion.
+            if paramValueConversion == "none":
+                conversionCodeOutgoing.append("    converted_%s = (%s) %s;" % (paramName, paramConvertToType, paramName))
+            elif paramValueConversion == "some":
+                # We'll need a conditional variable to keep track of
+                # whether we're converting values or not.
+                if ("    int convert_%s_value = 1;" % paramName) not in variables:
+                    variables.append("    int convert_%s_value = 1;" % paramName)
+
+                # Write code based on that conditional.
+                conversionCodeOutgoing.append("    if (convert_%s_value) {" % paramName)
+                conversionCodeOutgoing.append("        converted_%s = %s;" % (paramName, ConvertValue(paramName, paramBaseType, paramConvertToType))) 
+                conversionCodeOutgoing.append("    } else {")
+                conversionCodeOutgoing.append("        converted_%s = (%s) %s;" % (paramName, paramConvertToType, paramName))
+                conversionCodeOutgoing.append("    }")
+            else: # paramValueConversion == "all"
+                conversionCodeOutgoing.append("    converted_%s = %s;" % (paramName, ConvertValue(paramName, paramBaseType, paramConvertToType)))
+
+            # Note that there can be no incoming conversion for a
+            # scalar parameter; changing the scalar will only change
+            # the local value, and won't ultimately change anything
+            # that passes back to the application.
+
+            # Call strings.  The unusual " ".join() call will join the
+            # array of parameter modifiers with spaces as separators.
+            passthroughDeclarationString += ", %s %s %s" % (paramConvertToType, " ".join(paramTypeModifiers), paramName)
+            passthroughCallString += ", converted_%s" % paramName
+
+        else: # a vector parameter that needs conversion
+            # We'll need an index variable for conversions
+            if "    register unsigned int i;" not in variables:
+                variables.append("    register unsigned int i;")
+
+            # This variable will hold the (possibly variant) size of
+            # this array needing conversion.  By default, we'll set
+            # it to the maximal size (which is correct for functions
+            # with a constant-sized vector parameter); for true
+            # variant arrays, we'll modify it with other code.
+            variables.append("    unsigned int n_%s = %d;" % (paramName, paramMaxVecSize))
+
+            # This array will hold the actual converted values.
+            variables.append("    %s converted_%s[%d];" % (paramConvertToType, paramName, paramMaxVecSize))
+
+            # Again, we choose the conversion code based on whether we
+            # have to always convert values, never convert values, or 
+            # conditionally convert values.
+            if paramValueConversion == "none":
+                conversionCodeOutgoing.append("    for (i = 0; i < n_%s; i++) {" % paramName)
+                conversionCodeOutgoing.append("        converted_%s[i] = (%s) %s[i];" % (paramName, paramConvertToType, paramName))
+                conversionCodeOutgoing.append("    }")
+            elif paramValueConversion == "some":
+                # We'll need a conditional variable to keep track of
+                # whether we're converting values or not.
+                if ("    int convert_%s_value = 1;" % paramName) not in variables:
+                    variables.append("    int convert_%s_value = 1;" % paramName)
+                # Write code based on that conditional.
+                conversionCodeOutgoing.append("    if (convert_%s_value) {" % paramName)
+                conversionCodeOutgoing.append("        for (i = 0; i < n_%s; i++) {" % paramName)
+                conversionCodeOutgoing.append("            converted_%s[i] = %s;" % (paramName, ConvertValue("%s[i]" % paramName, paramBaseType, paramConvertToType))) 
+                conversionCodeOutgoing.append("        }")
+                conversionCodeOutgoing.append("    } else {")
+                conversionCodeOutgoing.append("        for (i = 0; i < n_%s; i++) {" % paramName)
+                conversionCodeOutgoing.append("            converted_%s[i] = (%s) %s[i];" % (paramName, paramConvertToType, paramName))
+                conversionCodeOutgoing.append("        }")
+                conversionCodeOutgoing.append("    }")
+            else: # paramValueConversion == "all"
+                conversionCodeOutgoing.append("    for (i = 0; i < n_%s; i++) {" % paramName)
+                conversionCodeOutgoing.append("        converted_%s[i] = %s;" % (paramName, ConvertValue("%s[i]" % paramName, paramBaseType, paramConvertToType)))
+
+                conversionCodeOutgoing.append("    }")
+
+            # If instead we need an incoming conversion (i.e. results
+            # from Mesa have to be converted before handing back
+            # to the application), this is it.  Fortunately, we don't
+            # have to worry about conditional value conversion - the
+            # functions that do (e.g. glGetFixedv()) are handled
+            # specially, outside this code generation.
+            #
+            # Whether we use incoming conversion or outgoing conversion
+            # is determined later - we only ever use one or the other.
+
+            if paramValueConversion == "none":
+                conversionCodeIncoming.append("    for (i = 0; i < n_%s; i++) {" % paramName)
+                conversionCodeIncoming.append("        %s[i] = (%s) converted_%s[i];" % (paramName, paramConvertToType, paramName))
+                conversionCodeIncoming.append("    }")
+            elif paramValueConversion == "some":
+                # We'll need a conditional variable to keep track of
+                # whether we're converting values or not.
+                if ("    int convert_%s_value = 1;" % paramName) not in variables:
+                    variables.append("    int convert_%s_value = 1;" % paramName)
+
+                # Write code based on that conditional.
+                conversionCodeIncoming.append("    if (convert_%s_value) {" % paramName)
+                conversionCodeIncoming.append("        for (i = 0; i < n_%s; i++) {" % paramName)
+                conversionCodeIncoming.append("            %s[i] = %s;" % (paramName, ConvertValue("converted_%s[i]" % paramName, paramConvertToType, paramBaseType))) 
+                conversionCodeIncoming.append("        }")
+                conversionCodeIncoming.append("    } else {")
+                conversionCodeIncoming.append("        for (i = 0; i < n_%s; i++) {" % paramName)
+                conversionCodeIncoming.append("            %s[i] = (%s) converted_%s[i];" % (paramName, paramBaseType, paramName))
+                conversionCodeIncoming.append("        }")
+                conversionCodeIncoming.append("    }")
+            else: # paramValueConversion == "all"
+                conversionCodeIncoming.append("    for (i = 0; i < n_%s; i++) {" % paramName)
+                conversionCodeIncoming.append("        %s[i] = %s;" % (paramName, ConvertValue("converted_%s[i]" % paramName, paramConvertToType, paramBaseType)))
+                conversionCodeIncoming.append("    }")
+
+            # Call strings.  The unusual " ".join() call will join the
+            # array of parameter modifiers with spaces as separators.
+            passthroughDeclarationString += ", %s %s %s" % (paramConvertToType, " ".join(paramTypeModifiers), paramName)
+            passthroughCallString += ", converted_%s" % paramName
+
+        # endif conversion management
+
+        # Parameter checking.  If the parameter has a specific list of
+        # valid values, we have to make sure that the passed-in values
+        # match these, or we make an error.
+        if len(paramValidValues) > 0:
+            # We're about to make a big switch statement with an
+            # error at the end.  By default, the error is GL_INVALID_ENUM,
+            # unless we find a "case" statement in the middle with a
+            # non-GLenum value.
+            errorDefaultCase = "GL_INVALID_ENUM"
+
+            # This parameter has specific valid values.  Make a big
+            # switch statement to handle it.  Note that the original
+            # parameters are always what is checked, not the
+            # converted parameters.
+            switchCode.append("    switch(%s) {" % paramName)
+
+            for valueIndex in range(len(paramValidValues)):
+                (paramValue, dependentVecSize, dependentParamName, dependentValidValues, errorCode, valueConvert) = paramValidValues[valueIndex]
+
+                # We're going to need information on the dependent param
+                # as well.
+                if dependentParamName:
+                    depParamIndex = apiutil.FindParamIndex(params, dependentParamName)
+                    if depParamIndex == None:
+                        sys.stderr.write("%s: can't find dependent param '%s' for function '%s'\n" % (program, dependentParamName, funcName))
+
+                    (depParamName, depParamType, depParamMaxVecSize, depParamConvertToType, depParamValidValues, depParamValueConversion) = params[depParamIndex]
+                else:
+                    (depParamName, depParamType, depParamMaxVecSize, depParamConvertToType, depParamValidValues, depParamValueConversion) = (None, None, None, None, [], None)
+
+                # This is a sneaky trick.  It's valid syntax for a parameter
+                # that is *not* going to be converted to be declared
+                # with a dependent vector size; but in this case, the
+                # dependent vector size is unused and unnecessary.
+                # So check for this and ignore the dependent vector size
+                # if the parameter is not going to be converted.
+                if depParamConvertToType:
+                    usedDependentVecSize = dependentVecSize
+                else:
+                    usedDependentVecSize = None
+
+                # We'll peek ahead at the next parameter, to see whether
+                # we can combine cases
+                if valueIndex + 1 < len(paramValidValues) :
+                    (nextParamValue, nextDependentVecSize, nextDependentParamName, nextDependentValidValues, nextErrorCode, nextValueConvert) = paramValidValues[valueIndex + 1]
+                    if depParamConvertToType:
+                        usedNextDependentVecSize = nextDependentVecSize
+                    else:
+                        usedNextDependentVecSize = None
+
+                # Create a case for this value.  As a mnemonic,
+                # if we have a dependent vector size that we're ignoring,
+                # add it as a comment.
+                if usedDependentVecSize == None and dependentVecSize != None:
+                    switchCode.append("        case %s: /* size %s */" % (paramValue, dependentVecSize))
+                else:
+                    switchCode.append("        case %s:" % paramValue)
+
+                # If this is not a GLenum case, then switch our error
+                # if no value is matched to be GL_INVALID_VALUE instead
+                # of GL_INVALID_ENUM.  (Yes, this does get confused
+                # if there are both values and GLenums in the same
+                # switch statement, which shouldn't happen.)
+                if paramValue[0:3] != "GL_":
+                    errorDefaultCase = "GL_INVALID_VALUE"
+
+                # If all the remaining parameters are identical to the
+                # next set, then we're done - we'll just create the
+                # official code on the next pass through, and the two
+                # cases will share the code.
+                if valueIndex + 1 < len(paramValidValues) and usedDependentVecSize == usedNextDependentVecSize and dependentParamName == nextDependentParamName and dependentValidValues == nextDependentValidValues and errorCode == nextErrorCode and valueConvert == nextValueConvert:
+                    continue
+
+                # Otherwise, we'll have to generate code for this case.
+                # Start off with a check: if there is a dependent parameter,
+                # and a list of valid values for that parameter, we need
+                # to generate an error if something other than one
+                # of those values is passed.
+                if len(dependentValidValues) > 0:
+                    conditional=""
+
+                    # If the parameter being checked is actually an array,
+                    # check only its first element.
+                    if depParamMaxVecSize == 0:
+                        valueToCheck = dependentParamName
+                    else:
+                        valueToCheck = "%s[0]" % dependentParamName
+
+                    for v in dependentValidValues:
+                        conditional += " && %s != %s" % (valueToCheck, v)
+                    switchCode.append("            if (%s) {" % conditional[4:])
+                    if errorCode == None:
+                        errorCode = "GL_INVALID_ENUM"
+                    switchCode.append('                _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s=0x%s)", %s);' % (errorCode, funcName, paramName, "%x", paramName))
+                    switchCode.append("                %s;" % errorReturn)
+                    switchCode.append("            }")
+                # endif there are dependent valid values
+
+                # The dependent parameter may require conditional
+                # value conversion.  If it does, and we don't want
+                # to convert values, we'll have to generate code for that
+                if depParamValueConversion == "some" and valueConvert == "noconvert":
+                    switchCode.append("            convert_%s_value = 0;" % dependentParamName)
+
+                # If there's a dependent vector size for this parameter
+                # that we're actually going to use (i.e. we need conversion),
+                # mark it.
+                if usedDependentVecSize:
+                    switchCode.append("            n_%s = %s;" % (dependentParamName, dependentVecSize))
+
+                # In all cases, break out of the switch if any valid
+                # value is found.
+                switchCode.append("            break;")
+
+
+            # Need a default case to catch all the other, invalid
+            # parameter values.  These will all generate errors.
+            switchCode.append("        default:")
+            if errorCode == None:
+                errorCode = "GL_INVALID_ENUM"
+            formatString = GetFormatString(paramType)
+            if formatString == None:
+                switchCode.append('            _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s)");' % (errorCode, funcName, paramName))
+            else:
+                switchCode.append('            _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s=%s)", %s);' % (errorCode, funcName, paramName, formatString, paramName))
+            switchCode.append("            %s;" % errorReturn)
+
+            # End of our switch code.
+            switchCode.append("    }")
+
+        # endfor every recognized parameter value
+
+    # endfor every param
+
+    # Here, the passthroughDeclarationString and passthroughCallString
+    # are complete; remove the extra ", " at the front of each.
+    passthroughDeclarationString = passthroughDeclarationString[2:]
+    passthroughCallString = passthroughCallString[2:]
+
+    # The Mesa functions are scattered across all the Mesa
+    # header files.  The easiest way to manage declarations
+    # is to create them ourselves.
+    if funcName in allSpecials:
+        print "/* this function is special and is defined elsewhere */"
+    print "extern %s GLAPIENTRY %s(%s);" % (returnType, passthroughFuncName, passthroughDeclarationString)
+
+    # A function may be a core function (i.e. it exists in
+    # the core specification), a core addition (extension
+    # functions added officially to the core), a required
+    # extension (usually an extension for an earlier version
+    # that has been officially adopted), or an optional extension.
+    #
+    # Core functions have a simple category (e.g. "GLES1.1");
+    # we generate only a simple callback for them.
+    #
+    # Core additions have two category listings, one simple
+    # and one compound (e.g.  ["GLES1.1", "GLES1.1:OES_fixed_point"]).  
+    # We generate the core function, and also an extension function.
+    #
+    # Required extensions and implemented optional extensions
+    # have a single compound category "GLES1.1:OES_point_size_array".
+    # For these we generate just the extension function.
+    for categorySpec in apiutil.Categories(funcName):
+        compoundCategory = categorySpec.split(":")
+
+        # This category isn't for us, if the base category doesn't match
+        # our version
+        if compoundCategory[0] != version:
+            continue
+
+        # Otherwise, determine if we're writing code for a core
+        # function (no suffix) or an extension function.
+        if len(compoundCategory) == 1:
+            # This is a core function
+            extensionName = None
+            extensionSuffix = ""
+        else:
+            # This is an extension function.  We'll need to append
+            # the extension suffix.
+            extensionName = compoundCategory[1]
+            extensionSuffix = extensionName.split("_")[0]
+        fullFuncName = funcPrefix + funcName + extensionSuffix
+
+        # Now the generated function.  The text used to mark an API-level
+        # function, oddly, is version-specific.
+        if extensionName:
+            print "/* Extension %s */" % extensionName
+
+        if (not variables and
+            not switchCode and
+            not conversionCodeOutgoing and
+            not conversionCodeIncoming):
+            # pass through directly
+            print "#define %s %s" % (fullFuncName, passthroughFuncName)
+            print
+            continue
+
+        print "static %s %s(%s)" % (returnType, fullFuncName, declarationString)
+        print "{"
+
+        # Start printing our code pieces.  Start with any local
+        # variables we need.  This unusual syntax joins the 
+        # lines in the variables[] array with the "\n" separator.
+        if len(variables) > 0:
+            print "\n".join(variables) + "\n"
+
+        # If there's any sort of parameter checking or variable
+        # array sizing, the switch code will contain it.
+        if len(switchCode) > 0:
+            print "\n".join(switchCode) + "\n"
+
+        # In the case of an outgoing conversion (i.e. parameters must
+        # be converted before calling the underlying Mesa function),
+        # use the appropriate code.
+        if "get" not in props and len(conversionCodeOutgoing) > 0:
+            print "\n".join(conversionCodeOutgoing) + "\n"
+
+        # Call the Mesa function.  Note that there are very few functions
+        # that return a value (i.e. returnType is not "void"), and that
+        # none of them require incoming translation; so we're safe
+        # to generate code that directly returns in those cases,
+        # even though it's not completely independent.
+
+        if returnType == "void":
+            print "    %s(%s);" % (passthroughFuncName, passthroughCallString)
+        else:
+            print "    return %s(%s);" % (passthroughFuncName, passthroughCallString)
+
+        # If the function is one that returns values (i.e. "get" in props),
+        # it might return values of a different type than we need, that
+        # require conversion before passing back to the application.
+        if "get" in props and len(conversionCodeIncoming) > 0:
+            print "\n".join(conversionCodeIncoming)
+
+        # All done.
+        print "}"
+        print
+    # end for each category provided for a function
+
+# end for each function
+
+print """
+struct _glapi_table *
+_mesa_create_exec_table_%s(void)
+{
+   struct _glapi_table *exec;
+   exec = _mesa_alloc_dispatch_table(sizeof *exec);
+   if (exec == NULL)
+      return NULL;
+
+""" % shortname
+
+for func in keys:
+    prefix = "_es_" if func not in allSpecials else "_check_"
+    for spec in apiutil.Categories(func):
+        ext = spec.split(":")
+        # version does not match
+        if ext.pop(0) != version:
+            continue
+        entry = func
+        if ext:
+            suffix = ext[0].split("_")[0]
+            entry += suffix
+        print "    SET_%s(exec, %s%s);" % (entry, prefix, entry)
+print ""
+print "   return exec;"
+print "}"
index dda1a6be3a9dcd91dbe87afbb13907f1c21d8085..7afdee36f5b6752c398a513cf354e8e5d378e526 100644 (file)
@@ -58,6 +58,12 @@ _mesa_map_function_array(const struct gl_function_remap *func_array);
 extern void
 _mesa_map_static_functions(void);
 
+extern void
+_mesa_map_static_functions_es1(void);
+
+extern void
+_mesa_map_static_functions_es2(void);
+
 extern void
 _mesa_do_init_remap_table(const char *pool,
                          int size,
@@ -66,6 +72,12 @@ _mesa_do_init_remap_table(const char *pool,
 extern void
 _mesa_init_remap_table(void);
 
+extern void
+_mesa_init_remap_table_es1(void);
+
+extern void
+_mesa_init_remap_table_es2(void);
+
 #else /* FEATURE_remap_table */
 
 static INLINE const char *
@@ -90,6 +102,17 @@ _mesa_map_static_functions(void)
 {
 }
 
+
+static INLINE void
+_mesa_map_static_functions_es1(void)
+{
+}
+
+static INLINE void
+_mesa_map_static_functions_es2(void)
+{
+}
+
 static INLINE void
 _mesa_do_init_remap_table(const char *pool,
                          int size,
@@ -102,6 +125,16 @@ _mesa_init_remap_table(void)
 {
 }
 
+static INLINE void
+_mesa_init_remap_table_es1(void)
+{
+}
+
+static INLINE void
+_mesa_init_remap_table_es2(void)
+{
+}
+
 #endif /* FEATURE_remap_table */
 
 
index d9ebb51a6d2b05b2a20a4eb7b07183bdeca0c324..72b46e981f3f3bcba63c5ddc262060f5cddd2a53 100644 (file)
@@ -3,6 +3,8 @@
 MAIN_SOURCES = \
        main/api_arrayelt.c \
        main/api_exec.c \
+       main/api_exec_es1.c \
+       main/api_exec_es2.c \
        main/api_loopback.c \
        main/api_noop.c \
        main/api_validate.c \