[Mesa-dev] [PATCH] GLX: Generate the libglvnd dispatch stub functions.

Kyle Brenneman kbrenneman at nvidia.com
Wed Feb 22 20:18:53 UTC 2017


Add a Python script to generate the dispatch stubs for libglvnd. This replaces
the manually edited files g_glxglvnddispatchfuncs.c and
g_glxglvnddispatchindices.h.
---
 src/Makefile.am                     |    6 +
 src/generate/genCommon.py           |  223 ++++
 src/generate/gen_glx_dispatch.py    |  408 +++++++
 src/generate/glx.xml                | 2161 +++++++++++++++++++++++++++++++++++
 src/generate/glx_function_list.py   |  285 +++++
 src/generate/glx_other.xml          |   48 +
 src/glx/Makefile.am                 |   30 +-
 src/glx/g_glxglvnddispatchfuncs.c   |  971 ----------------
 src/glx/g_glxglvnddispatchindices.h |   92 --
 src/glx/glxdispatchstubs.c          |  181 +++
 src/glx/glxdispatchstubs.h          |  177 +++
 src/glx/glxglvnd.c                  |   45 +-
 src/glx/glxglvnd.h                  |   14 -
 src/glx/glxglvnddispatchfuncs.h     |   70 --
 14 files changed, 3518 insertions(+), 1193 deletions(-)
 create mode 100644 src/generate/genCommon.py
 create mode 100755 src/generate/gen_glx_dispatch.py
 create mode 100644 src/generate/glx.xml
 create mode 100644 src/generate/glx_function_list.py
 create mode 100644 src/generate/glx_other.xml
 delete mode 100644 src/glx/g_glxglvnddispatchfuncs.c
 delete mode 100644 src/glx/g_glxglvnddispatchindices.h
 create mode 100644 src/glx/glxdispatchstubs.c
 create mode 100644 src/glx/glxdispatchstubs.h
 delete mode 100644 src/glx/glxglvnd.h
 delete mode 100644 src/glx/glxglvnddispatchfuncs.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 12e5dcd..d31a591 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -139,6 +139,12 @@ EXTRA_DIST += \
 	getopt hgl SConscript \
 	$(top_srcdir)/include/GL/mesa_glinterop.h
 
+EXTRA_DIST += generate/genCommon.py
+EXTRA_DIST += generate/gen_glx_dispatch.py
+EXTRA_DIST += generate/glx_function_list.py
+EXTRA_DIST += generate/glx_other.xml
+EXTRA_DIST += generate/glx.xml
+
 AM_CFLAGS = $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
diff --git a/src/generate/genCommon.py b/src/generate/genCommon.py
new file mode 100644
index 0000000..d493d7b
--- /dev/null
+++ b/src/generate/genCommon.py
@@ -0,0 +1,223 @@
+#!/usr/bin/env python
+
+# (C) Copyright 2015, NVIDIA CORPORATION.
+# 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
+# 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.
+#
+# Authors:
+#    Kyle Brenneman <kbrenneman at nvidia.com>
+
+import collections
+import re
+import sys
+import xml.etree.cElementTree as etree
+
+MAPI_TABLE_NUM_DYNAMIC = 4096
+
+_LIBRARY_FEATURE_NAMES = {
+    # libGL and libGLdiapatch both include every function.
+    "gl" : None,
+    "gldispatch" : None,
+    "opengl" : frozenset(( "GL_VERSION_1_0", "GL_VERSION_1_1",
+        "GL_VERSION_1_2", "GL_VERSION_1_3", "GL_VERSION_1_4", "GL_VERSION_1_5",
+        "GL_VERSION_2_0", "GL_VERSION_2_1", "GL_VERSION_3_0", "GL_VERSION_3_1",
+        "GL_VERSION_3_2", "GL_VERSION_3_3", "GL_VERSION_4_0", "GL_VERSION_4_1",
+        "GL_VERSION_4_2", "GL_VERSION_4_3", "GL_VERSION_4_4", "GL_VERSION_4_5",
+    )),
+    "glesv1" : frozenset(("GL_VERSION_ES_CM_1_0", "GL_OES_point_size_array")),
+    "glesv2" : frozenset(("GL_ES_VERSION_2_0", "GL_ES_VERSION_3_0",
+            "GL_ES_VERSION_3_1" "GL_ES_VERSION_3_2",
+    )),
+}
+
+def getFunctions(xmlFiles):
+    """
+    Reads an XML file and returns all of the functions defined in it.
+
+    xmlFile should be the path to Khronos's gl.xml file. The return value is a
+    sequence of FunctionDesc objects, ordered by slot number.
+    """
+    roots = [ etree.parse(xmlFile).getroot() for xmlFile in xmlFiles ]
+    return getFunctionsFromRoots(roots)
+
+def getFunctionsFromRoots(roots):
+    functions = {}
+    for root in roots:
+        for func in _getFunctionList(root):
+            functions[func.name] = func
+    functions = functions.values()
+
+    # Sort the function list by name.
+    functions = sorted(functions, key=lambda f: f.name)
+
+    # Assign a slot number to each function. This isn't strictly necessary,
+    # since you can just look at the index in the list, but it makes it easier
+    # to include the slot when formatting output.
+    for i in range(len(functions)):
+        functions[i] = functions[i]._replace(slot=i)
+
+    return functions
+
+def getExportNamesFromRoots(target, roots):
+    """
+    Goes through the <feature> tags from gl.xml and returns a set of OpenGL
+    functions that a library should export.
+
+    target should be one of "gl", "gldispatch", "opengl", "glesv1", or
+    "glesv2".
+    """
+    featureNames = _LIBRARY_FEATURE_NAMES[target]
+    if featureNames is None:
+        return set(func.name for func in getFunctionsFromRoots(roots))
+
+    names = set()
+    for root in roots:
+        features = []
+        for featElem in root.findall("feature"):
+            if featElem.get("name") in featureNames:
+                features.append(featElem)
+        for featElem in root.findall("extensions/extension"):
+            if featElem.get("name") in featureNames:
+                features.append(featElem)
+        for featElem in features:
+            for commandElem in featElem.findall("require/command"):
+                names.add(commandElem.get("name"))
+    return names
+
+class FunctionArg(collections.namedtuple("FunctionArg", "type name")):
+    @property
+    def dec(self):
+        """
+        Returns a "TYPE NAME" string, suitable for a function prototype.
+        """
+        rv = str(self.type)
+        if not rv.endswith("*"):
+            rv += " "
+        rv += self.name
+        return rv
+
+class FunctionDesc(collections.namedtuple("FunctionDesc", "name rt args slot")):
+    def hasReturn(self):
+        """
+        Returns true if the function returns a value.
+        """
+        return (self.rt != "void")
+
+    @property
+    def decArgs(self):
+        """
+        Returns a string with the types and names of the arguments, as you
+        would use in a function declaration.
+        """
+        if not self.args:
+            return "void"
+        else:
+            return ", ".join(arg.dec for arg in self.args)
+
+    @property
+    def callArgs(self):
+        """
+        Returns a string with the names of the arguments, as you would use in a
+        function call.
+        """
+        return ", ".join(arg.name for arg in self.args)
+
+    @property
+    def basename(self):
+        assert self.name.startswith("gl")
+        return self.name[2:]
+
+def _getFunctionList(root):
+    for elem in root.findall("commands/command"):
+        yield _parseCommandElem(elem)
+
+def _parseCommandElem(elem):
+    protoElem = elem.find("proto")
+    (rt, name) = _parseProtoElem(protoElem)
+
+    args = []
+    for ch in elem.findall("param"):
+        # <param> tags have the same format as a <proto> tag.
+        args.append(FunctionArg(*_parseProtoElem(ch)))
+    func = FunctionDesc(name, rt, tuple(args), slot=None)
+
+    return func
+
+def _parseProtoElem(elem):
+    # If I just remove the tags and string the text together, I'll get valid C code.
+    text = _flattenText(elem)
+    text = text.strip()
+    m = re.match(r"^(.+)\b(\w+)(?:\s*\[\s*(\d*)\s*\])?$", text, re.S)
+    if m:
+        typename = _fixupTypeName(m.group(1))
+        name = m.group(2)
+        if m.group(3):
+            # HACK: glPathGlyphIndexRangeNV defines an argument like this:
+            # GLuint baseAndCount[2]
+            # Convert it to a pointer and hope for the best.
+            typename += "*"
+        return (typename, name)
+    else:
+        raise ValueError("Can't parse element %r -> %r" % (elem, text))
+
+def _flattenText(elem):
+    """
+    Returns the text in an element and all child elements, with the tags
+    removed.
+    """
+    text = ""
+    if elem.text is not None:
+        text = elem.text
+    for ch in elem:
+        text += _flattenText(ch)
+        if ch.tail is not None:
+            text += ch.tail
+    return text
+
+def _fixupTypeName(typeName):
+    """
+    Converts a typename into a more consistent format.
+    """
+
+    rv = typeName.strip()
+
+    # Replace "GLvoid" with just plain "void".
+    rv = re.sub(r"\bGLvoid\b", "void", rv)
+
+    # Remove the vendor suffixes from types that have a suffix-less version.
+    rv = re.sub(r"\b(GLhalf|GLintptr|GLsizeiptr|GLint64|GLuint64)(?:ARB|EXT|NV|ATI)\b", r"\1", rv)
+
+    rv = re.sub(r"\bGLvoid\b", "void", rv)
+
+    # Clear out any leading and trailing whitespace.
+    rv = rv.strip()
+
+    # Remove any whitespace before a '*'
+    rv = re.sub(r"\s+\*", r"*", rv)
+
+    # Change "foo*" to "foo *"
+    rv = re.sub(r"([^\*])\*", r"\1 *", rv)
+
+    # Condense all whitespace into a single space.
+    rv = re.sub(r"\s+", " ", rv)
+
+    return rv
+
diff --git a/src/generate/gen_glx_dispatch.py b/src/generate/gen_glx_dispatch.py
new file mode 100755
index 0000000..fc41fc1
--- /dev/null
+++ b/src/generate/gen_glx_dispatch.py
@@ -0,0 +1,408 @@
+#!/usr/bin/env python2
+
+# Copyright (c) 2016, NVIDIA CORPORATION.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and/or associated documentation files (the
+# "Materials"), to deal in the Materials without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Materials, and to
+# permit persons to whom the Materials are furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# unaltered in all copies or substantial portions of the Materials.
+# Any additions, deletions, or changes to the original source files
+# must be clearly indicated in accompanying documentation.
+#
+# If only executable code is distributed, then the accompanying
+# documentation must state that "this software is based in part on the
+# work of the Khronos Group."
+#
+# THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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
+# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+"""
+Generates dispatch functions for GLX.
+
+This script is provided to make it easier to generate the GLX dispatch stubs
+for a vendor library.
+
+The script will read a list of functions from Khronos's glx.xml list, with
+additional information provided in a separate Python module.
+
+See example_glx_function_list.py for an example of the function list.
+"""
+
+import argparse
+import sys
+import collections
+import imp
+
+import os.path
+import genCommon
+
+_GLX_DRAWABLE_TYPES = frozenset(("GLXDrawable", "GLXWindow", "GLXPixmap",
+        "GLXPbuffer", "GLXPbufferSGIX"))
+_GLX_FBCONFIG_TYPES = frozenset(("GLXFBConfig", "GLXFBConfigSGIX"))
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("target", choices=("header", "source"),
+            help="Whether to build the source or header file.")
+    parser.add_argument("func_list_file", help="The function list .py file.")
+    parser.add_argument("xml_files", nargs="+", help="The XML files with the EGL function lists.")
+
+    args = parser.parse_args()
+
+    # The function list is a Python module, but it's specified on the command
+    # line.
+    glxFunctionList = imp.load_source("glxFunctionList", args.func_list_file)
+
+    xmlFunctions = genCommon.getFunctions(args.xml_files)
+    xmlByName = dict((f.name, f) for f in xmlFunctions)
+    functions = []
+    for (name, glxFunc) in glxFunctionList.GLX_FUNCTIONS:
+        func = xmlByName[name]
+        glxFunc = fixupFunc(func, glxFunc)
+        functions.append((func, glxFunc))
+
+    # Sort the function list by name.
+    functions = sorted(functions, key=lambda f: f[0].name)
+
+    if args.target == "header":
+        text = generateHeader(functions)
+    elif args.target == "source":
+        text = generateSource(functions)
+    sys.stdout.write(text)
+
+def fixupFunc(func, glxFunc):
+    """
+    Does some basic error-checking on a function, and fills in default values
+    for any fields that haven't been set.
+    """
+
+    result = dict(glxFunc)
+    if result.get("prefix") is None:
+        result["prefix"] = ""
+
+    if result.get("static") is None:
+        result["static"] = False
+
+    if result.get("public") is None:
+        result["public"] = False
+
+    if result.get("static") and result.get("public"):
+        raise ValueError("Function %s cannot be both static and public" % (func.name,))
+
+    # If the method is "custom" or "none", then we're not going to generate a
+    # stub for it, so the rest of the data doesn't matter.
+    if result["method"] in ("custom", "none"):
+        return result
+
+    if func.hasReturn():
+        if result.get("retval") is None:
+            result["retval"] = getDefaultReturnValue(func.rt)
+
+    if result.get("extension") is not None:
+        text = "defined(" + result["extension"] + ")"
+        result["extension"] = text
+
+    if result["method"] != "current":
+        # This function is dispatched based on a paramter. Figure out which
+        # one.
+        if result.get("key") is not None:
+            # The parameter was specified, so just use it.
+            result["key"] = fixupParamName(func, result["key"])
+        else:
+            # Look for a parameter of the correct type.
+            if result["method"] == "drawable":
+                result["key"] = findParamByType(func, _GLX_DRAWABLE_TYPES)
+            elif result["method"] == "context":
+                result["key"] = findParamByType(func, ("GLXContext", "const GLXContext"))
+            elif result["method"] == "config":
+                result["key"] = findParamByType(func, _GLX_FBCONFIG_TYPES)
+            elif result["method"] == "screen":
+                result["key"] = fixupParamName(func, "screen")
+            elif result["method"] == "xvisinfo":
+                result["key"] = findParamByType(func, ("XVisualInfo *", "const XVisualInfo *"))
+            else:
+                raise ValueError("Unknown lookup method %r for function %r" % (result["method"], func.name))
+            if result["key"] is None:
+                raise ValueError("Can't find lookup key for function %r" % (func.name,))
+
+        if result["method"] == "xvisinfo":
+            # If we're using an XVisualInfo pointer, then we just need the
+            # screen number from it.
+            result["key"] = "(" + result["key"] + ")->screen"
+            result["method"] = "screen"
+
+    if result["method"] == "drawable":
+        # For reporting errors when we look up a vendor by drawable, we also
+        # have to specify the error code.
+        if result.get("opcode") is not None and result.get("error") is None:
+            raise ValueError("Missing error code for function %r" % (func.name,))
+
+    if result.get("remove_mapping") is not None:
+        if result["remove_mapping"] not in ("context", "drawable", "config"):
+            raise ValueError("Invalid remove_mapping value %r for function %r" %
+                    (result["remove_mapping"], func.name))
+        if result.get("remove_key") is not None:
+            result["remove_key"] = fixupParamName(func, result["remove_key"])
+        else:
+            assert result["remove_mapping"] == result["method"]
+            result["remove_key"] = result["key"]
+
+    if result.get("opcode") is None:
+        result["opcode"] = "-1"
+        result["error"] = "-1"
+
+    if result.get("display") is not None:
+        result["display"] = fixupParamName(func, result["display"])
+    else:
+        result["display"] = findParamByType(func, ("Display *",))
+        if result["display"] is None:
+            if getNeedsDisplayPointer(func, result):
+                raise ValueError("Can't find display pointer for function %r" % (func.name,))
+            result["display"] = "NULL"
+
+    return result
+
+def getDefaultReturnValue(typename):
+    """
+    Picks a default return value. The dispatch stub will return this value if
+    it can't find an implementation function.
+    """
+    if typename.endswith("*"):
+        return "NULL"
+    if typename == "GLXContext" or typename in _GLX_FBCONFIG_TYPES:
+        return "NULL"
+    if typename in _GLX_DRAWABLE_TYPES:
+        return "None"
+    if typename in ("XID", "GLXFBConfigID", "GLXContextID"):
+        return "None"
+
+    return "0"
+
+def getNeedsDisplayPointer(func, glxFunc):
+    """
+    Returns True if a function needs a Display pointer.
+    """
+    if glxFunc["method"] not in ("none", "custom", "context", "current"):
+        return True
+    if glxFunc.get("add_mapping") is not None:
+        return True
+    if glxFunc.get("remove_mapping") is not None:
+        return True
+    return False
+
+def findParamByType(func, typeNames):
+    """
+    Looks for a parameter of a given data type. Returns the name of the
+    parameter, or None if no matching parameter was found.
+    """
+    for arg in func.args:
+        if arg.type in typeNames:
+            return arg.name
+    return None
+
+def fixupParamName(func, paramSpec):
+    """
+    Takes a parameter that was specified in the function list and returns a
+    parameter name or a C expression.
+    """
+    try:
+        # If the parameter is an integer, then treat it as a parameter index.
+        index = int(paramSpec)
+        return func.args[index]
+    except ValueError:
+        # Not an integer
+        pass
+
+    # If the string is contained in parentheses, then assume it's a valid C
+    # expression.
+    if paramSpec.startswith("(") and paramSpec.endswith(")"):
+        return paramSpec[1:-1]
+
+    # Otherwise, assume the string is a parameter name.
+    for arg in func.args:
+        if arg.name == paramSpec:
+            return arg.name
+
+    raise ValueError("Invalid parameter name %r in function %r" % (paramSpec, func))
+
+def generateHeader(functions):
+    text = r"""
+#ifndef G_GLXDISPATCH_STUBS_H
+#define G_GLXDISPATCH_STUBS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <GL/gl.h>
+#include <GL/glx.h>
+#include <GL/glxext.h>
+
+""".lstrip("\n")
+
+    text += "enum {\n"
+    for (func, glxFunc) in functions:
+        text += generateGuardBegin(func, glxFunc)
+        text += "    __GLX_DISPATCH_" + func.name + ",\n"
+        text += generateGuardEnd(func, glxFunc)
+    text += "    __GLX_DISPATCH_COUNT\n"
+    text += "};\n\n"
+
+    for (func, glxFunc) in functions:
+        if glxFunc["inheader"]:
+            text += generateGuardBegin(func, glxFunc)
+            text += "{f.rt} {ex[prefix]}{f.name}({f.decArgs});\n".format(f=func, ex=glxFunc)
+            text += generateGuardEnd(func, glxFunc)
+
+    text += r"""
+#ifdef __cplusplus
+}
+#endif
+#endif // G_GLXDISPATCH_STUBS_H
+"""
+    return text
+
+def generateSource(functions):
+    text = r'''
+#include "glxdispatchstubs.h"
+#include "g_glxdispatchstubs.h"
+
+#include <X11/Xlibint.h>
+#include <GL/glxproto.h>
+
+'''.lstrip("\n")
+
+    for (func, glxFunc) in functions:
+        if glxFunc["method"] not in ("none", "custom"):
+            text += generateGuardBegin(func, glxFunc)
+            text += generateDispatchFunc(func, glxFunc)
+            text += generateGuardEnd(func, glxFunc)
+
+    text += "\n"
+    text += "const char * const __GLX_DISPATCH_FUNC_NAMES[__GLX_DISPATCH_COUNT + 1] = {\n"
+    for (func, glxFunc) in functions:
+        text += generateGuardBegin(func, glxFunc)
+        text += '    "' + func.name + '",\n'
+        text += generateGuardEnd(func, glxFunc)
+    text += "    NULL,\n"
+    text += "};\n"
+
+    text += "const __GLXextFuncPtr __GLX_DISPATCH_FUNCS[__GLX_DISPATCH_COUNT + 1] = {\n"
+    for (func, glxFunc) in functions:
+        text += generateGuardBegin(func, glxFunc)
+        if glxFunc["method"] != "none":
+            text += "    (__GLXextFuncPtr) " + glxFunc["prefix"] + func.name + ",\n"
+        else:
+            text += "    NULL, // " + func.name + "\n"
+        text += generateGuardEnd(func, glxFunc)
+    text += "    NULL,\n"
+    text += "};\n"
+
+    return text
+
+def generateGuardBegin(func, glxFunc):
+    ext = glxFunc.get("extension")
+    if ext is not None:
+        return "#if " + ext + "\n"
+    else:
+        return ""
+
+def generateGuardEnd(func, glxFunc):
+    if glxFunc.get("extension") is not None:
+        return "#endif\n"
+    else:
+        return ""
+
+def generateDispatchFunc(func, glxFunc):
+    text = ""
+
+    if glxFunc["static"]:
+        text += "static "
+    elif glxFunc["public"]:
+        text += "PUBLIC "
+
+    text += r"""{f.rt} {ex[prefix]}{f.name}({f.decArgs})
+{{
+    typedef {f.rt} (* _pfn_{f.name})({f.decArgs});
+"""
+
+    text += "    __GLXvendorInfo *_vendor;\n"
+    text += "    _pfn_{f.name} _ptr_{f.name};\n"
+    if func.hasReturn():
+        text += "    {f.rt} _ret = {ex[retval]};\n"
+    text += "\n"
+
+    # Look up the vendor library
+    text += "    _vendor = "
+    if glxFunc["method"] == "current":
+        text += "__glXDispatchApiExports->getCurrentDynDispatch();\n"
+    elif glxFunc["method"] == "screen":
+        text += "__glXDispatchApiExports->getDynDispatch({ex[display]}, {ex[key]});\n"
+    elif glxFunc["method"] == "drawable":
+        text += "__glxDispatchVendorByDrawable({ex[display]}, {ex[key]}, {ex[opcode]}, {ex[error]});\n"
+    elif glxFunc["method"] == "context":
+        text += "__glxDispatchVendorByContext({ex[display]}, {ex[key]}, {ex[opcode]});\n"
+    elif glxFunc["method"] == "config":
+        text += "__glxDispatchVendorByConfig({ex[display]}, {ex[key]}, {ex[opcode]});\n"
+    else:
+        raise ValueError("Unknown dispatch method: %r" % (glxFunc["method"],))
+
+    # Look up and call the function.
+    text += r"""
+    if (_vendor != NULL) {{
+        _ptr_{f.name} = (_pfn_{f.name})
+            __glXDispatchApiExports->fetchDispatchEntry(_vendor, __glXDispatchFuncIndices[__GLX_DISPATCH_{f.name}]);
+        if (_ptr_{f.name} != NULL) {{
+""".lstrip("\n")
+
+    text += "            "
+    if func.hasReturn():
+        text += "_ret = "
+    text += "(*_ptr_{f.name})({f.callArgs});\n"
+
+    # Handle any added or removed object mappings.
+    if glxFunc.get("add_mapping") is not None:
+        if glxFunc["add_mapping"] == "context":
+            text += "            _ret = __glXDispatchAddContextMapping({ex[display]}, _ret, _vendor);\n"
+        elif glxFunc["add_mapping"] == "drawable":
+            text += "            __glXDispatchAddDrawableMapping({ex[display]}, _ret, _vendor);\n"
+        elif glxFunc["add_mapping"] == "config":
+            text += "            _ret = __glXDispatchAddFBConfigMapping({ex[display]}, _ret, _vendor);\n"
+        elif glxFunc["add_mapping"] == "config_list":
+            text += "            _ret = __glXDispatchAddFBConfigListMapping({ex[display]}, _ret, nelements, _vendor);\n"
+        else:
+            raise ValueError("Unknown add_mapping method: %r" % (glxFunc["add_mapping"],))
+
+    if glxFunc.get("remove_mapping") is not None:
+        if glxFunc["remove_mapping"] == "context":
+            text += "            __glXDispatchApiExports->removeVendorContextMapping({ex[display]}, {ex[remove_key]});\n"
+        elif glxFunc["remove_mapping"] == "drawable":
+            text += "            __glXDispatchApiExports->removeVendorDrawableMapping({ex[display]}, {ex[remove_key]});\n"
+        elif glxFunc["remove_mapping"] == "config":
+            text += "            __glXDispatchApiExports->removeVendorFBConfigMapping({ex[display]}, {ex[remove_key]});\n"
+        else:
+            raise ValueError("Unknown remove_mapping method: %r" % (glxFunc["add_mapping"],))
+
+    text += "        }}\n"
+    text += "    }}\n"
+    if func.hasReturn():
+        text += "    return _ret;\n"
+    text += "}}\n\n"
+
+    text = text.format(f=func, ex=glxFunc)
+    return text
+
+if __name__ == "__main__":
+    main()
+
diff --git a/src/generate/glx.xml b/src/generate/glx.xml
new file mode 100644
index 0000000..025e9f9
--- /dev/null
+++ b/src/generate/glx.xml
@@ -0,0 +1,2161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<registry>
+    <!--
+    Copyright (c) 2013-2014 The Khronos Group Inc.
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and/or associated documentation files (the
+    "Materials"), to deal in the Materials without restriction, including
+    without limitation the rights to use, copy, modify, merge, publish,
+    distribute, sublicense, and/or sell copies of the Materials, and to
+    permit persons to whom the Materials are 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 Materials.
+
+    THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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
+    MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+    -->
+    <!--
+    This file, glx.xml, is the GLX API Registry. The older ".spec" file
+    format has been retired and will no longer be updated with new
+    extensions and API versions. The canonical version of the registry,
+    together with documentation, schema, and Python generator scripts used
+    to generate C header files for GLX, can always be found in the Khronos
+    Registry at
+        http://www.opengl.org/registry/
+    -->
+
+    <!-- SECTION: GLX type definitions. Does not include X or GL types. -->
+    <types>
+            <!-- These are dependencies GLX types require to be declared legally -->
+        <type name="inttypes"><![CDATA[#ifndef GLEXT_64_TYPES_DEFINED
+/* This code block is duplicated in glext.h, so must be protected */
+#define GLEXT_64_TYPES_DEFINED
+/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
+/* (as used in the GLX_OML_sync_control extension). */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <inttypes.h>
+#elif defined(__sun__) || defined(__digital__)
+#include <inttypes.h>
+#if defined(__STDC__)
+#if defined(__arch64__) || defined(_LP64)
+typedef long int int64_t;
+typedef unsigned long int uint64_t;
+#else
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#endif /* __arch64__ */
+#endif /* __STDC__ */
+#elif defined( __VMS ) || defined(__sgi)
+#include <inttypes.h>
+#elif defined(__SCO__) || defined(__USLC__)
+#include <stdint.h>
+#elif defined(__UNIXOS2__) || defined(__SOL64__)
+typedef long int int32_t;
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#elif defined(_WIN32) && defined(__GNUC__)
+#include <stdint.h>
+#elif defined(_WIN32)
+typedef __int32 int32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#else
+/* Fallback if nothing above works */
+#include <inttypes.h>
+#endif
+#endif]]></type>
+        <type name="int32_t" requires="inttypes"/>
+        <type name="int64_t" requires="inttypes"/>
+            <!-- Dummy placeholders for X types -->
+        <type name="Bool"/>
+        <type name="Colormap"/>
+        <type name="Display"/>
+        <type name="Font"/>
+        <type name="Pixmap"/>
+        <type name="Screen"/>
+        <type name="Status"/>
+        <type name="Window"/>
+        <type name="XVisualInfo"/>
+        <type name="GLbitfield"/>
+        <type name="GLboolean"/>
+        <type name="GLenum"/>
+        <type name="GLfloat"/>
+        <type name="GLint"/>
+        <type name="GLintptr"/>
+        <type name="GLsizei"/>
+        <type name="GLsizeiptr"/>
+        <type name="GLubyte"/>
+        <type name="GLuint"/>
+        <type name="DMbuffer"/>
+        <type name="DMparams"/>
+        <type name="VLNode"/>
+        <type name="VLPath"/>
+        <type name="VLServer"/>
+            <!-- These are actual GLX types. X types are not included.  -->
+        <type>typedef XID <name>GLXFBConfigID</name>;</type>
+        <type>typedef struct __GLXFBConfigRec *<name>GLXFBConfig</name>;</type>
+        <type>typedef XID <name>GLXContextID</name>;</type>
+        <type>typedef struct __GLXcontextRec *<name>GLXContext</name>;</type>
+        <type>typedef XID <name>GLXPixmap</name>;</type>
+        <type>typedef XID <name>GLXDrawable</name>;</type>
+        <type>typedef XID <name>GLXWindow</name>;</type>
+        <type>typedef XID <name>GLXPbuffer</name>;</type>
+        <type>typedef void (<apientry /> *<name>__GLXextFuncPtr</name>)(void);</type>
+        <type>typedef XID <name>GLXVideoCaptureDeviceNV</name>;</type>
+        <type>typedef unsigned int <name>GLXVideoDeviceNV</name>;</type>
+        <type>typedef XID <name>GLXVideoSourceSGIX</name>;</type>
+        <type>typedef XID <name>GLXFBConfigIDSGIX</name>;</type>
+        <type>typedef struct __GLXFBConfigRec *<name>GLXFBConfigSGIX</name>;</type>
+        <type>typedef XID <name>GLXPbufferSGIX</name>;</type>
+            <!-- Declaring C structures in XML is a pain indentation-wise -->
+        <type>typedef struct {
+    int event_type;             /* GLX_DAMAGED or GLX_SAVED */
+    int draw_type;              /* GLX_WINDOW or GLX_PBUFFER */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool send_event;            /* true if this came for SendEvent request */
+    Display *display;           /* display the event was read from */
+    GLXDrawable drawable;       /* XID of Drawable */
+    unsigned int buffer_mask;   /* mask indicating which buffers are affected */
+    unsigned int aux_buffer;    /* which aux buffer was affected */
+    int x, y;
+    int width, height;
+    int count;                  /* if nonzero, at least this many more */
+} <name>GLXPbufferClobberEvent</name>;</type>
+
+        <type>typedef struct {
+    int type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool send_event;            /* true if this came from a SendEvent request */
+    Display *display;           /* Display the event was read from */
+    GLXDrawable drawable;       /* drawable on which event was requested in event mask */
+    int event_type;
+    int64_t ust;
+    int64_t msc;
+    int64_t sbc;
+} <name>GLXBufferSwapComplete</name>;</type>
+
+        <type>typedef union __GLXEvent {
+    GLXPbufferClobberEvent glxpbufferclobber;
+    GLXBufferSwapComplete glxbufferswapcomplete;
+    long pad[24];
+} <name>GLXEvent</name>;</type>
+
+        <type>typedef struct {
+    int type;
+    unsigned long serial;
+    Bool send_event;
+    Display *display;
+    int extension;
+    int evtype;
+    GLXDrawable window;
+    Bool stereo_tree;
+} <name>GLXStereoNotifyEventEXT</name>;</type>
+
+        <type>typedef struct {
+    int type;
+    unsigned long serial;   /* # of last request processed by server */
+    Bool send_event;        /* true if this came for SendEvent request */
+    Display *display;       /* display the event was read from */
+    GLXDrawable drawable;   /* i.d. of Drawable */
+    int event_type;         /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
+    int draw_type;          /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
+    unsigned int mask;      /* mask indicating which buffers are affected*/
+    int x, y;
+    int width, height;
+    int count;              /* if nonzero, at least this many more */
+} <name>GLXBufferClobberEventSGIX</name>;</type>
+
+        <type>typedef struct {
+    char    pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
+    int     networkId;
+} <name>GLXHyperpipeNetworkSGIX</name>;</type>
+
+        <type>typedef struct {
+    char    pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
+    int     channel;
+    unsigned int participationType;
+    int     timeSlice;
+} <name>GLXHyperpipeConfigSGIX</name>;</type>
+
+        <type>typedef struct {
+    char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
+    int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
+    int destXOrigin, destYOrigin, destWidth, destHeight;
+} <name>GLXPipeRect</name>;</type>
+
+        <type>typedef struct {
+    char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
+    int XOrigin, YOrigin, maxHeight, maxWidth;
+} <name>GLXPipeRectLimits</name>;</type>
+
+    </types>
+
+
+    <!-- SECTION: GLX enumerant (token) definitions. -->
+
+    <enums namespace="GLXStrings">
+        <enum value=""GLX""  name="GLX_EXTENSION_NAME" comment="This is modest abuse of the enum tag mechanism, maybe a string tag?"/>
+    </enums>
+
+    <!-- Bitmasks each have their own namespace, as do a few other
+         categories of enumeration -->
+
+    <enums namespace="GLXStringName">
+        <enum value="0x1"           name="GLX_VENDOR"/>
+        <enum value="0x2"           name="GLX_VERSION"/>
+        <enum value="0x3"           name="GLX_EXTENSIONS"/>
+    </enums>
+
+    <enums namespace="GLXMesa3DFXMode" vendor="MESA">
+        <enum value="0x1"           name="GLX_3DFX_WINDOW_MODE_MESA"/>
+        <enum value="0x2"           name="GLX_3DFX_FULLSCREEN_MODE_MESA"/>
+    </enums>
+
+    <enums namespace="GLXEventCodes">
+        <!-- __GLX_NUMBER_EVENTS is set to 17 to account for the
+             BufferClobberSGIX event. This helps initialization if the
+             server supports the extension and the client doesn't. -->
+        <enum value="0"             name="GLX_PbufferClobber"/>
+        <enum value="1"             name="GLX_BufferSwapComplete"/>
+        <enum value="17"            name="__GLX_NUMBER_EVENTS"/>
+    </enums>
+
+    <enums namespace="GLXErrorCode">
+        <enum value="1"             name="GLX_BAD_SCREEN"/>
+        <enum value="2"             name="GLX_BAD_ATTRIBUTE"/>
+        <enum value="3"             name="GLX_NO_EXTENSION"/>
+        <enum value="4"             name="GLX_BAD_VISUAL"/>
+        <enum value="5"             name="GLX_BAD_CONTEXT"/>
+        <enum value="6"             name="GLX_BAD_VALUE"/>
+        <enum value="7"             name="GLX_BAD_ENUM"/>
+        <enum value="91"            name="GLX_BAD_HYPERPIPE_CONFIG_SGIX"/>
+        <enum value="92"            name="GLX_BAD_HYPERPIPE_SGIX"/>
+    </enums>
+
+    <enums namespace="GLX_GenericEventCode" vendor="ARB" comment="Returned in the evtype field of XGenericEventCookie requests. This is a numeric code, not a bitmask. See http://www.x.org/releases/X11R7.6/doc/xextproto/geproto.html">
+        <enum value="0x00000000"    name="GLX_STEREO_NOTIFY_EXT"/>
+    </enums>
+
+    <enums namespace="GLXDrawableTypeMask" type="bitmask" comment="DRAWABLE_TYPE bits">
+        <enum value="0x00000001"    name="GLX_WINDOW_BIT"/>
+        <enum value="0x00000001"    name="GLX_WINDOW_BIT_SGIX"/>
+        <enum value="0x00000002"    name="GLX_PIXMAP_BIT"/>
+        <enum value="0x00000002"    name="GLX_PIXMAP_BIT_SGIX"/>
+        <enum value="0x00000004"    name="GLX_PBUFFER_BIT"/>
+        <enum value="0x00000004"    name="GLX_PBUFFER_BIT_SGIX"/>
+    </enums>
+
+    <enums namespace="GLXRenderTypeMask" type="bitmask" comment="RENDER_TYPE bits">
+        <enum value="0x00000001"    name="GLX_RGBA_BIT"/>
+        <enum value="0x00000001"    name="GLX_RGBA_BIT_SGIX"/>
+        <enum value="0x00000002"    name="GLX_COLOR_INDEX_BIT"/>
+        <enum value="0x00000002"    name="GLX_COLOR_INDEX_BIT_SGIX"/>
+        <enum value="0x00000004"    name="GLX_RGBA_FLOAT_BIT_ARB"/>
+        <enum value="0x00000008"    name="GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT"/>
+    </enums>
+
+    <enums namespace="GLXSyncType" type="bitmask" comment="ChannelRectSyncSGIX bits">
+        <enum value="0x00000000"    name="GLX_SYNC_FRAME_SGIX"/>
+        <enum value="0x00000001"    name="GLX_SYNC_SWAP_SGIX"/>
+    </enums>
+
+    <enums namespace="GLXEventMask" type="bitmask" comment="SelectEvent mask">
+        <enum value="0x00000001"    name="GLX_STEREO_NOTIFY_MASK_EXT"/>
+        <enum value="0x04000000"    name="GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK"/>
+        <enum value="0x08000000"    name="GLX_PBUFFER_CLOBBER_MASK"/>
+        <enum value="0x08000000"    name="GLX_BUFFER_CLOBBER_MASK_SGIX"/>
+    </enums>
+
+    <enums namespace="GLXPbufferClobberMask" type="bitmask">
+        <enum value="0x00000001"    name="GLX_FRONT_LEFT_BUFFER_BIT"/>
+        <enum value="0x00000001"    name="GLX_FRONT_LEFT_BUFFER_BIT_SGIX"/>
+        <enum value="0x00000002"    name="GLX_FRONT_RIGHT_BUFFER_BIT"/>
+        <enum value="0x00000002"    name="GLX_FRONT_RIGHT_BUFFER_BIT_SGIX"/>
+        <enum value="0x00000004"    name="GLX_BACK_LEFT_BUFFER_BIT"/>
+        <enum value="0x00000004"    name="GLX_BACK_LEFT_BUFFER_BIT_SGIX"/>
+        <enum value="0x00000008"    name="GLX_BACK_RIGHT_BUFFER_BIT"/>
+        <enum value="0x00000008"    name="GLX_BACK_RIGHT_BUFFER_BIT_SGIX"/>
+        <enum value="0x00000010"    name="GLX_AUX_BUFFERS_BIT"/>
+        <enum value="0x00000010"    name="GLX_AUX_BUFFERS_BIT_SGIX"/>
+        <enum value="0x00000020"    name="GLX_DEPTH_BUFFER_BIT"/>
+        <enum value="0x00000020"    name="GLX_DEPTH_BUFFER_BIT_SGIX"/>
+        <enum value="0x00000040"    name="GLX_STENCIL_BUFFER_BIT"/>
+        <enum value="0x00000040"    name="GLX_STENCIL_BUFFER_BIT_SGIX"/>
+        <enum value="0x00000080"    name="GLX_ACCUM_BUFFER_BIT"/>
+        <enum value="0x00000080"    name="GLX_ACCUM_BUFFER_BIT_SGIX"/>
+        <enum value="0x00000100"    name="GLX_SAMPLE_BUFFERS_BIT_SGIX"/>
+    </enums>
+
+    <enums namespace="GLXHyperpipeTypeMask" type="bitmask">
+        <enum value="0x00000001"    name="GLX_HYPERPIPE_DISPLAY_PIPE_SGIX"/>
+        <enum value="0x00000002"    name="GLX_HYPERPIPE_RENDER_PIPE_SGIX"/>
+    </enums>
+
+    <enums namespace="GLXHyperpipeAttribSGIX" type="bitmask">
+        <enum value="0x00000001"    name="GLX_PIPE_RECT_SGIX"/>
+        <enum value="0x00000002"    name="GLX_PIPE_RECT_LIMITS_SGIX"/>
+        <enum value="0x00000003"    name="GLX_HYPERPIPE_STEREO_SGIX"/>
+        <enum value="0x00000004"    name="GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX"/>
+    </enums>
+
+    <enums namespace="GLXBindToTextureTargetMask" type="bitmask">
+        <enum value="0x00000001"    name="GLX_TEXTURE_1D_BIT_EXT"/>
+        <enum value="0x00000002"    name="GLX_TEXTURE_2D_BIT_EXT"/>
+        <enum value="0x00000004"    name="GLX_TEXTURE_RECTANGLE_BIT_EXT"/>
+    </enums>
+
+    <enums namespace="GLXContextFlags" type="bitmask" comment="CONTEXT_FLAGS_ARB bits (shared with WGL/GL)">
+        <enum value="0x00000001"    name="GLX_CONTEXT_DEBUG_BIT_ARB"/>
+        <enum value="0x00000002"    name="GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB"/>
+        <enum value="0x00000004"    name="GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB"/>
+        <enum value="0x00000008"    name="GLX_CONTEXT_RESET_ISOLATION_BIT_ARB"/>
+    </enums>
+
+    <enums namespace="GLXContextProfileMask" type="bitmask" comment="CONTEXT_PROFILE_MASK_ARB bits">
+        <enum value="0x00000001"    name="GLX_CONTEXT_CORE_PROFILE_BIT_ARB"/>
+        <enum value="0x00000002"    name="GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB"/>
+        <enum value="0x00000004"    name="GLX_CONTEXT_ES_PROFILE_BIT_EXT"/>
+        <enum value="0x00000004"    name="GLX_CONTEXT_ES2_PROFILE_BIT_EXT" alias="GLX_CONTEXT_ES_PROFILE_BIT_EXT"/>
+    </enums>
+
+    <enums namespace="GLXHyperpipeMiscSGIX">
+        <enum value="80"            name="GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX"/>
+    </enums>
+
+
+    <enums namespace="GLX" start="0x0000" end="0x2FFF" vendor="ARB"           comment="Miscellaneous OpenGL 1.0/1.1 enums. Most parts of this range are unused and should remain unused."/>
+
+    <enums namespace="GLX" group="SpecialNumbers"  vendor="ARB" comment="Tokens whose numeric value is intrinsically meaningful">
+        <enum value="0"             name="GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB"/>
+        <enum value="0xFFFFFFFF"    name="GLX_DONT_CARE"                            comment="For ChooseFBConfig attributes"/>
+    </enums>
+
+    <enums namespace="GLX" group="GLXAttribute" vendor="ARB" comment="Visual attributes">
+        <enum value="1"             name="GLX_USE_GL"/>
+        <enum value="2"             name="GLX_BUFFER_SIZE"/>
+        <enum value="3"             name="GLX_LEVEL"/>
+        <enum value="4"             name="GLX_RGBA"/>
+        <enum value="5"             name="GLX_DOUBLEBUFFER"/>
+        <enum value="6"             name="GLX_STEREO"/>
+        <enum value="7"             name="GLX_AUX_BUFFERS"/>
+        <enum value="8"             name="GLX_RED_SIZE"/>
+        <enum value="9"             name="GLX_GREEN_SIZE"/>
+        <enum value="10"            name="GLX_BLUE_SIZE"/>
+        <enum value="11"            name="GLX_ALPHA_SIZE"/>
+        <enum value="12"            name="GLX_DEPTH_SIZE"/>
+        <enum value="13"            name="GLX_STENCIL_SIZE"/>
+        <enum value="14"            name="GLX_ACCUM_RED_SIZE"/>
+        <enum value="15"            name="GLX_ACCUM_GREEN_SIZE"/>
+        <enum value="16"            name="GLX_ACCUM_BLUE_SIZE"/>
+        <enum value="17"            name="GLX_ACCUM_ALPHA_SIZE"/>
+            <unused start="18" end="0x1F"/>
+        <enum value="0x20"          name="GLX_CONFIG_CAVEAT"/>
+        <enum value="0x20"          name="GLX_VISUAL_CAVEAT_EXT"/>
+        <enum value="0x22"          name="GLX_X_VISUAL_TYPE"/>
+        <enum value="0x22"          name="GLX_X_VISUAL_TYPE_EXT"/>
+        <enum value="0x23"          name="GLX_TRANSPARENT_TYPE"/>
+        <enum value="0x23"          name="GLX_TRANSPARENT_TYPE_EXT"/>
+        <enum value="0x24"          name="GLX_TRANSPARENT_INDEX_VALUE"/>
+        <enum value="0x24"          name="GLX_TRANSPARENT_INDEX_VALUE_EXT"/>
+        <enum value="0x25"          name="GLX_TRANSPARENT_RED_VALUE"/>
+        <enum value="0x25"          name="GLX_TRANSPARENT_RED_VALUE_EXT"/>
+        <enum value="0x26"          name="GLX_TRANSPARENT_GREEN_VALUE"/>
+        <enum value="0x26"          name="GLX_TRANSPARENT_GREEN_VALUE_EXT"/>
+        <enum value="0x27"          name="GLX_TRANSPARENT_BLUE_VALUE"/>
+        <enum value="0x27"          name="GLX_TRANSPARENT_BLUE_VALUE_EXT"/>
+        <enum value="0x28"          name="GLX_TRANSPARENT_ALPHA_VALUE"/>
+        <enum value="0x28"          name="GLX_TRANSPARENT_ALPHA_VALUE_EXT"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x1F00" end="0x1F02" vendor="AMD" comment="Equivalent to corresponding WGL/GL tokens">
+        <enum value="0x1F00"        name="GLX_GPU_VENDOR_AMD"/>
+        <enum value="0x1F01"        name="GLX_GPU_RENDERER_STRING_AMD"/>
+        <enum value="0x1F02"        name="GLX_GPU_OPENGL_VERSION_STRING_AMD"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x2070" end="0x209F" vendor="ARB" comment="Shared with WGL; synchronize create_context enums">
+        <enum value="0x2091"        name="GLX_CONTEXT_MAJOR_VERSION_ARB"/>
+        <enum value="0x2092"        name="GLX_CONTEXT_MINOR_VERSION_ARB"/>
+            <!-- 0x2093 used for WGL_CONTEXT_LAYER_PLANE_ARB -->
+        <enum value="0x2094"        name="GLX_CONTEXT_FLAGS_ARB"/>
+            <!-- 0x2095 collides with WGL_ERROR_INVALID_VERSION_ARB! -->
+        <enum value="0x2095"        name="GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB"/>
+            <!-- 0x2096 used for WGL_ERROR_INVALID_PROFILE_ARB -->
+        <enum value="0x2097"        name="GLX_CONTEXT_RELEASE_BEHAVIOR_ARB"/>
+        <enum value="0x2098"        name="GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB"/>
+            <unused start="0x2099" end="0x209F"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x20A0" end="0x219F" vendor="NV" comment="Shared with WGL">
+        <enum value="0x20B0"        name="GLX_FLOAT_COMPONENTS_NV"/>
+        <enum value="0x20B1"        name="GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT"/>
+        <enum value="0x20B2"        name="GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB"/>
+        <enum value="0x20B2"        name="GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT"/>
+        <enum value="0x20B3"        name="GLX_COLOR_SAMPLES_NV"/>
+            <unused start="0x20B4" end="0x20B8"/>
+        <enum value="0x20B9"        name="GLX_RGBA_FLOAT_TYPE_ARB"/>
+            <unused start="0x20BA" end="0x20C2"/>
+        <enum value="0x20C3"        name="GLX_VIDEO_OUT_COLOR_NV"/>
+        <enum value="0x20C4"        name="GLX_VIDEO_OUT_ALPHA_NV"/>
+        <enum value="0x20C5"        name="GLX_VIDEO_OUT_DEPTH_NV"/>
+        <enum value="0x20C6"        name="GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV"/>
+        <enum value="0x20C7"        name="GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV"/>
+        <enum value="0x20C8"        name="GLX_VIDEO_OUT_FRAME_NV"/>
+        <enum value="0x20C9"        name="GLX_VIDEO_OUT_FIELD_1_NV"/>
+        <enum value="0x20CA"        name="GLX_VIDEO_OUT_FIELD_2_NV"/>
+        <enum value="0x20CB"        name="GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV"/>
+        <enum value="0x20CC"        name="GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV"/>
+        <enum value="0x20CD"        name="GLX_DEVICE_ID_NV"/>
+        <enum value="0x20CE"        name="GLX_UNIQUE_ID_NV"/>
+        <enum value="0x20CF"        name="GLX_NUM_VIDEO_CAPTURE_SLOTS_NV"/>
+        <enum value="0x20D0"        name="GLX_BIND_TO_TEXTURE_RGB_EXT"/>
+        <enum value="0x20D1"        name="GLX_BIND_TO_TEXTURE_RGBA_EXT"/>
+        <enum value="0x20D2"        name="GLX_BIND_TO_MIPMAP_TEXTURE_EXT"/>
+        <enum value="0x20D3"        name="GLX_BIND_TO_TEXTURE_TARGETS_EXT"/>
+        <enum value="0x20D4"        name="GLX_Y_INVERTED_EXT"/>
+        <enum value="0x20D5"        name="GLX_TEXTURE_FORMAT_EXT"/>
+        <enum value="0x20D6"        name="GLX_TEXTURE_TARGET_EXT"/>
+        <enum value="0x20D7"        name="GLX_MIPMAP_TEXTURE_EXT"/>
+        <enum value="0x20D8"        name="GLX_TEXTURE_FORMAT_NONE_EXT"/>
+        <enum value="0x20D9"        name="GLX_TEXTURE_FORMAT_RGB_EXT"/>
+        <enum value="0x20DA"        name="GLX_TEXTURE_FORMAT_RGBA_EXT"/>
+        <enum value="0x20DB"        name="GLX_TEXTURE_1D_EXT"/>
+        <enum value="0x20DC"        name="GLX_TEXTURE_2D_EXT"/>
+        <enum value="0x20DD"        name="GLX_TEXTURE_RECTANGLE_EXT"/>
+        <enum value="0x20DE"        name="GLX_FRONT_LEFT_EXT"/>
+        <enum value="0x20DF"        name="GLX_FRONT_RIGHT_EXT"/>
+        <enum value="0x20E0"        name="GLX_BACK_LEFT_EXT"/>
+        <enum value="0x20E1"        name="GLX_BACK_RIGHT_EXT"/>
+        <enum value="0x20DE"        name="GLX_FRONT_EXT"    alias="GLX_FRONT_LEFT_EXT"/>
+        <enum value="0x20E0"        name="GLX_BACK_EXT"     alias="GLX_BACK_LEFT_EXT"/>
+        <enum value="0x20E2"        name="GLX_AUX0_EXT"/>
+        <enum value="0x20E3"        name="GLX_AUX1_EXT"/>
+        <enum value="0x20E4"        name="GLX_AUX2_EXT"/>
+        <enum value="0x20E5"        name="GLX_AUX3_EXT"/>
+        <enum value="0x20E6"        name="GLX_AUX4_EXT"/>
+        <enum value="0x20E7"        name="GLX_AUX5_EXT"/>
+        <enum value="0x20E8"        name="GLX_AUX6_EXT"/>
+        <enum value="0x20E9"        name="GLX_AUX7_EXT"/>
+        <enum value="0x20EA"        name="GLX_AUX8_EXT"/>
+        <enum value="0x20EB"        name="GLX_AUX9_EXT"/>
+            <unused start="0x20EC" end="0x20EF"/>
+        <enum value="0x20F0"        name="GLX_NUM_VIDEO_SLOTS_NV"/>
+        <enum value="0x20F1"        name="GLX_SWAP_INTERVAL_EXT"/>
+        <enum value="0x20F2"        name="GLX_MAX_SWAP_INTERVAL_EXT"/>
+        <enum value="0x20F3"        name="GLX_LATE_SWAPS_TEAR_EXT"/>
+        <enum value="0x20F4"        name="GLX_BACK_BUFFER_AGE_EXT"/>
+        <enum value="0x20F5"        name="GLX_STEREO_TREE_EXT"/>
+            <unused start="0x20F6" end="0x219F"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x21A0" end="0x21AF" vendor="AMD" comment="Shared with WGL; synchronize create_context enums">
+            <unused start="0x21A0" end="0x21A1" comment="used by WGL extensions"/>
+        <enum value="0x21A2"        name="GLX_GPU_FASTEST_TARGET_GPUS_AMD"/>
+        <enum value="0x21A3"        name="GLX_GPU_RAM_AMD"/>
+        <enum value="0x21A4"        name="GLX_GPU_CLOCK_AMD"/>
+        <enum value="0x21A5"        name="GLX_GPU_NUM_PIPES_AMD"/>
+        <enum value="0x21A6"        name="GLX_GPU_NUM_SIMD_AMD"/>
+        <enum value="0x21A7"        name="GLX_GPU_NUM_RB_AMD"/>
+        <enum value="0x21A8"        name="GLX_GPU_NUM_SPI_AMD"/>
+            <unused start="0x21A9" end="0x21AF"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x8000" end="0x804F" vendor="ARB">
+        <enum value="0x8000"        name="GLX_NONE"                                 comment="Attribute value"/>
+        <enum value="0x8001"        name="GLX_SLOW_CONFIG"                          comment="CONFIG_CAVEAT attribute value"/>
+        <enum value="0x8002"        name="GLX_TRUE_COLOR"                           comment="X_VISUAL_TYPE attribute value"/>
+        <enum value="0x8003"        name="GLX_DIRECT_COLOR"                         comment="X_VISUAL_TYPE attribute value"/>
+        <enum value="0x8004"        name="GLX_PSEUDO_COLOR"                         comment="X_VISUAL_TYPE attribute value"/>
+        <enum value="0x8005"        name="GLX_STATIC_COLOR"                         comment="X_VISUAL_TYPE attribute value"/>
+        <enum value="0x8006"        name="GLX_GRAY_SCALE"                           comment="X_VISUAL_TYPE attribute value"/>
+        <enum value="0x8007"        name="GLX_STATIC_GRAY"                          comment="X_VISUAL_TYPE attribute value"/>
+        <enum value="0x8008"        name="GLX_TRANSPARENT_RGB"                      comment="TRANSPARENT_TYPE attribute value"/>
+        <enum value="0x8009"        name="GLX_TRANSPARENT_INDEX"                    comment="TRANSPARENT_TYPE attribute value"/>
+        <enum value="0x800B"        name="GLX_VISUAL_ID"                            comment="Context attribute"/>
+        <enum value="0x800C"        name="GLX_SCREEN"                               comment="Context attribute"/>
+        <enum value="0x800D"        name="GLX_NON_CONFORMANT_CONFIG"                comment="CONFIG_CAVEAT attribute value"/>
+        <enum value="0x8010"        name="GLX_DRAWABLE_TYPE"                        comment="FBConfig attribute"/>
+        <enum value="0x8011"        name="GLX_RENDER_TYPE"                          comment="FBConfig attribute"/>
+        <enum value="0x8012"        name="GLX_X_RENDERABLE"                         comment="FBConfig attribute"/>
+        <enum value="0x8013"        name="GLX_FBCONFIG_ID"                          comment="FBConfig attribute"/>
+        <enum value="0x8014"        name="GLX_RGBA_TYPE"                            comment="CreateNewContext render_type value"/>
+        <enum value="0x8015"        name="GLX_COLOR_INDEX_TYPE"                     comment="CreateNewContext render_type value"/>
+        <enum value="0x8016"        name="GLX_MAX_PBUFFER_WIDTH"                    comment="FBConfig attribute"/>
+        <enum value="0x8017"        name="GLX_MAX_PBUFFER_HEIGHT"                   comment="FBConfig attribute"/>
+        <enum value="0x8018"        name="GLX_MAX_PBUFFER_PIXELS"                   comment="FBConfig attribute"/>
+        <enum value="0x801B"        name="GLX_PRESERVED_CONTENTS"                   comment="CreateGLXPbuffer attribute"/>
+        <enum value="0x801C"        name="GLX_LARGEST_PBUFFER"                      comment="CreateGLXPbuffer attribute"/>
+        <enum value="0x801D"        name="GLX_WIDTH"                                comment="Drawable attribute"/>
+        <enum value="0x801E"        name="GLX_HEIGHT"                               comment="Drawable attribute"/>
+        <enum value="0x801F"        name="GLX_EVENT_MASK"                           comment="Drawable attribute"/>
+        <enum value="0x8020"        name="GLX_DAMAGED"                              comment="PbufferClobber event_type value"/>
+        <enum value="0x8021"        name="GLX_SAVED"                                comment="PbufferClobber event_type value"/>
+        <enum value="0x8022"        name="GLX_WINDOW"                               comment="PbufferClobber draw_type value"/>
+        <enum value="0x8023"        name="GLX_PBUFFER"                              comment="PbufferClobber draw_type value"/>
+        <enum value="0x8000"        name="GLX_NONE_EXT"                             comment="several EXT attribute values"/>
+        <enum value="0x8001"        name="GLX_SLOW_VISUAL_EXT"                      comment="VISUAL_CAVEAT_EXT attribute value"/>
+        <enum value="0x8002"        name="GLX_TRUE_COLOR_EXT"                       comment="X_VISUAL_TYPE_EXT attribute value"/>
+        <enum value="0x8003"        name="GLX_DIRECT_COLOR_EXT"                     comment="X_VISUAL_TYPE_EXT attribute value"/>
+        <enum value="0x8004"        name="GLX_PSEUDO_COLOR_EXT"                     comment="X_VISUAL_TYPE_EXT attribute value"/>
+        <enum value="0x8005"        name="GLX_STATIC_COLOR_EXT"                     comment="X_VISUAL_TYPE_EXT attribute value"/>
+        <enum value="0x8006"        name="GLX_GRAY_SCALE_EXT"                       comment="X_VISUAL_TYPE_EXT attribute value"/>
+        <enum value="0x8007"        name="GLX_STATIC_GRAY_EXT"                      comment="X_VISUAL_TYPE_EXT attribute value"/>
+        <enum value="0x8008"        name="GLX_TRANSPARENT_RGB_EXT"                  comment="TRANSPARENT_TYPE_EXT attribute value"/>
+        <enum value="0x8009"        name="GLX_TRANSPARENT_INDEX_EXT"                comment="TRANSPARENT_TYPE_EXT attribute value"/>
+        <enum value="0x800A"        name="GLX_SHARE_CONTEXT_EXT"                    comment="QueryContextInfoEXT attribute"/>
+        <enum value="0x800B"        name="GLX_VISUAL_ID_EXT"                        comment="QueryContextInfoEXT attribute"/>
+        <enum value="0x800C"        name="GLX_SCREEN_EXT"                           comment="QueryContextInfoEXT attribute"/>
+        <enum value="0x800D"        name="GLX_NON_CONFORMANT_VISUAL_EXT"            comment="VISUAL_CAVEAT_EXT attribute value"/>
+        <enum value="0x8010"        name="GLX_DRAWABLE_TYPE_SGIX"                   comment="FBConfigSGIX attribute"/>
+        <enum value="0x8011"        name="GLX_RENDER_TYPE_SGIX"                     comment="FBConfigSGIX attribute"/>
+        <enum value="0x8012"        name="GLX_X_RENDERABLE_SGIX"                    comment="FBConfigSGIX attribute"/>
+        <enum value="0x8013"        name="GLX_FBCONFIG_ID_SGIX"                     comment="FBConfigSGIX attribute"/>
+        <enum value="0x8014"        name="GLX_RGBA_TYPE_SGIX"                       comment="CreateContextWithConfigSGIX render_type value"/>
+        <enum value="0x8015"        name="GLX_COLOR_INDEX_TYPE_SGIX"                comment="CreateContextWithConfigSGIX render_type value"/>
+        <enum value="0x8016"        name="GLX_MAX_PBUFFER_WIDTH_SGIX"               comment="FBConfigSGIX attribute"/>
+        <enum value="0x8017"        name="GLX_MAX_PBUFFER_HEIGHT_SGIX"              comment="FBConfigSGIX attribute"/>
+        <enum value="0x8018"        name="GLX_MAX_PBUFFER_PIXELS_SGIX"              comment="FBConfigSGIX attribute"/>
+        <enum value="0x8019"        name="GLX_OPTIMAL_PBUFFER_WIDTH_SGIX"           comment="FBConfigSGIX attribute"/>
+        <enum value="0x801A"        name="GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX"          comment="FBConfigSGIX attribute"/>
+        <enum value="0x801B"        name="GLX_PRESERVED_CONTENTS_SGIX"              comment="PbufferSGIX attribute"/>
+        <enum value="0x801C"        name="GLX_LARGEST_PBUFFER_SGIX"                 comment="PbufferSGIX attribute"/>
+        <enum value="0x801D"        name="GLX_WIDTH_SGIX"                           comment="PbufferSGIX attribute"/>
+        <enum value="0x801E"        name="GLX_HEIGHT_SGIX"                          comment="PbufferSGIX attribute"/>
+        <enum value="0x801F"        name="GLX_EVENT_MASK_SGIX"                      comment="PbufferSGIX attribute"/>
+        <enum value="0x8020"        name="GLX_DAMAGED_SGIX"                         comment="BufferClobberSGIX event_type value"/>
+        <enum value="0x8021"        name="GLX_SAVED_SGIX"                           comment="BufferClobberSGIX event_type value"/>
+        <enum value="0x8022"        name="GLX_WINDOW_SGIX"                          comment="BufferClobberSGIX draw_type value"/>
+        <enum value="0x8023"        name="GLX_PBUFFER_SGIX"                         comment="BufferClobberSGIX draw_type value"/>
+        <enum value="0x8024"        name="GLX_DIGITAL_MEDIA_PBUFFER_SGIX"           comment="PbufferSGIX attribute"/>
+        <enum value="0x8025"        name="GLX_BLENDED_RGBA_SGIS"                    comment="TRANSPARENT_TYPE_EXT attribute value"/>
+        <enum value="0x8026"        name="GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS"      comment="Visual attribute (shared_multisample)"/>
+        <enum value="0x8027"        name="GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS"     comment="Visual attribute (shared_multisample)"/>
+        <enum value="0x8028"        name="GLX_VISUAL_SELECT_GROUP_SGIX"             comment="Visual attribute (visual_select_group)"/>
+            <unused start="0x8029" end="0x802F"/>
+        <enum value="0x8030"        name="GLX_HYPERPIPE_ID_SGIX"/>
+            <unused start="0x8031" end="0x803F"/>
+        <enum value="0x8040"        name="GLX_PBUFFER_HEIGHT"                       comment="CreateGLXPbuffer attribute"/>
+        <enum value="0x8041"        name="GLX_PBUFFER_WIDTH"                        comment="CreateGLXPbuffer attribute"/>
+            <unused start="0x8042" end="0x804F"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x8050" end="0x804F" vendor="3DFX">
+        <enum value="0x8050"        name="GLX_SAMPLE_BUFFERS_3DFX"/>
+        <enum value="0x8051"        name="GLX_SAMPLES_3DFX"/>
+            <unused start="0x8052" end="0x805F"/>
+    </enums>
+
+
+    <enums namespace="GLX" start="0x8060" end="0x806F" vendor="OML">
+        <enum value="0x8060"        name="GLX_SWAP_METHOD_OML"/>
+        <enum value="0x8061"        name="GLX_SWAP_EXCHANGE_OML"/>
+        <enum value="0x8062"        name="GLX_SWAP_COPY_OML"/>
+        <enum value="0x8063"        name="GLX_SWAP_UNDEFINED_OML"/>
+            <unused start="0x8064" end="0x806F"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x8070" end="0x816F" vendor="NV">
+            <unused start="0x8070" end="0x816F"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x8170" end="0x817F" vendor="SUN">
+            <unused start="0x8170" end="0x817F"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x8180" end="0x818F" vendor="INTEL">
+        <enum value="0x8180"        name="GLX_EXCHANGE_COMPLETE_INTEL"/>
+        <enum value="0x8181"        name="GLX_COPY_COMPLETE_INTEL"/>
+        <enum value="0x8182"        name="GLX_FLIP_COMPLETE_INTEL"/>
+        <enum value="0x8183"        name="GLX_RENDERER_VENDOR_ID_MESA"/>
+        <enum value="0x8184"        name="GLX_RENDERER_DEVICE_ID_MESA"/>
+        <enum value="0x8185"        name="GLX_RENDERER_VERSION_MESA"/>
+        <enum value="0x8186"        name="GLX_RENDERER_ACCELERATED_MESA"/>
+        <enum value="0x8187"        name="GLX_RENDERER_VIDEO_MEMORY_MESA"/>
+        <enum value="0x8188"        name="GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA"/>
+        <enum value="0x8189"        name="GLX_RENDERER_PREFERRED_PROFILE_MESA"/>
+        <enum value="0x818A"        name="GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA"/>
+        <enum value="0x818B"        name="GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA"/>
+        <enum value="0x818C"        name="GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA"/>
+        <enum value="0x818D"        name="GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA"/>
+        <enum value="0x818E"        name="GLX_RENDERER_ID_MESA"/>
+            <unused start="0x818F"/>
+    </enums>
+
+<!-- Please remember that new enumerant allocations must be obtained by
+     request to the Khronos API registrar (see comments at the top of this
+     file) File requests in the Khronos Bugzilla, OpenGL project, Registry
+     component. Also note that some GLX enum values are shared with GL and
+     WGL, and new ranges should be allocated with such overlaps in mind. -->
+
+    <enums namespace="GLX" start="0x8190" end="0x824F" vendor="ARB">
+            <unused start="0x8190" end="0x824F" comment="Reserved for future use. Reserve enums in blocks of 16 from the start."/>
+    </enums>
+
+    <enums namespace="GL" start="0x8250" end="0x826F" vendor="ARB" comment="Values shared with GL. Do not allocate additional values in this range.">
+        <enum value="0x8252"        name="GLX_LOSE_CONTEXT_ON_RESET_ARB"/>
+        <enum value="0x8256"        name="GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB"/>
+        <enum value="0x8261"        name="GLX_NO_RESET_NOTIFICATION_ARB"/>
+    </enums>
+
+    <enums namespace="GLX" start="0x8270" end="99999"  vendor="ARB" comment="RESERVED FOR FUTURE ALLOCATIONS BY KHRONOS">
+            <unused start="0x8270" end="0x9125"/>
+        <enum value="0x9126"        name="GLX_CONTEXT_PROFILE_MASK_ARB" comment="Value shared with GL"/>
+            <unused start="0x9127" end="99999"/>
+    </enums>
+
+    <enums namespace="GLX" start="100000" end="100001" vendor="ARB" comment="Visual attributes for multisampling. Historical range only; do not allocate new values in this space.">
+        <enum value="100000"        name="GLX_SAMPLE_BUFFERS"/>
+        <enum value="100000"        name="GLX_SAMPLE_BUFFERS_ARB"/>
+        <enum value="100000"        name="GLX_SAMPLE_BUFFERS_SGIS"/>
+        <enum value="100001"        name="GLX_SAMPLES"/>
+        <enum value="100001"        name="GLX_SAMPLES_ARB"/>
+        <enum value="100001"        name="GLX_SAMPLES_SGIS"/>
+        <enum value="100001"        name="GLX_COVERAGE_SAMPLES_NV"/>
+    </enums>
+
+
+    <!-- SECTION: GLX command definitions. -->
+    <commands namespace="GLX">
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXAssociateDMPbufferSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXPbufferSGIX</ptype> <name>pbuffer</name></param>
+            <param><ptype>DMparams</ptype> *<name>params</name></param>
+            <param><ptype>DMbuffer</ptype> <name>dmbuffer</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXBindChannelToWindowSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>display</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>channel</name></param>
+            <param><ptype>Window</ptype> <name>window</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXBindHyperpipeSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>hpId</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXBindSwapBarrierNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLuint</ptype> <name>group</name></param>
+            <param><ptype>GLuint</ptype> <name>barrier</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXBindSwapBarrierSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param>int <name>barrier</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXBindTexImageEXT</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param>int <name>buffer</name></param>
+            <param>const int *<name>attrib_list</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXBindVideoCaptureDeviceNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>unsigned int <name>video_capture_slot</name></param>
+            <param><ptype>GLXVideoCaptureDeviceNV</ptype> <name>device</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXBindVideoDeviceNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>unsigned int <name>video_slot</name></param>
+            <param>unsigned int <name>video_device</name></param>
+            <param>const int *<name>attrib_list</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXBindVideoImageNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXVideoDeviceNV</ptype> <name>VideoDevice</name></param>
+            <param><ptype>GLXPbuffer</ptype> <name>pbuf</name></param>
+            <param>int <name>iVideoBuffer</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXBlitContextFramebufferAMD</name></proto>
+            <param><ptype>GLXContext</ptype> <name>dstCtx</name></param>
+            <param><ptype>GLint</ptype> <name>srcX0</name></param>
+            <param><ptype>GLint</ptype> <name>srcY0</name></param>
+            <param><ptype>GLint</ptype> <name>srcX1</name></param>
+            <param><ptype>GLint</ptype> <name>srcY1</name></param>
+            <param><ptype>GLint</ptype> <name>dstX0</name></param>
+            <param><ptype>GLint</ptype> <name>dstY0</name></param>
+            <param><ptype>GLint</ptype> <name>dstX1</name></param>
+            <param><ptype>GLint</ptype> <name>dstY1</name></param>
+            <param><ptype>GLbitfield</ptype> <name>mask</name></param>
+            <param><ptype>GLenum</ptype> <name>filter</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXChannelRectSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>display</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>channel</name></param>
+            <param>int <name>x</name></param>
+            <param>int <name>y</name></param>
+            <param>int <name>w</name></param>
+            <param>int <name>h</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXChannelRectSyncSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>display</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>channel</name></param>
+            <param><ptype>GLenum</ptype> <name>synctype</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXFBConfig</ptype> *<name>glXChooseFBConfig</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>const int *<name>attrib_list</name></param>
+            <param>int *<name>nelements</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXFBConfigSGIX</ptype> *<name>glXChooseFBConfigSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int *<name>attrib_list</name></param>
+            <param>int *<name>nelements</name></param>
+        </command>
+        <command>
+            <proto><ptype>XVisualInfo</ptype> *<name>glXChooseVisual</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int *<name>attribList</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXCopyBufferSubDataNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>readCtx</name></param>
+            <param><ptype>GLXContext</ptype> <name>writeCtx</name></param>
+            <param><ptype>GLenum</ptype> <name>readTarget</name></param>
+            <param><ptype>GLenum</ptype> <name>writeTarget</name></param>
+            <param><ptype>GLintptr</ptype> <name>readOffset</name></param>
+            <param><ptype>GLintptr</ptype> <name>writeOffset</name></param>
+            <param><ptype>GLsizeiptr</ptype> <name>size</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXNamedCopyBufferSubDataNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>readCtx</name></param>
+            <param><ptype>GLXContext</ptype> <name>writeCtx</name></param>
+            <param><ptype>GLuint</ptype> <name>readBuffer</name></param>
+            <param><ptype>GLuint</ptype> <name>writeBuffer</name></param>
+            <param><ptype>GLintptr</ptype> <name>readOffset</name></param>
+            <param><ptype>GLintptr</ptype> <name>writeOffset</name></param>
+            <param><ptype>GLsizeiptr</ptype> <name>size</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXCopyContext</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>src</name></param>
+            <param><ptype>GLXContext</ptype> <name>dst</name></param>
+            <param>unsigned long <name>mask</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXCopyImageSubDataNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>srcCtx</name></param>
+            <param><ptype>GLuint</ptype> <name>srcName</name></param>
+            <param><ptype>GLenum</ptype> <name>srcTarget</name></param>
+            <param><ptype>GLint</ptype> <name>srcLevel</name></param>
+            <param><ptype>GLint</ptype> <name>srcX</name></param>
+            <param><ptype>GLint</ptype> <name>srcY</name></param>
+            <param><ptype>GLint</ptype> <name>srcZ</name></param>
+            <param><ptype>GLXContext</ptype> <name>dstCtx</name></param>
+            <param><ptype>GLuint</ptype> <name>dstName</name></param>
+            <param><ptype>GLenum</ptype> <name>dstTarget</name></param>
+            <param><ptype>GLint</ptype> <name>dstLevel</name></param>
+            <param><ptype>GLint</ptype> <name>dstX</name></param>
+            <param><ptype>GLint</ptype> <name>dstY</name></param>
+            <param><ptype>GLint</ptype> <name>dstZ</name></param>
+            <param><ptype>GLsizei</ptype> <name>width</name></param>
+            <param><ptype>GLsizei</ptype> <name>height</name></param>
+            <param><ptype>GLsizei</ptype> <name>depth</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXCopySubBufferMESA</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param>int <name>x</name></param>
+            <param>int <name>y</name></param>
+            <param>int <name>width</name></param>
+            <param>int <name>height</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXCreateAssociatedContextAMD</name></proto>
+            <param>unsigned int <name>id</name></param>
+            <param><ptype>GLXContext</ptype> <name>share_list</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXCreateAssociatedContextAttribsAMD</name></proto>
+            <param>unsigned int <name>id</name></param>
+            <param><ptype>GLXContext</ptype> <name>share_context</name></param>
+            <param>const int *<name>attribList</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXCreateContextAttribsARB</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfig</ptype> <name>config</name></param>
+            <param><ptype>GLXContext</ptype> <name>share_context</name></param>
+            <param><ptype>Bool</ptype> <name>direct</name></param>
+            <param>const int *<name>attrib_list</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXCreateContext</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>XVisualInfo</ptype> *<name>vis</name></param>
+            <param><ptype>GLXContext</ptype> <name>shareList</name></param>
+            <param><ptype>Bool</ptype> <name>direct</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXCreateContextWithConfigSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfigSGIX</ptype> <name>config</name></param>
+            <param>int <name>render_type</name></param>
+            <param><ptype>GLXContext</ptype> <name>share_list</name></param>
+            <param><ptype>Bool</ptype> <name>direct</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXPbufferSGIX</ptype> <name>glXCreateGLXPbufferSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfigSGIX</ptype> <name>config</name></param>
+            <param>unsigned int <name>width</name></param>
+            <param>unsigned int <name>height</name></param>
+            <param>int *<name>attrib_list</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXPixmap</ptype> <name>glXCreateGLXPixmap</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>XVisualInfo</ptype> *<name>visual</name></param>
+            <param><ptype>Pixmap</ptype> <name>pixmap</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXPixmap</ptype> <name>glXCreateGLXPixmapMESA</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>XVisualInfo</ptype> *<name>visual</name></param>
+            <param><ptype>Pixmap</ptype> <name>pixmap</name></param>
+            <param><ptype>Colormap</ptype> <name>cmap</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXPixmap</ptype> <name>glXCreateGLXPixmapWithConfigSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfigSGIX</ptype> <name>config</name></param>
+            <param><ptype>Pixmap</ptype> <name>pixmap</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXVideoSourceSGIX</ptype> <name>glXCreateGLXVideoSourceSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>display</name></param>
+            <param>int <name>screen</name></param>
+            <param><ptype>VLServer</ptype> <name>server</name></param>
+            <param><ptype>VLPath</ptype> <name>path</name></param>
+            <param>int <name>nodeClass</name></param>
+            <param><ptype>VLNode</ptype> <name>drainNode</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXCreateNewContext</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfig</ptype> <name>config</name></param>
+            <param>int <name>render_type</name></param>
+            <param><ptype>GLXContext</ptype> <name>share_list</name></param>
+            <param><ptype>Bool</ptype> <name>direct</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXPbuffer</ptype> <name>glXCreatePbuffer</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfig</ptype> <name>config</name></param>
+            <param>const int *<name>attrib_list</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXPixmap</ptype> <name>glXCreatePixmap</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfig</ptype> <name>config</name></param>
+            <param><ptype>Pixmap</ptype> <name>pixmap</name></param>
+            <param>const int *<name>attrib_list</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXWindow</ptype> <name>glXCreateWindow</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfig</ptype> <name>config</name></param>
+            <param><ptype>Window</ptype> <name>win</name></param>
+            <param>const int *<name>attrib_list</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXCushionSGI</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>Window</ptype> <name>window</name></param>
+            <param>float <name>cushion</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXDelayBeforeSwapNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>GLfloat</ptype> <name>seconds</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXDeleteAssociatedContextAMD</name></proto>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXDestroyContext</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXDestroyGLXPbufferSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXPbufferSGIX</ptype> <name>pbuf</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXDestroyGLXPixmap</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXPixmap</ptype> <name>pixmap</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXDestroyGLXVideoSourceSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXVideoSourceSGIX</ptype> <name>glxvideosource</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXDestroyHyperpipeConfigSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>hpId</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXDestroyPbuffer</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXPbuffer</ptype> <name>pbuf</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXDestroyPixmap</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXPixmap</ptype> <name>pixmap</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXDestroyWindow</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXWindow</ptype> <name>win</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXVideoCaptureDeviceNV</ptype> *<name>glXEnumerateVideoCaptureDevicesNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int *<name>nelements</name></param>
+        </command>
+        <command>
+            <proto>unsigned int *<name>glXEnumerateVideoDevicesNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int *<name>nelements</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXFreeContextEXT</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>context</name></param>
+        </command>
+        <command>
+            <proto>unsigned int <name>glXGetAGPOffsetMESA</name></proto>
+            <param>const void *<name>pointer</name></param>
+        </command>
+        <command>
+            <proto>const char *<name>glXGetClientString</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>name</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXGetConfig</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>XVisualInfo</ptype> *<name>visual</name></param>
+            <param>int <name>attrib</name></param>
+            <param>int *<name>value</name></param>
+        </command>
+        <command>
+            <proto>unsigned int <name>glXGetContextGPUIDAMD</name></proto>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContextID</ptype> <name>glXGetContextIDEXT</name></proto>
+            <param>const <ptype>GLXContext</ptype> <name>context</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXGetCurrentAssociatedContextAMD</name></proto>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXGetCurrentContext</name></proto>
+        </command>
+        <command>
+            <proto><ptype>Display</ptype> *<name>glXGetCurrentDisplayEXT</name></proto>
+        </command>
+        <command>
+            <proto><ptype>Display</ptype> *<name>glXGetCurrentDisplay</name></proto>
+        </command>
+        <command>
+            <proto><ptype>GLXDrawable</ptype> <name>glXGetCurrentDrawable</name></proto>
+        </command>
+        <command>
+            <proto><ptype>GLXDrawable</ptype> <name>glXGetCurrentReadDrawableSGI</name></proto>
+        </command>
+        <command>
+            <proto><ptype>GLXDrawable</ptype> <name>glXGetCurrentReadDrawable</name></proto>
+        </command>
+        <command>
+            <proto>int <name>glXGetFBConfigAttrib</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfig</ptype> <name>config</name></param>
+            <param>int <name>attribute</name></param>
+            <param>int *<name>value</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXGetFBConfigAttribSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfigSGIX</ptype> <name>config</name></param>
+            <param>int <name>attribute</name></param>
+            <param>int *<name>value</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXFBConfigSGIX</ptype> <name>glXGetFBConfigFromVisualSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>XVisualInfo</ptype> *<name>vis</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXFBConfig</ptype> *<name>glXGetFBConfigs</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int *<name>nelements</name></param>
+        </command>
+        <command>
+            <proto>unsigned int <name>glXGetGPUIDsAMD</name></proto>
+            <param>unsigned int <name>maxCount</name></param>
+            <param>unsigned int *<name>ids</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXGetGPUInfoAMD</name></proto>
+            <param>unsigned int <name>id</name></param>
+            <param>int <name>property</name></param>
+            <param><ptype>GLenum</ptype> <name>dataType</name></param>
+            <param>unsigned int <name>size</name></param>
+            <param>void *<name>data</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXGetMscRateOML</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>int32_t</ptype> *<name>numerator</name></param>
+            <param><ptype>int32_t</ptype> *<name>denominator</name></param>
+        </command>
+        <command>
+            <proto><ptype>__GLXextFuncPtr</ptype> <name>glXGetProcAddressARB</name></proto>
+            <param>const <ptype>GLubyte</ptype> *<name>procName</name></param>
+        </command>
+        <command>
+            <proto><ptype>__GLXextFuncPtr</ptype> <name>glXGetProcAddress</name></proto>
+            <param>const <ptype>GLubyte</ptype> *<name>procName</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXGetSelectedEvent</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>draw</name></param>
+            <param>unsigned long *<name>event_mask</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXGetSelectedEventSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param>unsigned long *<name>mask</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXGetSyncValuesOML</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>int64_t</ptype> *<name>ust</name></param>
+            <param><ptype>int64_t</ptype> *<name>msc</name></param>
+            <param><ptype>int64_t</ptype> *<name>sbc</name></param>
+        </command>
+        <command>
+            <proto><ptype>Status</ptype> <name>glXGetTransparentIndexSUN</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>Window</ptype> <name>overlay</name></param>
+            <param><ptype>Window</ptype> <name>underlay</name></param>
+            <param>long *<name>pTransparentIndex</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXGetVideoDeviceNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>numVideoDevices</name></param>
+            <param><ptype>GLXVideoDeviceNV</ptype> *<name>pVideoDevice</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXGetVideoInfoNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param><ptype>GLXVideoDeviceNV</ptype> <name>VideoDevice</name></param>
+            <param>unsigned long *<name>pulCounterOutputPbuffer</name></param>
+            <param>unsigned long *<name>pulCounterOutputVideo</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXGetVideoSyncSGI</name></proto>
+            <param>unsigned int *<name>count</name></param>
+        </command>
+        <command>
+            <proto><ptype>XVisualInfo</ptype> *<name>glXGetVisualFromFBConfig</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfig</ptype> <name>config</name></param>
+        </command>
+        <command>
+            <proto><ptype>XVisualInfo</ptype> *<name>glXGetVisualFromFBConfigSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXFBConfigSGIX</ptype> <name>config</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXHyperpipeAttribSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>timeSlice</name></param>
+            <param>int <name>attrib</name></param>
+            <param>int <name>size</name></param>
+            <param>void *<name>attribList</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXHyperpipeConfigSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>networkId</name></param>
+            <param>int <name>npipes</name></param>
+            <param><ptype>GLXHyperpipeConfigSGIX</ptype> *<name>cfg</name></param>
+            <param>int *<name>hpId</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXContext</ptype> <name>glXImportContextEXT</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContextID</ptype> <name>contextID</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXIsDirect</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXJoinSwapGroupNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>GLuint</ptype> <name>group</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXJoinSwapGroupSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>member</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXLockVideoCaptureDeviceNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXVideoCaptureDeviceNV</ptype> <name>device</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXMakeAssociatedContextCurrentAMD</name></proto>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXMakeContextCurrent</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>draw</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>read</name></param>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXMakeCurrent</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXMakeCurrentReadSGI</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>draw</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>read</name></param>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXQueryChannelDeltasSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>display</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>channel</name></param>
+            <param>int *<name>x</name></param>
+            <param>int *<name>y</name></param>
+            <param>int *<name>w</name></param>
+            <param>int *<name>h</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXQueryChannelRectSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>display</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>channel</name></param>
+            <param>int *<name>dx</name></param>
+            <param>int *<name>dy</name></param>
+            <param>int *<name>dw</name></param>
+            <param>int *<name>dh</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXQueryContext</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>ctx</name></param>
+            <param>int <name>attribute</name></param>
+            <param>int *<name>value</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXQueryContextInfoEXT</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXContext</ptype> <name>context</name></param>
+            <param>int <name>attribute</name></param>
+            <param>int *<name>value</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXQueryCurrentRendererIntegerMESA</name></proto>
+            <param>int <name>attribute</name></param>
+            <param>unsigned int *<name>value</name></param>
+        </command>
+        <command>
+            <proto>const char *<name>glXQueryCurrentRendererStringMESA</name></proto>
+            <param>int <name>attribute</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXQueryDrawable</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>draw</name></param>
+            <param>int <name>attribute</name></param>
+            <param>unsigned int *<name>value</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXQueryExtension</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int *<name>errorb</name></param>
+            <param>int *<name>event</name></param>
+        </command>
+        <command>
+            <proto>const char *<name>glXQueryExtensionsString</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXQueryFrameCountNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param><ptype>GLuint</ptype> *<name>count</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXQueryGLXPbufferSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXPbufferSGIX</ptype> <name>pbuf</name></param>
+            <param>int <name>attribute</name></param>
+            <param>unsigned int *<name>value</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXQueryHyperpipeAttribSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>timeSlice</name></param>
+            <param>int <name>attrib</name></param>
+            <param>int <name>size</name></param>
+            <param>void *<name>returnAttribList</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXQueryHyperpipeBestAttribSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>timeSlice</name></param>
+            <param>int <name>attrib</name></param>
+            <param>int <name>size</name></param>
+            <param>void *<name>attribList</name></param>
+            <param>void *<name>returnAttribList</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXHyperpipeConfigSGIX</ptype> *<name>glXQueryHyperpipeConfigSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>hpId</name></param>
+            <param>int *<name>npipes</name></param>
+        </command>
+        <command>
+            <proto><ptype>GLXHyperpipeNetworkSGIX</ptype> *<name>glXQueryHyperpipeNetworkSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int *<name>npipes</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXQueryMaxSwapBarriersSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int *<name>max</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXQueryMaxSwapGroupsNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param><ptype>GLuint</ptype> *<name>maxGroups</name></param>
+            <param><ptype>GLuint</ptype> *<name>maxBarriers</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXQueryRendererIntegerMESA</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>renderer</name></param>
+            <param>int <name>attribute</name></param>
+            <param>unsigned int *<name>value</name></param>
+        </command>
+        <command>
+            <proto>const char *<name>glXQueryRendererStringMESA</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>renderer</name></param>
+            <param>int <name>attribute</name></param>
+        </command>
+        <command>
+            <proto>const char *<name>glXQueryServerString</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param>int <name>name</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXQuerySwapGroupNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>GLuint</ptype> *<name>group</name></param>
+            <param><ptype>GLuint</ptype> *<name>barrier</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXQueryVersion</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int *<name>maj</name></param>
+            <param>int *<name>min</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXQueryVideoCaptureDeviceNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXVideoCaptureDeviceNV</ptype> <name>device</name></param>
+            <param>int <name>attribute</name></param>
+            <param>int *<name>value</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXReleaseBuffersMESA</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXReleaseTexImageEXT</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param>int <name>buffer</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXReleaseVideoCaptureDeviceNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXVideoCaptureDeviceNV</ptype> <name>device</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXReleaseVideoDeviceNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+            <param><ptype>GLXVideoDeviceNV</ptype> <name>VideoDevice</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXReleaseVideoImageNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXPbuffer</ptype> <name>pbuf</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXResetFrameCountNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param>int <name>screen</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXSelectEvent</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>draw</name></param>
+            <param>unsigned long <name>event_mask</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXSelectEventSGIX</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param>unsigned long <name>mask</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXSendPbufferToVideoNV</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXPbuffer</ptype> <name>pbuf</name></param>
+            <param>int <name>iBufferType</name></param>
+            <param>unsigned long *<name>pulCounterPbuffer</name></param>
+            <param><ptype>GLboolean</ptype> <name>bBlock</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXSet3DfxModeMESA</name></proto>
+            <param>int <name>mode</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXSwapBuffers</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+        </command>
+        <command>
+            <proto><ptype>int64_t</ptype> <name>glXSwapBuffersMscOML</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>int64_t</ptype> <name>target_msc</name></param>
+            <param><ptype>int64_t</ptype> <name>divisor</name></param>
+            <param><ptype>int64_t</ptype> <name>remainder</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXSwapIntervalEXT</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param>int <name>interval</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXSwapIntervalSGI</name></proto>
+            <param>int <name>interval</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXUseXFont</name></proto>
+            <param><ptype>Font</ptype> <name>font</name></param>
+            <param>int <name>first</name></param>
+            <param>int <name>count</name></param>
+            <param>int <name>list</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXWaitForMscOML</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>int64_t</ptype> <name>target_msc</name></param>
+            <param><ptype>int64_t</ptype> <name>divisor</name></param>
+            <param><ptype>int64_t</ptype> <name>remainder</name></param>
+            <param><ptype>int64_t</ptype> *<name>ust</name></param>
+            <param><ptype>int64_t</ptype> *<name>msc</name></param>
+            <param><ptype>int64_t</ptype> *<name>sbc</name></param>
+        </command>
+        <command>
+            <proto><ptype>Bool</ptype> <name>glXWaitForSbcOML</name></proto>
+            <param><ptype>Display</ptype> *<name>dpy</name></param>
+            <param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
+            <param><ptype>int64_t</ptype> <name>target_sbc</name></param>
+            <param><ptype>int64_t</ptype> *<name>ust</name></param>
+            <param><ptype>int64_t</ptype> *<name>msc</name></param>
+            <param><ptype>int64_t</ptype> *<name>sbc</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXWaitGL</name></proto>
+        </command>
+        <command>
+            <proto>int <name>glXWaitVideoSyncSGI</name></proto>
+            <param>int <name>divisor</name></param>
+            <param>int <name>remainder</name></param>
+            <param>unsigned int *<name>count</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXWaitX</name></proto>
+        </command>
+    </commands>
+
+    <!-- SECTION: GLX API interface definitions. -->
+    <feature api="glx" name="GLX_VERSION_1_0" number="1.0">
+        <require>
+            <enum name="GLX_EXTENSION_NAME" comment="A string #define"/>
+                <!-- Events -->
+            <enum name="GLX_PbufferClobber"/>
+            <enum name="GLX_BufferSwapComplete"/>
+            <enum name="__GLX_NUMBER_EVENTS"/>
+                <!-- Error codes -->
+            <enum name="GLX_BAD_SCREEN"/>
+            <enum name="GLX_BAD_ATTRIBUTE"/>
+            <enum name="GLX_NO_EXTENSION"/>
+            <enum name="GLX_BAD_VISUAL"/>
+            <enum name="GLX_BAD_CONTEXT"/>
+            <enum name="GLX_BAD_VALUE"/>
+            <enum name="GLX_BAD_ENUM"/>
+                <!-- Tokens for glXChooseVisual and glXGetConfig -->
+            <enum name="GLX_USE_GL"/>
+            <enum name="GLX_BUFFER_SIZE"/>
+            <enum name="GLX_LEVEL"/>
+            <enum name="GLX_RGBA"/>
+            <enum name="GLX_DOUBLEBUFFER"/>
+            <enum name="GLX_STEREO"/>
+            <enum name="GLX_AUX_BUFFERS"/>
+            <enum name="GLX_RED_SIZE"/>
+            <enum name="GLX_GREEN_SIZE"/>
+            <enum name="GLX_BLUE_SIZE"/>
+            <enum name="GLX_ALPHA_SIZE"/>
+            <enum name="GLX_DEPTH_SIZE"/>
+            <enum name="GLX_STENCIL_SIZE"/>
+            <enum name="GLX_ACCUM_RED_SIZE"/>
+            <enum name="GLX_ACCUM_GREEN_SIZE"/>
+            <enum name="GLX_ACCUM_BLUE_SIZE"/>
+            <enum name="GLX_ACCUM_ALPHA_SIZE"/>
+            <command name="glXChooseVisual"/>
+            <command name="glXCreateContext"/>
+            <command name="glXDestroyContext"/>
+            <command name="glXMakeCurrent"/>
+            <command name="glXCopyContext"/>
+            <command name="glXSwapBuffers"/>
+            <command name="glXCreateGLXPixmap"/>
+            <command name="glXDestroyGLXPixmap"/>
+            <command name="glXQueryExtension"/>
+            <command name="glXQueryVersion"/>
+            <command name="glXIsDirect"/>
+            <command name="glXGetConfig"/>
+            <command name="glXGetCurrentContext"/>
+            <command name="glXGetCurrentDrawable"/>
+            <command name="glXWaitGL"/>
+            <command name="glXWaitX"/>
+            <command name="glXUseXFont"/>
+        </require>
+    </feature>
+
+    <feature api="glx" name="GLX_VERSION_1_1" number="1.1">
+        <require>
+            <enum name="GLX_VENDOR"/>
+            <enum name="GLX_VERSION"/>
+            <enum name="GLX_EXTENSIONS"/>
+            <command name="glXQueryExtensionsString"/>
+            <command name="glXQueryServerString"/>
+            <command name="glXGetClientString"/>
+        </require>
+    </feature>
+
+    <feature api="glx" name="GLX_VERSION_1_2" number="1.2">
+        <require>
+            <command name="glXGetCurrentDisplay"/>
+        </require>
+    </feature>
+
+
+    <feature api="glx" name="GLX_VERSION_1_3" number="1.3">
+        <require>
+            <type name="GLXContextID" comment="Required here so it doesn't collide with Mesa glx.h (Bug 11454)"/>
+            <enum name="GLX_WINDOW_BIT"/>
+            <enum name="GLX_PIXMAP_BIT"/>
+            <enum name="GLX_PBUFFER_BIT"/>
+            <enum name="GLX_RGBA_BIT"/>
+            <enum name="GLX_COLOR_INDEX_BIT"/>
+            <enum name="GLX_PBUFFER_CLOBBER_MASK"/>
+            <enum name="GLX_FRONT_LEFT_BUFFER_BIT"/>
+            <enum name="GLX_FRONT_RIGHT_BUFFER_BIT"/>
+            <enum name="GLX_BACK_LEFT_BUFFER_BIT"/>
+            <enum name="GLX_BACK_RIGHT_BUFFER_BIT"/>
+            <enum name="GLX_AUX_BUFFERS_BIT"/>
+            <enum name="GLX_DEPTH_BUFFER_BIT"/>
+            <enum name="GLX_STENCIL_BUFFER_BIT"/>
+            <enum name="GLX_ACCUM_BUFFER_BIT"/>
+            <enum name="GLX_CONFIG_CAVEAT"/>
+            <enum name="GLX_X_VISUAL_TYPE"/>
+            <enum name="GLX_TRANSPARENT_TYPE"/>
+            <enum name="GLX_TRANSPARENT_INDEX_VALUE"/>
+            <enum name="GLX_TRANSPARENT_RED_VALUE"/>
+            <enum name="GLX_TRANSPARENT_GREEN_VALUE"/>
+            <enum name="GLX_TRANSPARENT_BLUE_VALUE"/>
+            <enum name="GLX_TRANSPARENT_ALPHA_VALUE"/>
+            <enum name="GLX_DONT_CARE"/>
+            <enum name="GLX_NONE"/>
+            <enum name="GLX_SLOW_CONFIG"/>
+            <enum name="GLX_TRUE_COLOR"/>
+            <enum name="GLX_DIRECT_COLOR"/>
+            <enum name="GLX_PSEUDO_COLOR"/>
+            <enum name="GLX_STATIC_COLOR"/>
+            <enum name="GLX_GRAY_SCALE"/>
+            <enum name="GLX_STATIC_GRAY"/>
+            <enum name="GLX_TRANSPARENT_RGB"/>
+            <enum name="GLX_TRANSPARENT_INDEX"/>
+            <enum name="GLX_VISUAL_ID"/>
+            <enum name="GLX_SCREEN"/>
+            <enum name="GLX_NON_CONFORMANT_CONFIG"/>
+            <enum name="GLX_DRAWABLE_TYPE"/>
+            <enum name="GLX_RENDER_TYPE"/>
+            <enum name="GLX_X_RENDERABLE"/>
+            <enum name="GLX_FBCONFIG_ID"/>
+            <enum name="GLX_RGBA_TYPE"/>
+            <enum name="GLX_COLOR_INDEX_TYPE"/>
+            <enum name="GLX_MAX_PBUFFER_WIDTH"/>
+            <enum name="GLX_MAX_PBUFFER_HEIGHT"/>
+            <enum name="GLX_MAX_PBUFFER_PIXELS"/>
+            <enum name="GLX_PRESERVED_CONTENTS"/>
+            <enum name="GLX_LARGEST_PBUFFER"/>
+            <enum name="GLX_WIDTH"/>
+            <enum name="GLX_HEIGHT"/>
+            <enum name="GLX_EVENT_MASK"/>
+            <enum name="GLX_DAMAGED"/>
+            <enum name="GLX_SAVED"/>
+            <enum name="GLX_WINDOW"/>
+            <enum name="GLX_PBUFFER"/>
+            <enum name="GLX_PBUFFER_HEIGHT"/>
+            <enum name="GLX_PBUFFER_WIDTH"/>
+            <command name="glXGetFBConfigs"/>
+            <command name="glXChooseFBConfig"/>
+            <command name="glXGetFBConfigAttrib"/>
+            <command name="glXGetVisualFromFBConfig"/>
+            <command name="glXCreateWindow"/>
+            <command name="glXDestroyWindow"/>
+            <command name="glXCreatePixmap"/>
+            <command name="glXDestroyPixmap"/>
+            <command name="glXCreatePbuffer"/>
+            <command name="glXDestroyPbuffer"/>
+            <command name="glXQueryDrawable"/>
+            <command name="glXCreateNewContext"/>
+            <command name="glXMakeContextCurrent"/>
+            <command name="glXGetCurrentReadDrawable"/>
+            <command name="glXQueryContext"/>
+            <command name="glXSelectEvent"/>
+            <command name="glXGetSelectedEvent"/>
+        </require>
+    </feature>
+
+    <feature api="glx" name="GLX_VERSION_1_4" number="1.4">
+        <require>
+            <enum name="GLX_SAMPLE_BUFFERS"/>
+            <enum name="GLX_SAMPLES"/>
+            <command name="glXGetProcAddress"/>
+        </require>
+    </feature>
+
+
+    <!-- SECTION: GLX extension interface definitions -->
+    <extensions>
+        <extension name="GLX_3DFX_multisample" supported="glx">
+            <require>
+                <enum name="GLX_SAMPLE_BUFFERS_3DFX"/>
+                <enum name="GLX_SAMPLES_3DFX"/>
+            </require>
+        </extension>
+        <extension name="GLX_AMD_gpu_association" supported="glx">
+            <require>
+                <enum name="GLX_GPU_VENDOR_AMD"/>
+                <enum name="GLX_GPU_RENDERER_STRING_AMD"/>
+                <enum name="GLX_GPU_OPENGL_VERSION_STRING_AMD"/>
+                <enum name="GLX_GPU_FASTEST_TARGET_GPUS_AMD"/>
+                <enum name="GLX_GPU_RAM_AMD"/>
+                <enum name="GLX_GPU_CLOCK_AMD"/>
+                <enum name="GLX_GPU_NUM_PIPES_AMD"/>
+                <enum name="GLX_GPU_NUM_SIMD_AMD"/>
+                <enum name="GLX_GPU_NUM_RB_AMD"/>
+                <enum name="GLX_GPU_NUM_SPI_AMD"/>
+                <command name="glXGetGPUIDsAMD"/>
+                <command name="glXGetGPUInfoAMD"/>
+                <command name="glXGetContextGPUIDAMD"/>
+                <command name="glXCreateAssociatedContextAMD"/>
+                <command name="glXCreateAssociatedContextAttribsAMD"/>
+                <command name="glXDeleteAssociatedContextAMD"/>
+                <command name="glXMakeAssociatedContextCurrentAMD"/>
+                <command name="glXGetCurrentAssociatedContextAMD"/>
+                <command name="glXBlitContextFramebufferAMD"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_context_flush_control" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_RELEASE_BEHAVIOR_ARB"/>
+                <enum name="GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB"/>
+                <enum name="GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_create_context" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_DEBUG_BIT_ARB"/>
+                <enum name="GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB"/>
+                <enum name="GLX_CONTEXT_MAJOR_VERSION_ARB"/>
+                <enum name="GLX_CONTEXT_MINOR_VERSION_ARB"/>
+                <enum name="GLX_CONTEXT_FLAGS_ARB"/>
+                <command name="glXCreateContextAttribsARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_create_context_profile" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_CORE_PROFILE_BIT_ARB"/>
+                <enum name="GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB"/>
+                <enum name="GLX_CONTEXT_PROFILE_MASK_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_create_context_robustness" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB"/>
+                <enum name="GLX_LOSE_CONTEXT_ON_RESET_ARB"/>
+                <enum name="GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB"/>
+                <enum name="GLX_NO_RESET_NOTIFICATION_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_fbconfig_float" supported="glx">
+            <require>
+                <enum name="GLX_RGBA_FLOAT_TYPE_ARB"/>
+                <enum name="GLX_RGBA_FLOAT_BIT_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_framebuffer_sRGB" supported="glx">
+            <require>
+                <enum name="GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_get_proc_address" supported="glx">
+            <require>
+                <command name="glXGetProcAddressARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_multisample" supported="glx">
+            <require>
+                <enum name="GLX_SAMPLE_BUFFERS_ARB"/>
+                <enum name="GLX_SAMPLES_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_robustness_application_isolation" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_RESET_ISOLATION_BIT_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_robustness_share_group_isolation" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_RESET_ISOLATION_BIT_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_ARB_vertex_buffer_object" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_buffer_age" supported="glx">
+            <require>
+                <enum name="GLX_BACK_BUFFER_AGE_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_create_context_es_profile" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_ES_PROFILE_BIT_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_create_context_es2_profile" supported="glx">
+            <require>
+                <enum name="GLX_CONTEXT_ES2_PROFILE_BIT_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_fbconfig_packed_float" supported="glx">
+            <require>
+                <enum name="GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT"/>
+                <enum name="GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_framebuffer_sRGB" supported="glx">
+            <require>
+                <enum name="GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_import_context" supported="glx">
+            <require>
+                <enum name="GLX_SHARE_CONTEXT_EXT"/>
+                <enum name="GLX_VISUAL_ID_EXT"/>
+                <enum name="GLX_SCREEN_EXT"/>
+                <command name="glXGetCurrentDisplayEXT"/>
+                <command name="glXQueryContextInfoEXT"/>
+                <command name="glXGetContextIDEXT"/>
+                <command name="glXImportContextEXT"/>
+                <command name="glXFreeContextEXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_stereo_tree" supported="glx">
+            <require>
+                <type name="GLXStereoNotifyEventEXT"/>
+                <enum name="GLX_STEREO_TREE_EXT"/>
+                <enum name="GLX_STEREO_NOTIFY_MASK_EXT"/>
+                <enum name="GLX_STEREO_NOTIFY_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_swap_control" supported="glx">
+            <require>
+                <enum name="GLX_SWAP_INTERVAL_EXT"/>
+                <enum name="GLX_MAX_SWAP_INTERVAL_EXT"/>
+                <command name="glXSwapIntervalEXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_swap_control_tear" supported="glx">
+            <require>
+                <enum name="GLX_LATE_SWAPS_TEAR_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_texture_from_pixmap" supported="glx">
+            <require>
+                <enum name="GLX_TEXTURE_1D_BIT_EXT"/>
+                <enum name="GLX_TEXTURE_2D_BIT_EXT"/>
+                <enum name="GLX_TEXTURE_RECTANGLE_BIT_EXT"/>
+                <enum name="GLX_BIND_TO_TEXTURE_RGB_EXT"/>
+                <enum name="GLX_BIND_TO_TEXTURE_RGBA_EXT"/>
+                <enum name="GLX_BIND_TO_MIPMAP_TEXTURE_EXT"/>
+                <enum name="GLX_BIND_TO_TEXTURE_TARGETS_EXT"/>
+                <enum name="GLX_Y_INVERTED_EXT"/>
+                <enum name="GLX_TEXTURE_FORMAT_EXT"/>
+                <enum name="GLX_TEXTURE_TARGET_EXT"/>
+                <enum name="GLX_MIPMAP_TEXTURE_EXT"/>
+                <enum name="GLX_TEXTURE_FORMAT_NONE_EXT"/>
+                <enum name="GLX_TEXTURE_FORMAT_RGB_EXT"/>
+                <enum name="GLX_TEXTURE_FORMAT_RGBA_EXT"/>
+                <enum name="GLX_TEXTURE_1D_EXT"/>
+                <enum name="GLX_TEXTURE_2D_EXT"/>
+                <enum name="GLX_TEXTURE_RECTANGLE_EXT"/>
+                <enum name="GLX_FRONT_LEFT_EXT"/>
+                <enum name="GLX_FRONT_RIGHT_EXT"/>
+                <enum name="GLX_BACK_LEFT_EXT"/>
+                <enum name="GLX_BACK_RIGHT_EXT"/>
+                <enum name="GLX_FRONT_EXT"/>
+                <enum name="GLX_BACK_EXT"/>
+                <enum name="GLX_AUX0_EXT"/>
+                <enum name="GLX_AUX1_EXT"/>
+                <enum name="GLX_AUX2_EXT"/>
+                <enum name="GLX_AUX3_EXT"/>
+                <enum name="GLX_AUX4_EXT"/>
+                <enum name="GLX_AUX5_EXT"/>
+                <enum name="GLX_AUX6_EXT"/>
+                <enum name="GLX_AUX7_EXT"/>
+                <enum name="GLX_AUX8_EXT"/>
+                <enum name="GLX_AUX9_EXT"/>
+                <command name="glXBindTexImageEXT"/>
+                <command name="glXReleaseTexImageEXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_visual_info" supported="glx">
+            <require>
+                <enum name="GLX_X_VISUAL_TYPE_EXT"/>
+                <enum name="GLX_TRANSPARENT_TYPE_EXT"/>
+                <enum name="GLX_TRANSPARENT_INDEX_VALUE_EXT"/>
+                <enum name="GLX_TRANSPARENT_RED_VALUE_EXT"/>
+                <enum name="GLX_TRANSPARENT_GREEN_VALUE_EXT"/>
+                <enum name="GLX_TRANSPARENT_BLUE_VALUE_EXT"/>
+                <enum name="GLX_TRANSPARENT_ALPHA_VALUE_EXT"/>
+                <enum name="GLX_NONE_EXT"/>
+                <enum name="GLX_TRUE_COLOR_EXT"/>
+                <enum name="GLX_DIRECT_COLOR_EXT"/>
+                <enum name="GLX_PSEUDO_COLOR_EXT"/>
+                <enum name="GLX_STATIC_COLOR_EXT"/>
+                <enum name="GLX_GRAY_SCALE_EXT"/>
+                <enum name="GLX_STATIC_GRAY_EXT"/>
+                <enum name="GLX_TRANSPARENT_RGB_EXT"/>
+                <enum name="GLX_TRANSPARENT_INDEX_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_EXT_visual_rating" supported="glx">
+            <require>
+                <enum name="GLX_VISUAL_CAVEAT_EXT"/>
+                <enum name="GLX_SLOW_VISUAL_EXT"/>
+                <enum name="GLX_NON_CONFORMANT_VISUAL_EXT"/>
+                <enum name="GLX_NONE_EXT"/>
+            </require>
+        </extension>
+        <extension name="GLX_INTEL_swap_event" supported="glx">
+            <require>
+                <enum name="GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK"/>
+                <enum name="GLX_EXCHANGE_COMPLETE_INTEL"/>
+                <enum name="GLX_COPY_COMPLETE_INTEL"/>
+                <enum name="GLX_FLIP_COMPLETE_INTEL"/>
+            </require>
+        </extension>
+        <extension name="GLX_MESA_agp_offset" supported="glx">
+            <require>
+                <command name="glXGetAGPOffsetMESA"/>
+            </require>
+        </extension>
+        <extension name="GLX_MESA_copy_sub_buffer" supported="glx">
+            <require>
+                <command name="glXCopySubBufferMESA"/>
+            </require>
+        </extension>
+        <extension name="GLX_MESA_pixmap_colormap" supported="glx">
+            <require>
+                <command name="glXCreateGLXPixmapMESA"/>
+            </require>
+        </extension>
+        <extension name="GLX_MESA_query_renderer" supported="glx">
+            <require>
+                <enum name="GLX_RENDERER_VENDOR_ID_MESA"/>
+                <enum name="GLX_RENDERER_DEVICE_ID_MESA"/>
+                <enum name="GLX_RENDERER_VERSION_MESA"/>
+                <enum name="GLX_RENDERER_ACCELERATED_MESA"/>
+                <enum name="GLX_RENDERER_VIDEO_MEMORY_MESA"/>
+                <enum name="GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA"/>
+                <enum name="GLX_RENDERER_PREFERRED_PROFILE_MESA"/>
+                <enum name="GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA"/>
+                <enum name="GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA"/>
+                <enum name="GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA"/>
+                <enum name="GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA"/>
+                <enum name="GLX_RENDERER_ID_MESA"/>
+                <command name="glXQueryCurrentRendererIntegerMESA"/>
+                <command name="glXQueryCurrentRendererStringMESA"/>
+                <command name="glXQueryRendererIntegerMESA"/>
+                <command name="glXQueryRendererStringMESA"/>
+            </require>
+        </extension>
+        <extension name="GLX_MESA_release_buffers" supported="glx">
+            <require>
+                <command name="glXReleaseBuffersMESA"/>
+            </require>
+        </extension>
+        <extension name="GLX_MESA_set_3dfx_mode" supported="glx">
+            <require>
+                <enum name="GLX_3DFX_WINDOW_MODE_MESA"/>
+                <enum name="GLX_3DFX_FULLSCREEN_MODE_MESA"/>
+                <command name="glXSet3DfxModeMESA"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_copy_buffer" supported="glx">
+            <require>
+                <command name="glXCopyBufferSubDataNV"/>
+                <command name="glXNamedCopyBufferSubDataNV"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_copy_image" supported="glx">
+            <require>
+                <command name="glXCopyImageSubDataNV"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_delay_before_swap" supported="glx">
+            <require>
+                <command name="glXDelayBeforeSwapNV"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_float_buffer" supported="glx">
+            <require>
+                <enum name="GLX_FLOAT_COMPONENTS_NV"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_multisample_coverage" supported="glx">
+            <require>
+                <enum name="GLX_COVERAGE_SAMPLES_NV"/>
+                <enum name="GLX_COLOR_SAMPLES_NV"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_present_video" supported="glx">
+            <require>
+                <enum name="GLX_NUM_VIDEO_SLOTS_NV"/>
+                <command name="glXEnumerateVideoDevicesNV"/>
+                <command name="glXBindVideoDeviceNV"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_swap_group" supported="glx">
+            <require>
+                <command name="glXJoinSwapGroupNV"/>
+                <command name="glXBindSwapBarrierNV"/>
+                <command name="glXQuerySwapGroupNV"/>
+                <command name="glXQueryMaxSwapGroupsNV"/>
+                <command name="glXQueryFrameCountNV"/>
+                <command name="glXResetFrameCountNV"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_video_capture" supported="glx">
+            <require>
+                <enum name="GLX_DEVICE_ID_NV"/>
+                <enum name="GLX_UNIQUE_ID_NV"/>
+                <enum name="GLX_NUM_VIDEO_CAPTURE_SLOTS_NV"/>
+                <command name="glXBindVideoCaptureDeviceNV"/>
+                <command name="glXEnumerateVideoCaptureDevicesNV"/>
+                <command name="glXLockVideoCaptureDeviceNV"/>
+                <command name="glXQueryVideoCaptureDeviceNV"/>
+                <command name="glXReleaseVideoCaptureDeviceNV"/>
+            </require>
+        </extension>
+        <extension name="GLX_NV_video_out" supported="glx">
+            <require>
+                <enum name="GLX_VIDEO_OUT_COLOR_NV"/>
+                <enum name="GLX_VIDEO_OUT_ALPHA_NV"/>
+                <enum name="GLX_VIDEO_OUT_DEPTH_NV"/>
+                <enum name="GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV"/>
+                <enum name="GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV"/>
+                <enum name="GLX_VIDEO_OUT_FRAME_NV"/>
+                <enum name="GLX_VIDEO_OUT_FIELD_1_NV"/>
+                <enum name="GLX_VIDEO_OUT_FIELD_2_NV"/>
+                <enum name="GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV"/>
+                <enum name="GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV"/>
+                <command name="glXGetVideoDeviceNV"/>
+                <command name="glXReleaseVideoDeviceNV"/>
+                <command name="glXBindVideoImageNV"/>
+                <command name="glXReleaseVideoImageNV"/>
+                <command name="glXSendPbufferToVideoNV"/>
+                <command name="glXGetVideoInfoNV"/>
+            </require>
+        </extension>
+        <extension name="GLX_OML_swap_method" supported="glx">
+            <require>
+                <enum name="GLX_SWAP_METHOD_OML"/>
+                <enum name="GLX_SWAP_EXCHANGE_OML"/>
+                <enum name="GLX_SWAP_COPY_OML"/>
+                <enum name="GLX_SWAP_UNDEFINED_OML"/>
+            </require>
+        </extension>
+        <extension name="GLX_OML_sync_control" supported="glx">
+            <require>
+                <command name="glXGetSyncValuesOML"/>
+                <command name="glXGetMscRateOML"/>
+                <command name="glXSwapBuffersMscOML"/>
+                <command name="glXWaitForMscOML"/>
+                <command name="glXWaitForSbcOML"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGI_cushion" supported="glx">
+            <require>
+                <command name="glXCushionSGI"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGI_make_current_read" supported="glx">
+            <require>
+                <command name="glXMakeCurrentReadSGI"/>
+                <command name="glXGetCurrentReadDrawableSGI"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGI_swap_control" supported="glx">
+            <require>
+                <command name="glXSwapIntervalSGI"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGI_video_sync" supported="glx">
+            <require>
+                <command name="glXGetVideoSyncSGI"/>
+                <command name="glXWaitVideoSyncSGI"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIS_blended_overlay" supported="glx">
+            <require>
+                <enum name="GLX_BLENDED_RGBA_SGIS"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIS_multisample" supported="glx">
+            <require>
+                <enum name="GLX_SAMPLE_BUFFERS_SGIS"/>
+                <enum name="GLX_SAMPLES_SGIS"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIS_shared_multisample" supported="glx">
+            <require>
+                <enum name="GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS"/>
+                <enum name="GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_dmbuffer" supported="glx" protect="_DM_BUFFER_H_">
+            <require>
+                <enum name="GLX_DIGITAL_MEDIA_PBUFFER_SGIX"/>
+                <command name="glXAssociateDMPbufferSGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_fbconfig" supported="glx">
+            <require>
+                <enum name="GLX_WINDOW_BIT_SGIX"/>
+                <enum name="GLX_PIXMAP_BIT_SGIX"/>
+                <enum name="GLX_RGBA_BIT_SGIX"/>
+                <enum name="GLX_COLOR_INDEX_BIT_SGIX"/>
+                <enum name="GLX_DRAWABLE_TYPE_SGIX"/>
+                <enum name="GLX_RENDER_TYPE_SGIX"/>
+                <enum name="GLX_X_RENDERABLE_SGIX"/>
+                <enum name="GLX_FBCONFIG_ID_SGIX"/>
+                <enum name="GLX_RGBA_TYPE_SGIX"/>
+                <enum name="GLX_COLOR_INDEX_TYPE_SGIX"/>
+                <enum name="GLX_SCREEN_EXT"/>
+                <command name="glXGetFBConfigAttribSGIX"/>
+                <command name="glXChooseFBConfigSGIX"/>
+                <command name="glXCreateGLXPixmapWithConfigSGIX"/>
+                <command name="glXCreateContextWithConfigSGIX"/>
+                <command name="glXGetVisualFromFBConfigSGIX"/>
+                <command name="glXGetFBConfigFromVisualSGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_hyperpipe" supported="glx">
+            <require>
+                <type name="GLXHyperpipeNetworkSGIX"/>
+                <type name="GLXHyperpipeConfigSGIX"/>
+                <type name="GLXPipeRect"/>
+                <type name="GLXPipeRectLimits"/>
+                <enum name="GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX"/>
+                <enum name="GLX_BAD_HYPERPIPE_CONFIG_SGIX"/>
+                <enum name="GLX_BAD_HYPERPIPE_SGIX"/>
+                <enum name="GLX_HYPERPIPE_DISPLAY_PIPE_SGIX"/>
+                <enum name="GLX_HYPERPIPE_RENDER_PIPE_SGIX"/>
+                <enum name="GLX_PIPE_RECT_SGIX"/>
+                <enum name="GLX_PIPE_RECT_LIMITS_SGIX"/>
+                <enum name="GLX_HYPERPIPE_STEREO_SGIX"/>
+                <enum name="GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX"/>
+                <enum name="GLX_HYPERPIPE_ID_SGIX"/>
+                <command name="glXQueryHyperpipeNetworkSGIX"/>
+                <command name="glXHyperpipeConfigSGIX"/>
+                <command name="glXQueryHyperpipeConfigSGIX"/>
+                <command name="glXDestroyHyperpipeConfigSGIX"/>
+                <command name="glXBindHyperpipeSGIX"/>
+                <command name="glXQueryHyperpipeBestAttribSGIX"/>
+                <command name="glXHyperpipeAttribSGIX"/>
+                <command name="glXQueryHyperpipeAttribSGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_pbuffer" supported="glx">
+            <require>
+                <enum name="GLX_PBUFFER_BIT_SGIX"/>
+                <enum name="GLX_BUFFER_CLOBBER_MASK_SGIX"/>
+                <enum name="GLX_FRONT_LEFT_BUFFER_BIT_SGIX"/>
+                <enum name="GLX_FRONT_RIGHT_BUFFER_BIT_SGIX"/>
+                <enum name="GLX_BACK_LEFT_BUFFER_BIT_SGIX"/>
+                <enum name="GLX_BACK_RIGHT_BUFFER_BIT_SGIX"/>
+                <enum name="GLX_AUX_BUFFERS_BIT_SGIX"/>
+                <enum name="GLX_DEPTH_BUFFER_BIT_SGIX"/>
+                <enum name="GLX_STENCIL_BUFFER_BIT_SGIX"/>
+                <enum name="GLX_ACCUM_BUFFER_BIT_SGIX"/>
+                <enum name="GLX_SAMPLE_BUFFERS_BIT_SGIX"/>
+                <enum name="GLX_MAX_PBUFFER_WIDTH_SGIX"/>
+                <enum name="GLX_MAX_PBUFFER_HEIGHT_SGIX"/>
+                <enum name="GLX_MAX_PBUFFER_PIXELS_SGIX"/>
+                <enum name="GLX_OPTIMAL_PBUFFER_WIDTH_SGIX"/>
+                <enum name="GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX"/>
+                <enum name="GLX_PRESERVED_CONTENTS_SGIX"/>
+                <enum name="GLX_LARGEST_PBUFFER_SGIX"/>
+                <enum name="GLX_WIDTH_SGIX"/>
+                <enum name="GLX_HEIGHT_SGIX"/>
+                <enum name="GLX_EVENT_MASK_SGIX"/>
+                <enum name="GLX_DAMAGED_SGIX"/>
+                <enum name="GLX_SAVED_SGIX"/>
+                <enum name="GLX_WINDOW_SGIX"/>
+                <enum name="GLX_PBUFFER_SGIX"/>
+                <command name="glXCreateGLXPbufferSGIX"/>
+                <command name="glXDestroyGLXPbufferSGIX"/>
+                <command name="glXQueryGLXPbufferSGIX"/>
+                <command name="glXSelectEventSGIX"/>
+                <command name="glXGetSelectedEventSGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_swap_barrier" supported="glx">
+            <require>
+                <command name="glXBindSwapBarrierSGIX"/>
+                <command name="glXQueryMaxSwapBarriersSGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_swap_group" supported="glx">
+            <require>
+                <command name="glXJoinSwapGroupSGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_video_resize" supported="glx">
+            <require>
+                <enum name="GLX_SYNC_FRAME_SGIX"/>
+                <enum name="GLX_SYNC_SWAP_SGIX"/>
+                <command name="glXBindChannelToWindowSGIX"/>
+                <command name="glXChannelRectSGIX"/>
+                <command name="glXQueryChannelRectSGIX"/>
+                <command name="glXQueryChannelDeltasSGIX"/>
+                <command name="glXChannelRectSyncSGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_video_source" supported="glx" protect="_VL_H">
+            <require>
+                <command name="glXCreateGLXVideoSourceSGIX"/>
+                <command name="glXDestroyGLXVideoSourceSGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SGIX_visual_select_group" supported="glx">
+            <require>
+                <enum name="GLX_VISUAL_SELECT_GROUP_SGIX"/>
+            </require>
+        </extension>
+        <extension name="GLX_SUN_get_transparent_index" supported="glx">
+            <require>
+                <command name="glXGetTransparentIndexSUN"/>
+            </require>
+        </extension>
+    </extensions>
+</registry>
diff --git a/src/generate/glx_function_list.py b/src/generate/glx_function_list.py
new file mode 100644
index 0000000..a8cb690
--- /dev/null
+++ b/src/generate/glx_function_list.py
@@ -0,0 +1,285 @@
+#!/usr/bin/env python2
+
+# Copyright (c) 2016, NVIDIA CORPORATION.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and/or associated documentation files (the
+# "Materials"), to deal in the Materials without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Materials, and to
+# permit persons to whom the Materials are furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# unaltered in all copies or substantial portions of the Materials.
+# Any additions, deletions, or changes to the original source files
+# must be clearly indicated in accompanying documentation.
+#
+# If only executable code is distributed, then the accompanying
+# documentation must state that "this software is based in part on the
+# work of the Khronos Group."
+#
+# THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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
+# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+"""
+The GLX function list, used by gen_glx_dispatch.py.
+
+GLX Function values:
+- "method"
+    How to select a vendor library. See "Method values" below.
+
+- "add_mapping"
+    Specifies that the return value should be added to one of libGLX's
+    mappings. See "add_mapping values" below.
+
+- "remove_mapping"
+    Specifies that the return value should be removed to one of libGLX's
+    mappings.
+
+    Allowed values are "context", "drawable", and "config".
+
+- "remove_key"
+    The parameter that contains the value to remove from libGLX's mapping.
+    If unspecified, the default is the same as the "key" field.
+
+- "prefix"
+    If True, the function should be exported from the library. This is used for
+    generating dispatch stubs for libGLX itself -- vendor libraries generally
+    should not use it.
+
+- "static"
+    If this is True, then the function will be declared static.
+
+- "public"
+    If True, the function should be exported from the library. Vendor libraries
+    generally should not use this.
+
+- "display"
+    The name of the parameter that contains the Display pointer.
+    May be "<current>" to specify the current display.
+    If not specified, it will look for a parameter with the correct type.
+
+- "extension"
+    The name of an extension macro to check for before defining the function.
+
+- "inheader"
+    If True, then this function should be declared in the generated header
+    file.
+
+method values:
+- "custom"
+    The dispatch stub will be hand-written instead of generated.
+
+- "none"
+    No dispatch function exists at all, but the function should still have an
+    entry in the index array. This is for other functions that a stub may need
+    to call that are implemented in libGLX itself.
+
+- "current"
+    Use the current context.
+
+- "drawable", "context", "config"
+    Look up by a GLXDrawable, GLXContext, or GLXFBConfig parameter.
+    The parameter is given by the "key" field. If unspecified, it will use the
+    first parameter of the correct type that it finds.
+
+- "screen"
+    Get a screen number from a parameter.
+    The parameter name is given by the "key" field. If unspecifid, the default
+    parameter name is "screen".
+
+- "xvisinfo"
+    Use an XVisualInfo pointer from a parameter.
+    The parameter name is given by the "key" field. If unspecifid, it will look
+    for the first XVisualInfo parameter.
+
+add_mapping values:
+- "context", "drawable", "config"
+    Adds the returned GLXContext, GLXDrawable, or GLXConfig.
+
+- "config_list"
+    Adds an array of GLXFBConfig values. In this case, you also need to specify
+    a pointer to the item count in the "nelements" field.
+"""
+
+def _glxFunc(name, method, opcode=None, error=None, prefix="dispatch_",
+        display=None, key=None, extension=None, retval=None, static=None,
+        public=False, inheader=None, add_mapping=None, nelements=None,
+        remove_mapping=None, remove_key=None):
+
+    if static is None:
+        static = (not public and method != "custom")
+    if inheader is None:
+        inheader = (not static)
+    values = {
+        "method" : method,
+        "opcode" : opcode,
+        "error" : error,
+        "key" : key,
+        "prefix" : prefix,
+        "display" : display,
+        "extension" : extension,
+        "retval" : retval,
+        "static" : static,
+        "public" : public,
+        "inheader" : inheader,
+        "add_mapping" : add_mapping,
+        "nelements" : nelements,
+        "remove_mapping" : remove_mapping,
+        "remove_key" : remove_key,
+    }
+    return (name, values)
+
+GLX_FUNCTIONS = (
+    # GLX core functions. These are all implemented in libGLX, but are listed
+    # here to keep track of the dispatch indexes for them.
+    _glxFunc("glXChooseFBConfig", "none"),
+    _glxFunc("glXCreateContext", "none"),
+    _glxFunc("glXCreateGLXPixmap", "none"),
+    _glxFunc("glXCreateNewContext", "none"),
+    _glxFunc("glXCreatePbuffer", "none"),
+    _glxFunc("glXCreatePixmap", "none"),
+    _glxFunc("glXCreateWindow", "none"),
+    _glxFunc("glXDestroyGLXPixmap", "none"),
+    _glxFunc("glXDestroyPbuffer", "none"),
+    _glxFunc("glXDestroyPixmap", "none"),
+    _glxFunc("glXDestroyWindow", "none"),
+    _glxFunc("glXGetConfig", "none"),
+    _glxFunc("glXChooseVisual", "none"),
+    _glxFunc("glXCopyContext", "none"),
+    _glxFunc("glXGetFBConfigAttrib", "none"),
+    _glxFunc("glXGetFBConfigs", "none"),
+    _glxFunc("glXGetSelectedEvent", "none"),
+    _glxFunc("glXGetVisualFromFBConfig", "none"),
+    _glxFunc("glXIsDirect", "none"),
+    _glxFunc("glXQueryExtensionsString", "none"),
+    _glxFunc("glXQueryServerString", "none"),
+    _glxFunc("glXQueryContext", "none"),
+    _glxFunc("glXQueryDrawable", "none"),
+    _glxFunc("glXSelectEvent", "none"),
+    _glxFunc("glXSwapBuffers", "none"),
+    _glxFunc("glXUseXFont", "none"),
+    _glxFunc("glXWaitGL", "none"),
+    _glxFunc("glXWaitX", "none"),
+    _glxFunc("glXDestroyContext", "none"),
+    _glxFunc("glXGetClientString", "none"),
+    _glxFunc("glXGetCurrentContext", "none"),
+    _glxFunc("glXGetCurrentDisplay", "none"),
+    _glxFunc("glXGetCurrentDrawable", "none"),
+    _glxFunc("glXGetCurrentReadDrawable", "none"),
+    _glxFunc("glXGetProcAddress", "none"),
+    _glxFunc("glXGetProcAddressARB", "none"),
+    _glxFunc("glXMakeContextCurrent", "none"),
+    _glxFunc("glXMakeCurrent", "none"),
+    _glxFunc("glXQueryExtension", "none"),
+    _glxFunc("glXQueryVersion", "none"),
+
+    # GLX_ARB_create_context
+    _glxFunc("glXCreateContextAttribsARB", "config", "X_GLXCreateContextAtrribsARB", add_mapping="context"),
+
+    # GLX_EXT_import_context
+    _glxFunc("glXImportContextEXT", "none"), # Implemented in libGLX
+    _glxFunc("glXFreeContextEXT", "none"), # Implemented in libGLX
+    _glxFunc("glXGetContextIDEXT", "context", None),
+    _glxFunc("glXGetCurrentDisplayEXT", "current"),
+    _glxFunc("glXQueryContextInfoEXT", "context", "X_GLXVendorPrivateWithReply"),
+
+    # GLX_EXT_texture_from_pixmap
+    _glxFunc("glXBindTexImageEXT", "drawable", "X_GLXVendorPrivate", error="GLXBadPixmap"),
+    _glxFunc("glXReleaseTexImageEXT", "drawable", "X_GLXVendorPrivate", error="GLXBadPixmap"),
+
+    # GLX_EXT_swap_control
+    #_glxFunc("glXSwapIntervalEXT", "drawable", "X_GLXVendorPrivate", error="GLXBadDrawable"),
+
+    # GLX_SGI_video_sync
+    _glxFunc("glXGetVideoSyncSGI", "current"),
+    _glxFunc("glXWaitVideoSyncSGI", "current"),
+
+    # GLX_SGI_swap_control
+    _glxFunc("glXSwapIntervalSGI", "current"),
+
+    # GLX_SGIX_swap_barrier
+    _glxFunc("glXBindSwapBarrierSGIX", "drawable"),
+    _glxFunc("glXQueryMaxSwapBarriersSGIX", "screen"),
+
+    # GLX_SGIX_fbconfig
+    _glxFunc("glXCreateContextWithConfigSGIX", "config", "X_GLXVendorPrivateWithReply", add_mapping="context"),
+    _glxFunc("glXGetFBConfigAttribSGIX", "config", "X_GLXVendorPrivateWithReply"),
+    _glxFunc("glXChooseFBConfigSGIX", "screen", add_mapping="config_list", nelements=3),
+    _glxFunc("glXCreateGLXPixmapWithConfigSGIX", "config", "X_GLXVendorPrivateWithReply", add_mapping="drawable"),
+    _glxFunc("glXGetVisualFromFBConfigSGIX", "config", "X_GLXVendorPrivateWithReply"),
+    _glxFunc("glXGetFBConfigFromVisualSGIX", "xvisinfo"),
+
+    # GLX_SGIX_pbuffer
+    _glxFunc("glXCreateGLXPbufferSGIX", "config", "X_GLXVendorPrivateWithReply", add_mapping="drawable"),
+    _glxFunc("glXDestroyGLXPbufferSGIX", "drawable", "X_GLXVendorPrivateWithReply", error="GLXBadPbuffer", remove_mapping="drawable"),
+    _glxFunc("glXQueryGLXPbufferSGIX", "drawable", "X_GLXVendorPrivateWithReply", error="GLXBadPbuffer"),
+    _glxFunc("glXSelectEventSGIX", "drawable", "X_GLXVendorPrivateWithReply", error="GLXBadDrawable"),
+    _glxFunc("glXGetSelectedEventSGIX", "drawable", "X_GLXVendorPrivateWithReply", error="GLXBadDrawable"),
+
+    # GLX_SGIX_swap_group
+    _glxFunc("glXJoinSwapGroupSGIX", "drawable", "X_GLXVendorPrivate", error="GLXBadDrawable"),
+
+    # GLX_MESA_copy_sub_buffer
+    _glxFunc("glXCopySubBufferMESA", "drawable", "X_GLXVendorPrivate", error="GLXBadDrawable"),
+
+    # GLX_MESA_pixmap_colormap
+    _glxFunc("glXCreateGLXPixmapMESA", "xvisinfo"),
+
+    # GLX_MESA_release_buffers
+    _glxFunc("glXReleaseBuffersMESA", "drawable"),
+
+    # GLX_MESA_swap_control
+    _glxFunc("glXSwapIntervalMESA", "current", retval="GLX_BAD_CONTEXT"),
+    _glxFunc("glXGetSwapIntervalMESA", "current", retval="0"),
+
+    # GLX_OML_sync_control
+    _glxFunc("glXWaitForSbcOML", "drawable"),
+    _glxFunc("glXWaitForMscOML", "drawable"),
+    _glxFunc("glXSwapBuffersMscOML", "drawable", retval="-1"),
+    _glxFunc("glXGetMscRateOML", "drawable"),
+    _glxFunc("glXGetSyncValuesOML", "drawable"),
+
+    # GLX_MESA_query_renderer
+    _glxFunc("glXQueryRendererIntegerMESA", "screen"),
+    _glxFunc("glXQueryRendererStringMESA", "screen"),
+    _glxFunc("glXQueryCurrentRendererIntegerMESA", "current"),
+    _glxFunc("glXQueryCurrentRendererStringMESA", "current"),
+
+    # GLX_NV_vertex_array_range
+    _glxFunc("glXAllocateMemoryNV", "current"),
+    _glxFunc("glXFreeMemoryNV", "current"),
+
+    # GLX_SGIX_video_resize
+    _glxFunc("glXBindChannelToWindowSGIX", "screen"),
+    _glxFunc("glXChannelRectSGIX", "screen"),
+    _glxFunc("glXQueryChannelRectSGIX", "screen"),
+    _glxFunc("glXQueryChannelDeltasSGIX", "screen"),
+    _glxFunc("glXChannelRectSyncSGIX", "screen"),
+
+    # GLX_MESA_set_3dfx_mode
+    _glxFunc("glXSet3DfxModeMESA", "current"),
+
+    # GLX_SUN_get_transparent_index
+    _glxFunc("glXGetTransparentIndexSUN", "drawable", key="overlay"),
+
+    # GLX_SGI_cushion
+    _glxFunc("glXCushionSGI", "drawable", key="window"),
+
+    # GLX_SGIX_video_source
+    _glxFunc("glXCreateGLXVideoSourceSGIX", "screen", key="(0)", extension="_VL_H"),
+    _glxFunc("glXDestroyGLXVideoSourceSGIX", "screen", key="(0)", extension="_VL_H"),
+
+    # GLX_MESA_agp_offset
+    _glxFunc("glXGetAGPOffsetMESA", "current"),
+
+    # GLX_SGIX_dmbuffer
+    _glxFunc("glXAssociateDMPbufferSGIX", "drawable", extension="_DM_BUFFER_H_"),
+)
+
diff --git a/src/generate/glx_other.xml b/src/generate/glx_other.xml
new file mode 100644
index 0000000..60b7c89
--- /dev/null
+++ b/src/generate/glx_other.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<registry>
+    <comment>
+        These are functions that are exported from other libGL.so implementations
+        but are missing from the normal glx.xml list.
+    </comment>
+    <commands namespace="GLX">
+        <!-- GLX_NV_vertex_array_range -->
+        <command>
+            <proto>void *<name>glXAllocateMemoryNV</name></proto>
+            <param><ptype>GLsizei</ptype> <name>size</name></param>
+            <param><ptype>GLfloat</ptype> <name>readfreq</name></param>
+            <param><ptype>GLfloat</ptype> <name>writefreq</name></param>
+            <param><ptype>GLfloat</ptype> <name>priority</name></param>
+        </command>
+        <command>
+            <proto>void <name>glXFreeMemoryNV</name></proto>
+            <param><ptype>GLvoid *</ptype> <name>pointer</name></param>
+        </command>
+
+        <!-- GLX_SGI_video_sync -->
+        <command>
+            <proto>int <name>glXGetRefreshRateSGI</name></proto>
+            <param><ptype>unsigned int *</ptype> <name>rate</name></param>
+        </command>
+
+        <!-- GLX_MESA_swap_control -->
+        <command>
+            <proto>int <name>glXSwapIntervalMESA</name></proto>
+            <param><ptype>unsigned int </ptype><name>interval</name></param>
+        </command>
+        <command>
+            <proto>int <name>glXGetSwapIntervalMESA</name></proto>
+        </command>
+
+        <!-- Additional functions from Mesa. -->
+        <command>
+            <proto>const char *<name>glXGetDriverConfig</name></proto>
+            <param><ptype>const char *</ptype> <name>driverName</name></param>
+        </command>
+        <command>
+            <proto>const char *<name>glXGetScreenDriver</name></proto>
+            <param><ptype>Display *</ptype> <name>dpy</name></param>
+            <param><ptype>int</ptype> <name>scrNum</name></param>
+        </command>
+    </commands>
+</registry>
+
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 79d416a..1983f0c 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -155,17 +155,37 @@ libglx_la_LIBADD += \
 	  $(builddir)/windows/libwindowsglx.la
 endif
 
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+g_glxdispatchstubs.c: ../generate/gen_glx_dispatch.py ../generate/glx.xml \
+		 ../generate/glx_other.xml ../generate/glx_function_list.py \
+		 ../generate/genCommon.py
+	$(PYTHON_GEN) $(top_srcdir)/src/generate/gen_glx_dispatch.py source \
+		$(top_srcdir)/src/generate/glx_function_list.py \
+		$(top_srcdir)/src/generate/glx.xml \
+		$(top_srcdir)/src/generate/glx_other.xml > $@
+
+g_glxdispatchstubs.h: ../generate/gen_glx_dispatch.py ../generate/glx.xml \
+		 ../generate/glx_other.xml ../generate/glx_function_list.py \
+		 ../generate/genCommon.py
+	$(PYTHON_GEN) $(top_srcdir)/src/generate/gen_glx_dispatch.py header \
+		$(top_srcdir)/src/generate/glx_function_list.py \
+		$(top_srcdir)/src/generate/glx.xml \
+		$(top_srcdir)/src/generate/glx_other.xml > $@
+
+BUILT_SOURCES = g_glxdispatchstubs.c g_glxdispatchstubs.h
+CLEANFILES = $(BUILT_SOURCES)
+
 if USE_LIBGLVND_GLX
 AM_CFLAGS += \
 	-DGL_LIB_NAME=\"lib at GL_LIB@.so.0\" \
 	$(GLVND_CFLAGS)
 
 libglx_la_SOURCES += \
-	g_glxglvnddispatchfuncs.c \
-	g_glxglvnddispatchindices.h \
-	glxglvnd.c \
-	glxglvnd.h \
-	glxglvnddispatchfuncs.h
+	g_glxdispatchstubs.c \
+	g_glxdispatchstubs.h \
+	glxdispatchstubs.c \
+	glxdispatchstubs.h \
+	glxglvnd.c
 
 GL_LIB_VERSION=0
 else
diff --git a/src/glx/g_glxglvnddispatchfuncs.c b/src/glx/g_glxglvnddispatchfuncs.c
deleted file mode 100644
index b5e3398..0000000
--- a/src/glx/g_glxglvnddispatchfuncs.c
+++ /dev/null
@@ -1,971 +0,0 @@
-/*
- * THIS FILE IS AUTOMATICALLY GENERATED BY gen_scrn_dispatch.pl
- * DO NOT EDIT!!
- */
-#include <stdlib.h>
-
-#include "glxglvnd.h"
-#include "glxglvnddispatchfuncs.h"
-#include "g_glxglvnddispatchindices.h"
-
-const int DI_FUNCTION_COUNT = DI_LAST_INDEX;
-/* Allocate an extra 'dummy' to ease lookup. See FindGLXFunction() */
-int __glXDispatchTableIndices[DI_LAST_INDEX + 1];
-const __GLXapiExports *__glXGLVNDAPIExports;
-
-const char * const __glXDispatchTableStrings[DI_LAST_INDEX] = {
-#define __ATTRIB(field) \
-    [DI_##field] = "glX"#field
-
-    __ATTRIB(BindSwapBarrierSGIX),
-    __ATTRIB(BindTexImageEXT),
-    // glXChooseFBConfig implemented by libglvnd
-    __ATTRIB(ChooseFBConfigSGIX),
-    // glXChooseVisual implemented by libglvnd
-    // glXCopyContext implemented by libglvnd
-    __ATTRIB(CopySubBufferMESA),
-    // glXCreateContext implemented by libglvnd
-    __ATTRIB(CreateContextAttribsARB),
-    __ATTRIB(CreateContextWithConfigSGIX),
-    __ATTRIB(CreateGLXPbufferSGIX),
-    // glXCreateGLXPixmap implemented by libglvnd
-    __ATTRIB(CreateGLXPixmapMESA),
-    __ATTRIB(CreateGLXPixmapWithConfigSGIX),
-    // glXCreateNewContext implemented by libglvnd
-    // glXCreatePbuffer implemented by libglvnd
-    // glXCreatePixmap implemented by libglvnd
-    // glXCreateWindow implemented by libglvnd
-    // glXDestroyContext implemented by libglvnd
-    __ATTRIB(DestroyGLXPbufferSGIX),
-    // glXDestroyGLXPixmap implemented by libglvnd
-    // glXDestroyPbuffer implemented by libglvnd
-    // glXDestroyPixmap implemented by libglvnd
-    // glXDestroyWindow implemented by libglvnd
-    // glXFreeContextEXT implemented by libglvnd
-    // glXGetClientString implemented by libglvnd
-    // glXGetConfig implemented by libglvnd
-    __ATTRIB(GetContextIDEXT),
-    // glXGetCurrentContext implemented by libglvnd
-    // glXGetCurrentDisplay implemented by libglvnd
-    __ATTRIB(GetCurrentDisplayEXT),
-    // glXGetCurrentDrawable implemented by libglvnd
-    // glXGetCurrentReadDrawable implemented by libglvnd
-    // glXGetFBConfigAttrib implemented by libglvnd
-    __ATTRIB(GetFBConfigAttribSGIX),
-    __ATTRIB(GetFBConfigFromVisualSGIX),
-    // glXGetFBConfigs implemented by libglvnd
-    __ATTRIB(GetMscRateOML),
-    // glXGetProcAddress implemented by libglvnd
-    // glXGetProcAddressARB implemented by libglvnd
-    __ATTRIB(GetScreenDriver),
-    // glXGetSelectedEvent implemented by libglvnd
-    __ATTRIB(GetSelectedEventSGIX),
-    __ATTRIB(GetSwapIntervalMESA),
-    __ATTRIB(GetSyncValuesOML),
-    __ATTRIB(GetVideoSyncSGI),
-    // glXGetVisualFromFBConfig implemented by libglvnd
-    __ATTRIB(GetVisualFromFBConfigSGIX),
-    // glXImportContextEXT implemented by libglvnd
-    // glXIsDirect implemented by libglvnd
-    __ATTRIB(JoinSwapGroupSGIX),
-    // glXMakeContextCurrent implemented by libglvnd
-    // glXMakeCurrent implemented by libglvnd
-    // glXQueryContext implemented by libglvnd
-    __ATTRIB(QueryContextInfoEXT),
-    __ATTRIB(QueryCurrentRendererIntegerMESA),
-    __ATTRIB(QueryCurrentRendererStringMESA),
-    // glXQueryDrawable implemented by libglvnd
-    // glXQueryExtension implemented by libglvnd
-    // glXQueryExtensionsString implemented by libglvnd
-    __ATTRIB(QueryGLXPbufferSGIX),
-    __ATTRIB(QueryMaxSwapBarriersSGIX),
-    __ATTRIB(QueryRendererIntegerMESA),
-    __ATTRIB(QueryRendererStringMESA),
-    // glXQueryServerString implemented by libglvnd
-    // glXQueryVersion implemented by libglvnd
-    __ATTRIB(ReleaseBuffersMESA),
-    __ATTRIB(ReleaseTexImageEXT),
-    // glXSelectEvent implemented by libglvnd
-    __ATTRIB(SelectEventSGIX),
-    // glXSwapBuffers implemented by libglvnd
-    __ATTRIB(SwapBuffersMscOML),
-    __ATTRIB(SwapIntervalMESA),
-    __ATTRIB(SwapIntervalSGI),
-    // glXUseXFont implemented by libglvnd
-    __ATTRIB(WaitForMscOML),
-    __ATTRIB(WaitForSbcOML),
-    // glXWaitGL implemented by libglvnd
-    __ATTRIB(WaitVideoSyncSGI),
-    // glXWaitX implemented by libglvnd
-
-#undef __ATTRIB
-};
-
-#define __FETCH_FUNCTION_PTR(func_name) \
-    p##func_name = (void *) \
-        __VND->fetchDispatchEntry(dd, __glXDispatchTableIndices[DI_##func_name])
-
-
-static void dispatch_BindTexImageEXT(Display *dpy, GLXDrawable drawable,
-                                     int buffer, const int *attrib_list)
-{
-    PFNGLXBINDTEXIMAGEEXTPROC pBindTexImageEXT;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(BindTexImageEXT);
-    if (pBindTexImageEXT == NULL)
-        return;
-
-    (*pBindTexImageEXT)(dpy, drawable, buffer, attrib_list);
-}
-
-
-
-static GLXFBConfigSGIX *dispatch_ChooseFBConfigSGIX(Display *dpy, int screen,
-                                                    const int *attrib_list,
-                                                    int *nelements)
-{
-    PFNGLXCHOOSEFBCONFIGSGIXPROC pChooseFBConfigSGIX;
-    __GLXvendorInfo *dd;
-    GLXFBConfigSGIX *ret;
-
-    dd = __VND->getDynDispatch(dpy, screen);
-    if (dd == NULL)
-        return NULL;
-
-    __FETCH_FUNCTION_PTR(ChooseFBConfigSGIX);
-    if (pChooseFBConfigSGIX == NULL)
-        return NULL;
-
-    ret = (*pChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements);
-    if (AddFBConfigsMapping(dpy, ret, nelements, dd)) {
-        free(ret);
-        return NULL;
-    }
-
-    return ret;
-}
-
-
-
-static GLXContext dispatch_CreateContextAttribsARB(Display *dpy,
-                                                   GLXFBConfig config,
-                                                   GLXContext share_list,
-                                                   Bool direct,
-                                                   const int *attrib_list)
-{
-    PFNGLXCREATECONTEXTATTRIBSARBPROC pCreateContextAttribsARB;
-    __GLXvendorInfo *dd;
-    GLXContext ret;
-
-    dd = GetDispatchFromFBConfig(dpy, config);
-    if (dd == NULL)
-        return None;
-
-    __FETCH_FUNCTION_PTR(CreateContextAttribsARB);
-    if (pCreateContextAttribsARB == NULL)
-        return None;
-
-    ret = (*pCreateContextAttribsARB)(dpy, config, share_list, direct, attrib_list);
-    if (AddContextMapping(dpy, ret, dd)) {
-        /* XXX: Call glXDestroyContext which lives in libglvnd. If we're not
-         * allowed to call it from here, should we extend __glXDispatchTableIndices ?
-         */
-        return None;
-    }
-
-    return ret;
-}
-
-
-
-static GLXContext dispatch_CreateContextWithConfigSGIX(Display *dpy,
-                                                       GLXFBConfigSGIX config,
-                                                       int render_type,
-                                                       GLXContext share_list,
-                                                       Bool direct)
-{
-    PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC pCreateContextWithConfigSGIX;
-    __GLXvendorInfo *dd;
-    GLXContext ret;
-
-    dd = GetDispatchFromFBConfig(dpy, config);
-    if (dd == NULL)
-        return None;
-
-    __FETCH_FUNCTION_PTR(CreateContextWithConfigSGIX);
-    if (pCreateContextWithConfigSGIX == NULL)
-        return None;
-
-    ret = (*pCreateContextWithConfigSGIX)(dpy, config, render_type, share_list, direct);
-    if (AddContextMapping(dpy, ret, dd)) {
-        /* XXX: Call glXDestroyContext which lives in libglvnd. If we're not
-         * allowed to call it from here, should we extend __glXDispatchTableIndices ?
-         */
-        return None;
-    }
-
-    return ret;
-}
-
-
-
-static GLXPbuffer dispatch_CreateGLXPbufferSGIX(Display *dpy,
-                                                GLXFBConfig config,
-                                                unsigned int width,
-                                                unsigned int height,
-                                                const int *attrib_list)
-{
-    PFNGLXCREATEGLXPBUFFERSGIXPROC pCreateGLXPbufferSGIX;
-    __GLXvendorInfo *dd;
-    GLXPbuffer ret;
-
-    dd = GetDispatchFromFBConfig(dpy, config);
-    if (dd == NULL)
-        return None;
-
-    __FETCH_FUNCTION_PTR(CreateGLXPbufferSGIX);
-    if (pCreateGLXPbufferSGIX == NULL)
-        return None;
-
-    ret = (*pCreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list);
-    if (AddDrawableMapping(dpy, ret, dd)) {
-        PFNGLXDESTROYGLXPBUFFERSGIXPROC pDestroyGLXPbufferSGIX;
-
-        __FETCH_FUNCTION_PTR(DestroyGLXPbufferSGIX);
-        if (pDestroyGLXPbufferSGIX)
-            (*pDestroyGLXPbufferSGIX)(dpy, ret);
-
-        return None;
-    }
-
-    return ret;
-}
-
-
-
-static GLXPixmap dispatch_CreateGLXPixmapWithConfigSGIX(Display *dpy,
-                                                        GLXFBConfigSGIX config,
-                                                        Pixmap pixmap)
-{
-    PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC pCreateGLXPixmapWithConfigSGIX;
-    __GLXvendorInfo *dd;
-    GLXPixmap ret;
-
-    dd = GetDispatchFromFBConfig(dpy, config);
-    if (dd == NULL)
-        return None;
-
-    __FETCH_FUNCTION_PTR(CreateGLXPixmapWithConfigSGIX);
-    if (pCreateGLXPixmapWithConfigSGIX == NULL)
-        return None;
-
-    ret = (*pCreateGLXPixmapWithConfigSGIX)(dpy, config, pixmap);
-    if (AddDrawableMapping(dpy, ret, dd)) {
-        /* XXX: Call glXDestroyGLXPixmap which lives in libglvnd. If we're not
-         * allowed to call it from here, should we extend __glXDispatchTableIndices ?
-         */
-        return None;
-    }
-
-    return ret;
-}
-
-
-
-static void dispatch_DestroyGLXPbufferSGIX(Display *dpy, GLXPbuffer pbuf)
-{
-    PFNGLXDESTROYGLXPBUFFERSGIXPROC pDestroyGLXPbufferSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, pbuf);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(DestroyGLXPbufferSGIX);
-    if (pDestroyGLXPbufferSGIX == NULL)
-        return;
-
-    (*pDestroyGLXPbufferSGIX)(dpy, pbuf);
-}
-
-
-
-static GLXContextID dispatch_GetContextIDEXT(const GLXContext ctx)
-{
-    PFNGLXGETCONTEXTIDEXTPROC pGetContextIDEXT;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromContext(ctx);
-    if (dd == NULL)
-        return None;
-
-    __FETCH_FUNCTION_PTR(GetContextIDEXT);
-    if (pGetContextIDEXT == NULL)
-        return None;
-
-    return (*pGetContextIDEXT)(ctx);
-}
-
-
-
-static Display *dispatch_GetCurrentDisplayEXT(void)
-{
-    PFNGLXGETCURRENTDISPLAYEXTPROC pGetCurrentDisplayEXT;
-    __GLXvendorInfo *dd;
-
-    if (!__VND->getCurrentContext())
-        return NULL;
-
-    dd = __VND->getCurrentDynDispatch();
-    if (dd == NULL)
-        return NULL;
-
-    __FETCH_FUNCTION_PTR(GetCurrentDisplayEXT);
-    if (pGetCurrentDisplayEXT == NULL)
-        return NULL;
-
-    return (*pGetCurrentDisplayEXT)();
-}
-
-
-
-static int dispatch_GetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config,
-                                          int attribute, int *value_return)
-{
-    PFNGLXGETFBCONFIGATTRIBSGIXPROC pGetFBConfigAttribSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromFBConfig(dpy, config);
-    if (dd == NULL)
-        return GLX_NO_EXTENSION;
-
-    __FETCH_FUNCTION_PTR(GetFBConfigAttribSGIX);
-    if (pGetFBConfigAttribSGIX == NULL)
-        return GLX_NO_EXTENSION;
-
-    return (*pGetFBConfigAttribSGIX)(dpy, config, attribute, value_return);
-}
-
-
-
-static GLXFBConfigSGIX dispatch_GetFBConfigFromVisualSGIX(Display *dpy,
-                                                          XVisualInfo *vis)
-{
-    PFNGLXGETFBCONFIGFROMVISUALSGIXPROC pGetFBConfigFromVisualSGIX;
-    __GLXvendorInfo *dd;
-    GLXFBConfigSGIX ret = NULL;
-
-    dd = GetDispatchFromVisual(dpy, vis);
-    if (dd == NULL)
-        return NULL;
-
-    __FETCH_FUNCTION_PTR(GetFBConfigFromVisualSGIX);
-    if (pGetFBConfigFromVisualSGIX == NULL)
-        return NULL;
-
-    ret = (*pGetFBConfigFromVisualSGIX)(dpy, vis);
-    if (AddFBConfigMapping(dpy, ret, dd))
-        /* XXX: dealloc ret ? */
-        return NULL;
-
-    return ret;
-}
-
-
-
-static void dispatch_GetSelectedEventSGIX(Display *dpy, GLXDrawable drawable,
-                                          unsigned long *mask)
-{
-    PFNGLXGETSELECTEDEVENTSGIXPROC pGetSelectedEventSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(GetSelectedEventSGIX);
-    if (pGetSelectedEventSGIX == NULL)
-        return;
-
-    (*pGetSelectedEventSGIX)(dpy, drawable, mask);
-}
-
-
-
-static int dispatch_GetVideoSyncSGI(unsigned int *count)
-{
-    PFNGLXGETVIDEOSYNCSGIPROC pGetVideoSyncSGI;
-    __GLXvendorInfo *dd;
-
-    if (!__VND->getCurrentContext())
-        return GLX_BAD_CONTEXT;
-
-    dd = __VND->getCurrentDynDispatch();
-    if (dd == NULL)
-        return GLX_NO_EXTENSION;
-
-    __FETCH_FUNCTION_PTR(GetVideoSyncSGI);
-    if (pGetVideoSyncSGI == NULL)
-        return GLX_NO_EXTENSION;
-
-    return (*pGetVideoSyncSGI)(count);
-}
-
-
-
-static XVisualInfo *dispatch_GetVisualFromFBConfigSGIX(Display *dpy,
-                                                       GLXFBConfigSGIX config)
-{
-    PFNGLXGETVISUALFROMFBCONFIGSGIXPROC pGetVisualFromFBConfigSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromFBConfig(dpy, config);
-    if (dd == NULL)
-        return NULL;
-
-    __FETCH_FUNCTION_PTR(GetVisualFromFBConfigSGIX);
-    if (pGetVisualFromFBConfigSGIX == NULL)
-        return NULL;
-
-    return (*pGetVisualFromFBConfigSGIX)(dpy, config);
-}
-
-
-
-static int dispatch_QueryContextInfoEXT(Display *dpy, GLXContext ctx,
-                                        int attribute, int *value)
-{
-    PFNGLXQUERYCONTEXTINFOEXTPROC pQueryContextInfoEXT;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromContext(ctx);
-    if (dd == NULL)
-        return GLX_NO_EXTENSION;
-
-    __FETCH_FUNCTION_PTR(QueryContextInfoEXT);
-    if (pQueryContextInfoEXT == NULL)
-        return GLX_NO_EXTENSION;
-
-    return (*pQueryContextInfoEXT)(dpy, ctx, attribute, value);
-}
-
-
-
-static void dispatch_QueryGLXPbufferSGIX(Display *dpy, GLXPbuffer pbuf,
-                                         int attribute, unsigned int *value)
-{
-    PFNGLXQUERYGLXPBUFFERSGIXPROC pQueryGLXPbufferSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, pbuf);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(QueryGLXPbufferSGIX);
-    if (pQueryGLXPbufferSGIX == NULL)
-        return;
-
-    (*pQueryGLXPbufferSGIX)(dpy, pbuf, attribute, value);
-}
-
-
-
-static void dispatch_ReleaseTexImageEXT(Display *dpy, GLXDrawable drawable,
-                                        int buffer)
-{
-    PFNGLXRELEASETEXIMAGEEXTPROC pReleaseTexImageEXT;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(ReleaseTexImageEXT);
-    if (pReleaseTexImageEXT == NULL)
-        return;
-
-    (*pReleaseTexImageEXT)(dpy, drawable, buffer);
-}
-
-
-
-static void dispatch_SelectEventSGIX(Display *dpy, GLXDrawable drawable,
-                                     unsigned long mask)
-{
-    PFNGLXSELECTEVENTSGIXPROC pSelectEventSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(SelectEventSGIX);
-    if (pSelectEventSGIX == NULL)
-        return;
-
-    (*pSelectEventSGIX)(dpy, drawable, mask);
-}
-
-
-
-static int dispatch_SwapIntervalSGI(int interval)
-{
-    PFNGLXSWAPINTERVALSGIPROC pSwapIntervalSGI;
-    __GLXvendorInfo *dd;
-
-    if (!__VND->getCurrentContext())
-        return GLX_BAD_CONTEXT;
-
-    dd = __VND->getCurrentDynDispatch();
-    if (dd == NULL)
-        return GLX_NO_EXTENSION;
-
-    __FETCH_FUNCTION_PTR(SwapIntervalSGI);
-    if (pSwapIntervalSGI == NULL)
-        return GLX_NO_EXTENSION;
-
-    return (*pSwapIntervalSGI)(interval);
-}
-
-
-
-static int dispatch_WaitVideoSyncSGI(int divisor, int remainder,
-                                     unsigned int *count)
-{
-    PFNGLXWAITVIDEOSYNCSGIPROC pWaitVideoSyncSGI;
-    __GLXvendorInfo *dd;
-
-    if (!__VND->getCurrentContext())
-        return GLX_BAD_CONTEXT;
-
-    dd = __VND->getCurrentDynDispatch();
-    if (dd == NULL)
-        return GLX_NO_EXTENSION;
-
-    __FETCH_FUNCTION_PTR(WaitVideoSyncSGI);
-    if (pWaitVideoSyncSGI == NULL)
-        return GLX_NO_EXTENSION;
-
-    return (*pWaitVideoSyncSGI)(divisor, remainder, count);
-}
-
-
-
-static void dispatch_BindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable,
-                                            int barrier)
-{
-    PFNGLXBINDSWAPBARRIERSGIXPROC pBindSwapBarrierSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(BindSwapBarrierSGIX);
-    if (pBindSwapBarrierSGIX == NULL)
-        return;
-
-    (*pBindSwapBarrierSGIX)(dpy, drawable, barrier);
-}
-
-
-
-static void dispatch_CopySubBufferMESA(Display *dpy, GLXDrawable drawable,
-                                          int x, int y, int width, int height)
-{
-    PFNGLXCOPYSUBBUFFERMESAPROC pCopySubBufferMESA;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(CopySubBufferMESA);
-    if (pCopySubBufferMESA == NULL)
-        return;
-
-    (*pCopySubBufferMESA)(dpy, drawable, x, y, width, height);
-}
-
-
-
-static GLXPixmap dispatch_CreateGLXPixmapMESA(Display *dpy,
-                                                 XVisualInfo *visinfo,
-                                                 Pixmap pixmap, Colormap cmap)
-{
-    PFNGLXCREATEGLXPIXMAPMESAPROC pCreateGLXPixmapMESA;
-    __GLXvendorInfo *dd;
-    GLXPixmap ret;
-
-    dd = GetDispatchFromVisual(dpy, visinfo);
-    if (dd == NULL)
-        return None;
-
-    __FETCH_FUNCTION_PTR(CreateGLXPixmapMESA);
-    if (pCreateGLXPixmapMESA == NULL)
-        return None;
-
-    ret = (*pCreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap);
-    if (AddDrawableMapping(dpy, ret, dd)) {
-        /* XXX: Call glXDestroyGLXPixmap which lives in libglvnd. If we're not
-         * allowed to call it from here, should we extend __glXDispatchTableIndices ?
-         */
-        return None;
-    }
-
-    return ret;
-}
-
-
-
-static GLboolean dispatch_GetMscRateOML(Display *dpy, GLXDrawable drawable,
-                                           int32_t *numerator, int32_t *denominator)
-{
-    PFNGLXGETMSCRATEOMLPROC pGetMscRateOML;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return GL_FALSE;
-
-    __FETCH_FUNCTION_PTR(GetMscRateOML);
-    if (pGetMscRateOML == NULL)
-        return GL_FALSE;
-
-    return (*pGetMscRateOML)(dpy, drawable, numerator, denominator);
-}
-
-
-
-static const char *dispatch_GetScreenDriver(Display *dpy, int scrNum)
-{
-    typedef const char *(*fn_glXGetScreenDriver_ptr)(Display *dpy, int scrNum);
-    fn_glXGetScreenDriver_ptr pGetScreenDriver;
-    __GLXvendorInfo *dd;
-
-    dd = __VND->getDynDispatch(dpy, scrNum);
-    if (dd == NULL)
-        return NULL;
-
-    __FETCH_FUNCTION_PTR(GetScreenDriver);
-    if (pGetScreenDriver == NULL)
-        return NULL;
-
-    return (*pGetScreenDriver)(dpy, scrNum);
-}
-
-
-
-static int dispatch_GetSwapIntervalMESA(void)
-{
-    PFNGLXGETSWAPINTERVALMESAPROC pGetSwapIntervalMESA;
-    __GLXvendorInfo *dd;
-
-    if (!__VND->getCurrentContext())
-        return GLX_BAD_CONTEXT;
-
-    dd = __VND->getCurrentDynDispatch();
-    if (dd == NULL)
-        return 0;
-
-    __FETCH_FUNCTION_PTR(GetSwapIntervalMESA);
-    if (pGetSwapIntervalMESA == NULL)
-        return 0;
-
-    return (*pGetSwapIntervalMESA)();
-}
-
-
-
-static Bool dispatch_GetSyncValuesOML(Display *dpy, GLXDrawable drawable,
-                                         int64_t *ust, int64_t *msc, int64_t *sbc)
-{
-    PFNGLXGETSYNCVALUESOMLPROC pGetSyncValuesOML;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return False;
-
-    __FETCH_FUNCTION_PTR(GetSyncValuesOML);
-    if (pGetSyncValuesOML == NULL)
-        return False;
-
-    return (*pGetSyncValuesOML)(dpy, drawable, ust, msc, sbc);
-}
-
-
-
-static void dispatch_JoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable,
-                                          GLXDrawable member)
-{
-    PFNGLXJOINSWAPGROUPSGIXPROC pJoinSwapGroupSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return;
-
-    __FETCH_FUNCTION_PTR(JoinSwapGroupSGIX);
-    if (pJoinSwapGroupSGIX == NULL)
-        return;
-
-    (*pJoinSwapGroupSGIX)(dpy, drawable, member);
-}
-
-
-
-static Bool dispatch_QueryCurrentRendererIntegerMESA(int attribute,
-                                                        unsigned int *value)
-{
-    PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC pQueryCurrentRendererIntegerMESA;
-    __GLXvendorInfo *dd;
-
-    if (!__VND->getCurrentContext())
-        return False;
-
-    dd = __VND->getCurrentDynDispatch();
-    if (dd == NULL)
-        return False;
-
-    __FETCH_FUNCTION_PTR(QueryCurrentRendererIntegerMESA);
-    if (pQueryCurrentRendererIntegerMESA == NULL)
-        return False;
-
-    return (*pQueryCurrentRendererIntegerMESA)(attribute, value);
-}
-
-
-
-static const char *dispatch_QueryCurrentRendererStringMESA(int attribute)
-{
-    PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC pQueryCurrentRendererStringMESA;
-    __GLXvendorInfo *dd;
-
-    if (!__VND->getCurrentContext())
-        return NULL;
-
-    dd = __VND->getCurrentDynDispatch();
-    if (dd == NULL)
-        return NULL;
-
-    __FETCH_FUNCTION_PTR(QueryCurrentRendererStringMESA);
-    if (pQueryCurrentRendererStringMESA == NULL)
-        return NULL;
-
-    return (*pQueryCurrentRendererStringMESA)(attribute);
-}
-
-
-
-static Bool dispatch_QueryMaxSwapBarriersSGIX(Display *dpy, int screen,
-                                                 int *max)
-{
-    PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC pQueryMaxSwapBarriersSGIX;
-    __GLXvendorInfo *dd;
-
-    dd = __VND->getDynDispatch(dpy, screen);
-    if (dd == NULL)
-        return False;
-
-    __FETCH_FUNCTION_PTR(QueryMaxSwapBarriersSGIX);
-    if (pQueryMaxSwapBarriersSGIX == NULL)
-        return False;
-
-    return (*pQueryMaxSwapBarriersSGIX)(dpy, screen, max);
-}
-
-
-
-static Bool dispatch_QueryRendererIntegerMESA(Display *dpy, int screen,
-                                                 int renderer, int attribute,
-                                                 unsigned int *value)
-{
-    PFNGLXQUERYRENDERERINTEGERMESAPROC pQueryRendererIntegerMESA;
-    __GLXvendorInfo *dd;
-
-    dd = __VND->getDynDispatch(dpy, screen);
-    if (dd == NULL)
-        return False;
-
-    __FETCH_FUNCTION_PTR(QueryRendererIntegerMESA);
-    if (pQueryRendererIntegerMESA == NULL)
-        return False;
-
-    return (*pQueryRendererIntegerMESA)(dpy, screen, renderer, attribute, value);
-}
-
-
-
-static const char *dispatch_QueryRendererStringMESA(Display *dpy, int screen,
-                                                       int renderer, int attribute)
-{
-    PFNGLXQUERYRENDERERSTRINGMESAPROC pQueryRendererStringMESA;
-    __GLXvendorInfo *dd = NULL;
-
-    dd = __VND->getDynDispatch(dpy, screen);
-    if (dd == NULL)
-        return NULL;
-
-    __FETCH_FUNCTION_PTR(QueryRendererStringMESA);
-    if (pQueryRendererStringMESA == NULL)
-        return NULL;
-
-    return (*pQueryRendererStringMESA)(dpy, screen, renderer, attribute);
-}
-
-
-
-static Bool dispatch_ReleaseBuffersMESA(Display *dpy, GLXDrawable d)
-{
-    PFNGLXRELEASEBUFFERSMESAPROC pReleaseBuffersMESA;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, d);
-    if (dd == NULL)
-        return False;
-
-    __FETCH_FUNCTION_PTR(ReleaseBuffersMESA);
-    if (pReleaseBuffersMESA == NULL)
-        return False;
-
-    return (*pReleaseBuffersMESA)(dpy, d);
-}
-
-
-
-static int64_t dispatch_SwapBuffersMscOML(Display *dpy, GLXDrawable drawable,
-                                             int64_t target_msc, int64_t divisor,
-                                             int64_t remainder)
-{
-    PFNGLXSWAPBUFFERSMSCOMLPROC pSwapBuffersMscOML;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return 0;
-
-    __FETCH_FUNCTION_PTR(SwapBuffersMscOML);
-    if (pSwapBuffersMscOML == NULL)
-        return 0;
-
-    return (*pSwapBuffersMscOML)(dpy, drawable, target_msc, divisor, remainder);
-}
-
-
-
-static int dispatch_SwapIntervalMESA(unsigned int interval)
-{
-    PFNGLXSWAPINTERVALMESAPROC pSwapIntervalMESA;
-    __GLXvendorInfo *dd;
-
-    if (!__VND->getCurrentContext())
-        return GLX_BAD_CONTEXT;
-
-    dd = __VND->getCurrentDynDispatch();
-    if (dd == NULL)
-        return 0;
-
-    __FETCH_FUNCTION_PTR(SwapIntervalMESA);
-    if (pSwapIntervalMESA == NULL)
-        return 0;
-
-    return (*pSwapIntervalMESA)(interval);
-}
-
-
-
-static Bool dispatch_WaitForMscOML(Display *dpy, GLXDrawable drawable,
-                                      int64_t target_msc, int64_t divisor,
-                                      int64_t remainder, int64_t *ust,
-                                      int64_t *msc, int64_t *sbc)
-{
-    PFNGLXWAITFORMSCOMLPROC pWaitForMscOML;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return False;
-
-    __FETCH_FUNCTION_PTR(WaitForMscOML);
-    if (pWaitForMscOML == NULL)
-        return False;
-
-    return (*pWaitForMscOML)(dpy, drawable, target_msc, divisor, remainder, ust, msc, sbc);
-}
-
-
-
-static Bool dispatch_WaitForSbcOML(Display *dpy, GLXDrawable drawable,
-                                      int64_t target_sbc, int64_t *ust,
-                                      int64_t *msc, int64_t *sbc)
-{
-    PFNGLXWAITFORSBCOMLPROC pWaitForSbcOML;
-    __GLXvendorInfo *dd;
-
-    dd = GetDispatchFromDrawable(dpy, drawable);
-    if (dd == NULL)
-        return False;
-
-    __FETCH_FUNCTION_PTR(WaitForSbcOML);
-    if (pWaitForSbcOML == NULL)
-        return False;
-
-    return (*pWaitForSbcOML)(dpy, drawable, target_sbc, ust, msc, sbc);
-}
-
-#undef __FETCH_FUNCTION_PTR
-
-
-/* Allocate an extra 'dummy' to ease lookup. See FindGLXFunction() */
-const void * const __glXDispatchFunctions[DI_LAST_INDEX + 1] = {
-#define __ATTRIB(field) \
-    [DI_##field] = (void *)dispatch_##field
-
-    __ATTRIB(BindSwapBarrierSGIX),
-    __ATTRIB(BindTexImageEXT),
-    __ATTRIB(ChooseFBConfigSGIX),
-    __ATTRIB(CopySubBufferMESA),
-    __ATTRIB(CreateContextAttribsARB),
-    __ATTRIB(CreateContextWithConfigSGIX),
-    __ATTRIB(CreateGLXPbufferSGIX),
-    __ATTRIB(CreateGLXPixmapMESA),
-    __ATTRIB(CreateGLXPixmapWithConfigSGIX),
-    __ATTRIB(DestroyGLXPbufferSGIX),
-    __ATTRIB(GetContextIDEXT),
-    __ATTRIB(GetCurrentDisplayEXT),
-    __ATTRIB(GetFBConfigAttribSGIX),
-    __ATTRIB(GetFBConfigFromVisualSGIX),
-    __ATTRIB(GetMscRateOML),
-    __ATTRIB(GetScreenDriver),
-    __ATTRIB(GetSelectedEventSGIX),
-    __ATTRIB(GetSwapIntervalMESA),
-    __ATTRIB(GetSyncValuesOML),
-    __ATTRIB(GetVideoSyncSGI),
-    __ATTRIB(GetVisualFromFBConfigSGIX),
-    __ATTRIB(JoinSwapGroupSGIX),
-    __ATTRIB(QueryContextInfoEXT),
-    __ATTRIB(QueryCurrentRendererIntegerMESA),
-    __ATTRIB(QueryCurrentRendererStringMESA),
-    __ATTRIB(QueryGLXPbufferSGIX),
-    __ATTRIB(QueryMaxSwapBarriersSGIX),
-    __ATTRIB(QueryRendererIntegerMESA),
-    __ATTRIB(QueryRendererStringMESA),
-    __ATTRIB(ReleaseBuffersMESA),
-    __ATTRIB(ReleaseTexImageEXT),
-    __ATTRIB(SelectEventSGIX),
-    __ATTRIB(SwapBuffersMscOML),
-    __ATTRIB(SwapIntervalMESA),
-    __ATTRIB(SwapIntervalSGI),
-    __ATTRIB(WaitForMscOML),
-    __ATTRIB(WaitForSbcOML),
-    __ATTRIB(WaitVideoSyncSGI),
-
-    [DI_LAST_INDEX] = NULL,
-#undef __ATTRIB
-};
diff --git a/src/glx/g_glxglvnddispatchindices.h b/src/glx/g_glxglvnddispatchindices.h
deleted file mode 100644
index 05a2c8c..0000000
--- a/src/glx/g_glxglvnddispatchindices.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * THIS FILE IS AUTOMATICALLY GENERATED BY gen_scrn_dispatch.pl
- * DO NOT EDIT!!
- */
-#ifndef __glxlibglvnd_dispatchindex_h__
-#define __glxlibglvnd_dispatchindex_h__
-
-typedef enum __GLXdispatchIndex {
-    DI_BindSwapBarrierSGIX,
-    DI_BindTexImageEXT,
-    // ChooseFBConfig implemented by libglvnd
-    DI_ChooseFBConfigSGIX,
-    // ChooseVisual implemented by libglvnd
-    // CopyContext implemented by libglvnd
-    DI_CopySubBufferMESA,
-    // CreateContext implemented by libglvnd
-    DI_CreateContextAttribsARB,
-    DI_CreateContextWithConfigSGIX,
-    DI_CreateGLXPbufferSGIX,
-    // CreateGLXPixmap implemented by libglvnd
-    DI_CreateGLXPixmapMESA,
-    DI_CreateGLXPixmapWithConfigSGIX,
-    // CreateNewContext implemented by libglvnd
-    // CreatePbuffer implemented by libglvnd
-    // CreatePixmap implemented by libglvnd
-    // CreateWindow implemented by libglvnd
-    // DestroyContext implemented by libglvnd
-    DI_DestroyGLXPbufferSGIX,
-    // DestroyGLXPixmap implemented by libglvnd
-    // DestroyPbuffer implemented by libglvnd
-    // DestroyPixmap implemented by libglvnd
-    // DestroyWindow implemented by libglvnd
-    // FreeContextEXT implemented by libglvnd
-    // GetClientString implemented by libglvnd
-    // GetConfig implemented by libglvnd
-    DI_GetContextIDEXT,
-    // GetCurrentContext implemented by libglvnd
-    // GetCurrentDisplay implemented by libglvnd
-    DI_GetCurrentDisplayEXT,
-    // GetCurrentDrawable implemented by libglvnd
-    // GetCurrentReadDrawable implemented by libglvnd
-    // GetFBConfigAttrib implemented by libglvnd
-    DI_GetFBConfigAttribSGIX,
-    DI_GetFBConfigFromVisualSGIX,
-    // GetFBConfigs implemented by libglvnd
-    DI_GetMscRateOML,
-    // GetProcAddress implemented by libglvnd
-    // GetProcAddressARB implemented by libglvnd
-    DI_GetScreenDriver,
-    // GetSelectedEvent implemented by libglvnd
-    DI_GetSelectedEventSGIX,
-    DI_GetSwapIntervalMESA,
-    DI_GetSyncValuesOML,
-    DI_GetVideoSyncSGI,
-    // GetVisualFromFBConfig implemented by libglvnd
-    DI_GetVisualFromFBConfigSGIX,
-    // ImportContextEXT implemented by libglvnd
-    // IsDirect implemented by libglvnd
-    DI_JoinSwapGroupSGIX,
-    // MakeContextCurrent implemented by libglvnd
-    // MakeCurrent implemented by libglvnd
-    // QueryContext implemented by libglvnd
-    DI_QueryContextInfoEXT,
-    DI_QueryCurrentRendererIntegerMESA,
-    DI_QueryCurrentRendererStringMESA,
-    // QueryDrawable implemented by libglvnd
-    // QueryExtension implemented by libglvnd
-    // QueryExtensionsString implemented by libglvnd
-    DI_QueryGLXPbufferSGIX,
-    DI_QueryMaxSwapBarriersSGIX,
-    DI_QueryRendererIntegerMESA,
-    DI_QueryRendererStringMESA,
-    // QueryServerString implemented by libglvnd
-    // QueryVersion implemented by libglvnd
-    DI_ReleaseBuffersMESA,
-    DI_ReleaseTexImageEXT,
-    // SelectEvent implemented by libglvnd
-    DI_SelectEventSGIX,
-    // SwapBuffers implemented by libglvnd
-    DI_SwapBuffersMscOML,
-    DI_SwapIntervalMESA,
-    DI_SwapIntervalSGI,
-    // UseXFont implemented by libglvnd
-    DI_WaitForMscOML,
-    DI_WaitForSbcOML,
-    // WaitGL implemented by libglvnd
-    DI_WaitVideoSyncSGI,
-    // WaitX implemented by libglvnd
-    DI_LAST_INDEX
-} __GLXdispatchIndex;
-
-#endif // __glxlibglvnd_dispatchindex_h__
diff --git a/src/glx/glxdispatchstubs.c b/src/glx/glxdispatchstubs.c
new file mode 100644
index 0000000..261bac7
--- /dev/null
+++ b/src/glx/glxdispatchstubs.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2016, NVIDIA CORPORATION.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * unaltered in all copies or substantial portions of the Materials.
+ * Any additions, deletions, or changes to the original source files
+ * must be clearly indicated in accompanying documentation.
+ *
+ * If only executable code is distributed, then the accompanying
+ * documentation must state that "this software is based in part on the
+ * work of the Khronos Group."
+ *
+ * THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ */
+
+#include "glxdispatchstubs.h"
+
+#include <X11/Xlibint.h>
+#include <GL/glxproto.h>
+#include <string.h>
+
+#include "g_glxdispatchstubs.h"
+
+const __GLXapiExports *__glXDispatchApiExports = NULL;
+int __glXDispatchFuncIndices[__GLX_DISPATCH_COUNT + 1];
+const int __GLX_DISPATCH_FUNCTION_COUNT = __GLX_DISPATCH_COUNT;
+
+static int CompareFunctionName(const void *ptr1, const void *ptr2)
+{
+    return strcmp(*((const char **) ptr1), *((const char **) ptr2));
+}
+
+static int FindProcIndex(const GLubyte *name)
+{
+    const char **ptr = (const char **) bsearch(&name, __GLX_DISPATCH_FUNC_NAMES,
+            __GLX_DISPATCH_COUNT, sizeof(char *),
+            CompareFunctionName);
+    if (ptr != NULL) {
+        return (ptr - __GLX_DISPATCH_FUNC_NAMES);
+    } else {
+        /* Just point to the dummy entry at the end of the respective table */
+        return __GLX_DISPATCH_COUNT;
+    }
+}
+
+void __glxInitDispatchStubs(const __GLXapiExports *exportsTable)
+{
+    int i;
+    __glXDispatchApiExports = exportsTable;
+    for (i=0; i<__GLX_DISPATCH_COUNT; i++) {
+        __glXDispatchFuncIndices[i] = -1;
+    }
+}
+
+void __glxSetDispatchIndex(const GLubyte *name, int dispatchIndex)
+{
+    int index = FindProcIndex(name);
+    __glXDispatchFuncIndices[index] = dispatchIndex;
+}
+
+void *__glxDispatchFindDispatchFunction(const GLubyte *name)
+{
+    int index = FindProcIndex(name);
+    return __GLX_DISPATCH_FUNCS[index];
+}
+
+__GLXvendorInfo *__glxDispatchVendorByDrawable(Display *dpy, GLXDrawable draw,
+        int opcode, int error)
+{
+    __GLXvendorInfo *vendor = NULL;
+
+    if (draw != None) {
+        vendor = __glXDispatchApiExports->vendorFromDrawable(dpy, draw);
+    }
+    if (vendor == NULL && dpy != NULL && opcode >= 0 && error >= 0) {
+        __glXSendError(dpy, error, draw, opcode, False);
+    }
+    return vendor;
+}
+
+__GLXvendorInfo *__glxDispatchVendorByContext(Display *dpy, GLXContext context,
+        int opcode)
+{
+    __GLXvendorInfo *vendor = NULL;
+
+    if (context != NULL) {
+        vendor = __glXDispatchApiExports->vendorFromContext(context);
+    }
+    if (vendor == NULL && dpy != NULL && opcode >= 0) {
+        __glXSendError(dpy, GLXBadContext, 0, opcode, False);
+    }
+    return vendor;
+}
+
+__GLXvendorInfo *__glxDispatchVendorByConfig(Display *dpy, GLXFBConfig config,
+        int opcode)
+{
+    __GLXvendorInfo *vendor = NULL;
+
+    if (config != NULL) {
+        vendor = __glXDispatchApiExports->vendorFromFBConfig(dpy, config);
+    }
+    if (vendor == NULL && dpy != NULL && opcode >= 0) {
+        __glXSendError(dpy, GLXBadFBConfig, 0, opcode, False);
+    }
+    return vendor;
+}
+
+
+GLXContext __glXDispatchAddContextMapping(Display *dpy, GLXContext context, __GLXvendorInfo *vendor)
+{
+    if (context != NULL) {
+        if (__glXDispatchApiExports->addVendorContextMapping(dpy, context, vendor) != 0) {
+            // We couldn't add the new context to libGLX's mapping. Call into
+            // the vendor to destroy the context again before returning.
+            typedef void (* pfn_glXDestroyContext) (Display *dpy, GLXContext ctx);
+            pfn_glXDestroyContext ptr_glXDestroyContext = (pfn_glXDestroyContext)
+                __glXDispatchApiExports->fetchDispatchEntry(vendor,
+                        __glXDispatchFuncIndices[__GLX_DISPATCH_glXDestroyContext]);
+            if (ptr_glXDestroyContext != NULL) {
+                ptr_glXDestroyContext(dpy, context);
+            }
+            context = NULL;
+        }
+    }
+    return context;
+}
+
+void __glXDispatchAddDrawableMapping(Display *dpy, GLXDrawable draw, __GLXvendorInfo *vendor)
+{
+    if (draw != None) {
+        // We don't have to worry about failing to add a mapping in this case,
+        // because libGLX can look up the vendor for the drawable on its own.
+        __glXDispatchApiExports->addVendorDrawableMapping(dpy, draw, vendor);
+    }
+}
+
+GLXFBConfig __glXDispatchAddFBConfigMapping(Display *dpy, GLXFBConfig config, __GLXvendorInfo *vendor)
+{
+    if (config != NULL) {
+        if (__glXDispatchApiExports->addVendorFBConfigMapping(dpy, config, vendor) != 0) {
+            config = NULL;
+        }
+    }
+    return config;
+}
+
+GLXFBConfig *__glXDispatchAddFBConfigListMapping(Display *dpy, GLXFBConfig *configs, int *nelements, __GLXvendorInfo *vendor)
+{
+    if (configs != NULL && nelements != NULL) {
+        int i;
+        Bool success = True;
+        for (i=0; i<*nelements; i++) {
+            if (__glXDispatchApiExports->addVendorFBConfigMapping(dpy, configs[i], vendor) != 0) {
+                success = False;
+                break;
+            }
+        }
+        if (!success) {
+            XFree(configs);
+            configs = NULL;
+            *nelements = 0;
+        }
+    }
+    return configs;
+}
+
diff --git a/src/glx/glxdispatchstubs.h b/src/glx/glxdispatchstubs.h
new file mode 100644
index 0000000..ea032a1
--- /dev/null
+++ b/src/glx/glxdispatchstubs.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2016, NVIDIA CORPORATION.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * unaltered in all copies or substantial portions of the Materials.
+ * Any additions, deletions, or changes to the original source files
+ * must be clearly indicated in accompanying documentation.
+ *
+ * If only executable code is distributed, then the accompanying
+ * documentation must state that "this software is based in part on the
+ * work of the Khronos Group."
+ *
+ * THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ */
+
+#ifndef GLXDISPATCHSTUBS_H
+#define GLXDISPATCHSTUBS_H
+
+/*!
+ * \file
+ *
+ * Functions for GLX dispatch stubs.
+ *
+ * This file declares various helper functions used with the GLX dispatch stubs.
+ */
+
+#include "glvnd/libglxabi.h"
+
+/*!
+ * An array containing the names of all known GLX functions.
+ */
+extern const char * const __GLX_DISPATCH_FUNC_NAMES[];
+
+/*!
+ * An array containing the dispatch stubs for GLX functions. Note that some
+ * elements may be NULL if no dispatch function is defined. This is used for
+ * functions like glXDestroyContext, where we'll need an index so that we can
+ * look up the function from other dispatch stubs.
+ */
+extern const __GLXextFuncPtr __GLX_DISPATCH_FUNCS[];
+
+/*!
+ * The dispatch index for each function.
+ */
+extern int __glXDispatchFuncIndices[];
+
+/*!
+ * The number of GLX functions. This is the length of the
+ * \c __GLX_DISPATCH_FUNC_NAMES, \c __GLX_DISPATCH_FUNCS, and
+ * \c __glXDispatchFuncIndices arrays.
+ */
+extern const int __GLX_DISPATCH_FUNCTION_COUNT;
+
+/*!
+ * A pointer to the exports table from libGLX.
+ */
+extern const __GLXapiExports *__glXDispatchApiExports;
+
+/*!
+ * Initializes the dispatch functions.
+ *
+ * This will set the __GLXapiExports pointer for the stubs to use and will
+ * initialize the index array.
+ */
+void __glxInitDispatchStubs(const __GLXapiExports *exportsTable);
+
+/*!
+ * Sets the dispatch index for a function.
+ *
+ * This function can be used for the vendor's \c __GLXapiImports::setDispatchIndex
+ * callback.
+ */
+void __glxSetDispatchIndex(const GLubyte *name, int index);
+
+/*!
+ * Returns the dispatch function for the given name, or \c NULL if the function
+ * isn't supported.
+ *
+ * This function can be used for the vendor's \c __GLXapiImports::getDispatchAddress
+ * callback.
+ */
+void *__glxDispatchFindDispatchFunction(const GLubyte *name);
+
+/*!
+ * Reports an X error. This function must be defined by the vendor library.
+ */
+void __glXSendError(Display *dpy, unsigned char errorCode,
+        XID resourceID, unsigned char minorCode, Bool coreX11error);
+
+// Helper functions used by the generated stubs.
+
+/*!
+ * Looks up a vendor from a drawable.
+ *
+ * If \p opcode and \p error are non-negative, then they are used to report an
+ * X error if the lookup fails.
+ */
+__GLXvendorInfo *__glxDispatchVendorByDrawable(Display *dpy, GLXDrawable draw,
+        int opcode, int error);
+
+/*!
+ * Looks up a vendor from a context.
+ */
+__GLXvendorInfo *__glxDispatchVendorByContext(Display *dpy, GLXContext ctx,
+        int opcode);
+
+/*!
+ * Looks up a vendor from a GLXFBConfig.
+ */
+__GLXvendorInfo *__glxDispatchVendorByConfig(Display *dpy, GLXFBConfig config,
+        int opcode);
+
+/*!
+ * Adds a GLXContext to libGLX's mapping.
+ *
+ * If it fails to add the context to the map, then this function will try to
+ * destroy the context before returning.
+ *
+ * \param dpy The display pointer.
+ * \param context The context to add.
+ * \param vendor The vendor that owns the context.
+ * \return \p context on success, or \c NULL on failure.
+ */
+GLXContext __glXDispatchAddContextMapping(Display *dpy, GLXContext context, __GLXvendorInfo *vendor);
+
+/*!
+ * Adds a drawable to libGLX's mapping.
+ *
+ * Note that unlike contexts and configs, failing to add a drawable is not a
+ * problem. libGLX can query the server later to find out which vendor owns the
+ * drawable.
+ *
+ * \param dpy The display pointer.
+ * \param draw The drawable to add.
+ * \param vendor The vendor that owns the drawable.
+ */
+void __glXDispatchAddDrawableMapping(Display *dpy, GLXDrawable draw, __GLXvendorInfo *vendor);
+
+/*!
+ * Adds a GLXFBConfig to libGLX's mapping.
+ *
+ * \param dpy The display pointer.
+ * \param config The config to add.
+ * \param vendor The vendor that owns the config.
+ * \return \p config on success, or \c NULL on failure.
+ */
+GLXFBConfig __glXDispatchAddFBConfigMapping(Display *dpy, GLXFBConfig config, __GLXvendorInfo *vendor);
+
+/*!
+ * Adds an array of GLXFBConfigs to libGLX's mapping.
+ *
+ * If it fails to add any config, then it will free the \p configs array and
+ * set \p nelements to zero before returning.
+ *
+ * \param dpy The display pointer.
+ * \param configs The array of configs to add.
+ * \param nelements A pointer to the number of elements in \p configs.
+ * \param vendor The vendor that owns the configs.
+ * \return \p configs on success, or \c NULL on failure.
+ */
+GLXFBConfig *__glXDispatchAddFBConfigListMapping(Display *dpy, GLXFBConfig *configs, int *nelements, __GLXvendorInfo *vendor);
+
+#endif // GLXDISPATCHSTUBS_H
diff --git a/src/glx/glxglvnd.c b/src/glx/glxglvnd.c
index b6b4151..68b4742 100644
--- a/src/glx/glxglvnd.c
+++ b/src/glx/glxglvnd.c
@@ -4,7 +4,7 @@
 
 #include "glvnd/libglxabi.h"
 
-#include "glxglvnd.h"
+#include "glxdispatchstubs.h"
 
 static Bool __glXGLVNDIsScreenSupported(Display *dpy, int screen)
 {
@@ -17,43 +17,6 @@ static void *__glXGLVNDGetProcAddress(const GLubyte *procName)
     return glXGetProcAddressARB(procName);
 }
 
-static int
-compare(const void *l, const void *r)
-{
-    const char *s = *(const char **)r;
-    return strcmp(l, s);
-}
-
-static unsigned FindGLXFunction(const GLubyte *name)
-{
-    const char **match;
-
-    match = bsearch(name, __glXDispatchTableStrings, DI_FUNCTION_COUNT,
-                    sizeof(const char *), compare);
-
-    if (match == NULL)
-        return DI_FUNCTION_COUNT;
-
-    return match - __glXDispatchTableStrings;
-}
-
-static void *__glXGLVNDGetDispatchAddress(const GLubyte *procName)
-{
-    unsigned internalIndex = FindGLXFunction(procName);
-
-    return __glXDispatchFunctions[internalIndex];
-}
-
-static void __glXGLVNDSetDispatchIndex(const GLubyte *procName, int index)
-{
-    unsigned internalIndex = FindGLXFunction(procName);
-
-    if (internalIndex == DI_FUNCTION_COUNT)
-        return; /* unknown or static dispatch */
-
-    __glXDispatchTableIndices[internalIndex] = index;
-}
-
 _X_EXPORT Bool __glx_Main(uint32_t version, const __GLXapiExports *exports,
                           __GLXvendorInfo *vendor, __GLXapiImports *imports)
 {
@@ -67,12 +30,12 @@ _X_EXPORT Bool __glx_Main(uint32_t version, const __GLXapiExports *exports,
 
     if (!initDone) {
         initDone = True;
-        __glXGLVNDAPIExports = exports;
+        __glxInitDispatchStubs(exports);
 
         imports->isScreenSupported = __glXGLVNDIsScreenSupported;
         imports->getProcAddress = __glXGLVNDGetProcAddress;
-        imports->getDispatchAddress = __glXGLVNDGetDispatchAddress;
-        imports->setDispatchIndex = __glXGLVNDSetDispatchIndex;
+        imports->getDispatchAddress = __glxDispatchFindDispatchFunction;
+        imports->setDispatchIndex = __glxSetDispatchIndex;
         imports->notifyError = NULL;
         imports->isPatchSupported = NULL;
         imports->initiatePatch = NULL;
diff --git a/src/glx/glxglvnd.h b/src/glx/glxglvnd.h
deleted file mode 100644
index b1d8b62..0000000
--- a/src/glx/glxglvnd.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _glx_lib_glvnd_h_
-#define _glx_lib_glvnd_h_
-
-typedef struct __GLXapiExportsRec __GLXapiExports;
-
-extern const __GLXapiExports *__glXGLVNDAPIExports;
-
-extern const int DI_FUNCTION_COUNT;
-
-extern const void * const __glXDispatchFunctions[];
-extern int __glXDispatchTableIndices[];
-extern const char * const __glXDispatchTableStrings[];
-
-#endif
diff --git a/src/glx/glxglvnddispatchfuncs.h b/src/glx/glxglvnddispatchfuncs.h
deleted file mode 100644
index d9362ff..0000000
--- a/src/glx/glxglvnddispatchfuncs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef __glx_glvnd_dispatch_funcs_h__
-#define __glx_glvnd_dispatch_funcs_h__
-/*
- * Helper functions used by g_glxglvnddispatchfuncs.c.
- */
-#include "glvnd/libglxabi.h"
-#include "glxglvnd.h"
-
-#define __VND __glXGLVNDAPIExports
-
-static inline int AddFBConfigMapping(Display *dpy, GLXFBConfig config,
-                                     __GLXvendorInfo *vendor)
-{
-    return __VND->addVendorFBConfigMapping(dpy, config, vendor);
-}
-
-static inline int AddFBConfigsMapping(Display *dpy, const GLXFBConfig *ret,
-                                      int *nelements, __GLXvendorInfo *vendor)
-{
-    int i, r;
-
-    if (!nelements || !ret)
-        return 0;
-
-    for (i = 0; i < *nelements; i++) {
-        r = __VND->addVendorFBConfigMapping(dpy, ret[i], vendor);
-        if (r) {
-            for (; i >= 0; i--)
-                __VND->removeVendorFBConfigMapping(dpy, ret[i]);
-            break;
-        }
-    }
-    return r;
-}
-
-static inline int AddDrawableMapping(Display *dpy, GLXDrawable drawable,
-                                     __GLXvendorInfo *vendor)
-{
-    return __VND->addVendorDrawableMapping(dpy, drawable, vendor);
-}
-
-static inline int AddContextMapping(Display *dpy, GLXContext ctx,
-                                    __GLXvendorInfo *vendor)
-{
-    return __VND->addVendorContextMapping(dpy, ctx, vendor);
-}
-
-static inline __GLXvendorInfo *GetDispatchFromDrawable(Display *dpy,
-                                                       GLXDrawable drawable)
-{
-    return __VND->vendorFromDrawable(dpy, drawable);
-}
-
-static inline __GLXvendorInfo *GetDispatchFromContext(GLXContext ctx)
-{
-    return __VND->vendorFromContext(ctx);
-}
-
-static inline __GLXvendorInfo *GetDispatchFromFBConfig(Display *dpy, GLXFBConfig config)
-{
-    return __VND->vendorFromFBConfig(dpy, config);
-}
-
-static inline __GLXvendorInfo *GetDispatchFromVisual(Display *dpy,
-                                                     const XVisualInfo *visual)
-{
-    return __VND->getDynDispatch(dpy, visual->screen);
-}
-
-#endif // __glx_glvnd_dispatch_funcs_h__
-- 
2.7.4



More information about the mesa-dev mailing list