Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/xorg]: xsrc/external/mit/MesaLib/dist/src Import mesa 19.1.7



details:   https://anonhg.NetBSD.org/xsrc/rev/9b644641f5d3
branches:  xorg
changeset: 10383:9b644641f5d3
user:      maya <maya%NetBSD.org@localhost>
date:      Tue Sep 24 18:00:54 2019 +0000

description:
Import mesa 19.1.7

New features in mesa 19.1.0:

    GL_ARB_parallel_shader_compile on all drivers.
    GL_EXT_gpu_shader4 on all GL 3.1 drivers.
    GL_EXT_shader_image_load_formatted on radeonsi.
    GL_EXT_texture_buffer_object on all GL 3.1 drivers.
    GL_EXT_texture_compression_s3tc_srgb on Gallium drivers and i965 (ES extension).
    GL_NV_compute_shader_derivatives on iris and i965.
    GL_KHR_parallel_shader_compile on all drivers.
    VK_EXT_buffer_device_address on Intel and RADV.
    VK_EXT_depth_clip_enable on Intel and RADV.
    VK_KHR_ycbcr_image_arrays on Intel.
    VK_EXT_inline_uniform_block on Intel and RADV.
    VK_EXT_external_memory_host on Intel.
    VK_EXT_host_query_reset on Intel and RADV.
    VK_KHR_surface_protected_capabilities on Intel and RADV.
    VK_EXT_pipeline_creation_feedback on Intel and RADV.
    VK_KHR_8bit_storage on RADV.
    VK_AMD_gpu_shader_int16 on RADV.
    VK_AMD_gpu_shader_half_float on RADV.
    VK_NV_compute_shader_derivatives on Intel.
    VK_KHR_shader_float16_int8 on Intel and RADV (RADV only supports int8).
    VK_KHR_shader_atomic_int64 on Intel.
    VK_EXT_descriptor_indexing on Intel.
    VK_KHR_shader_float16_int8 on Intel and RADV.
    GL_INTEL_conservative_rasterization on iris.
    VK_EXT_memory_budget on Intel.

New features in mesa 19.0.0:

    GL_AMD_texture_texture4 on all GL 4.0 drivers.
    GL_EXT_shader_implicit_conversions on all drivers (ES extension).
    GL_EXT_texture_compression_bptc on all GL 4.0 drivers (ES extension).
    GL_EXT_texture_compression_rgtc on all GL 3.0 drivers (ES extension).
    GL_EXT_render_snorm on gallium drivers (ES extension).
    GL_EXT_texture_view on drivers supporting texture views (ES extension).
    GL_OES_texture_view on drivers supporting texture views (ES extension).
    GL_NV_shader_atomic_float on nvc0 (Fermi/Kepler only).
    Shader-based software implementations of GL_ARB_gpu_shader_fp64, GL_ARB_gpu_shader_int64, GL_ARB_vertex_attrib_64bit, and GL_ARB_shader_ballot on i965.
    VK_ANDROID_external_memory_android_hardware_buffer on Intel
    Fixed and re-exposed VK_EXT_pci_bus_info on Intel and RADV
    VK_EXT_scalar_block_layout on Intel and RADV
    VK_KHR_depth_stencil_resolve on Intel
    VK_KHR_draw_indirect_count on Intel
    VK_EXT_conditional_rendering on Intel
    VK_EXT_memory_budget on RADV

Also, bug fixes.

diffstat:

 external/mit/MesaLib/dist/src/mapi/new/genCommon.py                               |  241 +++
 external/mit/MesaLib/dist/src/mapi/new/gen_gldispatch_mapi.py                     |  193 ++
 external/mit/MesaLib/dist/src/mapi/shared-glapi/SConscript                        |   28 +-
 external/mit/MesaLib/dist/src/mapi/shared-glapi/meson.build                       |    4 +-
 external/mit/MesaLib/dist/src/mesa/Android.gen.mk                                 |   79 +-
 external/mit/MesaLib/dist/src/mesa/Android.libmesa_dricore.mk                     |   34 +-
 external/mit/MesaLib/dist/src/mesa/Android.libmesa_git_sha1.mk                    |   54 +
 external/mit/MesaLib/dist/src/mesa/Android.libmesa_glsl_utils.mk                  |   24 +-
 external/mit/MesaLib/dist/src/mesa/Android.libmesa_sse41.mk                       |   47 +
 external/mit/MesaLib/dist/src/mesa/Android.libmesa_st_mesa.mk                     |   33 +-
 external/mit/MesaLib/dist/src/mesa/Android.mesa_gen_matypes.mk                    |    4 +-
 external/mit/MesaLib/dist/src/mesa/Android.mk                                     |    2 +
 external/mit/MesaLib/dist/src/mesa/Makefile.sources                               |    6 +-
 external/mit/MesaLib/dist/src/mesa/drivers/common/meta.c                          |   18 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/Android.mk                         |   39 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/common/Android.mk                  |   50 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/gen-symbol-redefs.py               |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/Android.mk                    |    7 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/intel_buffers.h               |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/intel_context.c               |    4 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/intel_context.h               |   23 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/intel_fbo.c                   |   10 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/intel_regions.c               |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/intel_screen.c                |   28 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/intel_screen.h                |    4 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i915/meson.build                   |    3 -
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/Android.mk                    |  302 +++-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/Makefile.sources              |   50 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_blorp.c                   |   69 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_bufmgr.c                  |   17 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_clear.c                   |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_compute.c                 |  131 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_conditional_render.c      |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_context.c                 |   63 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_context.h                 |  128 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_cs.c                      |    9 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_defines.h                 |   10 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_disk_cache.c              |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_draw.c                    |  104 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_draw_upload.c             |   60 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_gs.c                      |   38 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_link.cpp                  |    1 -
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_meta_util.c               |   10 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_misc_state.c              |   27 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp          |   96 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_performance_query.c       |  790 ++-------
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_performance_query.h       |  121 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c |  310 +---
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_pipe_control.c            |  245 +--
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_pipe_control.h            |   58 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_program.c                 |   60 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_program.h                 |    6 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_program_binary.c          |    4 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_queryobj.c                |   15 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_state.h                   |   34 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_state_upload.c            |   40 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_surface_formats.c         |    1 +
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_tcs.c                     |   42 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_tes.c                     |   37 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_vs.c                      |   59 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_wm.c                      |  149 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/brw_wm_surface_state.c        |   35 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/gen6_queryobj.c               |    4 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/gen7_l3_state.c               |    1 +
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/genX_blorp_exec.c             |   10 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/genX_boilerplate.h            |  160 ++
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/genX_pipe_control.c           |  510 ++++++
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/genX_state_upload.c           |  345 ++-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/hsw_queryobj.c                |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/hsw_sol.c                     |    3 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_batchbuffer.c           |   14 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_buffer_objects.c        |    3 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_buffers.h               |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_extensions.c            |   29 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_fbo.c                   |   59 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_image.h                 |    4 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_mipmap_tree.c           |  263 ++-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_mipmap_tree.h           |   56 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_pixel_read.c            |    8 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_screen.c                |   78 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_screen.h                |    5 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_tex_image.c             |   32 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/intel_tex_validate.c          |   26 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/i965/meson.build                   |   78 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/meson.build                        |   23 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/nouveau/.dir-locals.el             |    8 +
 external/mit/MesaLib/dist/src/mesa/drivers/dri/nouveau/.editorconfig              |    2 +
 external/mit/MesaLib/dist/src/mesa/drivers/dri/nouveau/meson.build                |    3 -
 external/mit/MesaLib/dist/src/mesa/drivers/dri/nouveau/nouveau_context.c          |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c            |   10 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/r200/meson.build                   |    3 -
 external/mit/MesaLib/dist/src/mesa/drivers/dri/r200/r200_context.c                |    1 -
 external/mit/MesaLib/dist/src/mesa/drivers/dri/r200/r200_context.h                |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/r200/r200_ioctl.h                  |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/radeon/meson.build                 |    3 -
 external/mit/MesaLib/dist/src/mesa/drivers/dri/radeon/radeon_common_context.c     |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/radeon/radeon_context.c            |    1 -
 external/mit/MesaLib/dist/src/mesa/drivers/dri/radeon/radeon_context.h            |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/radeon/radeon_dma.c                |    2 +-
 external/mit/MesaLib/dist/src/mesa/drivers/dri/swrast/meson.build                 |    3 -
 external/mit/MesaLib/dist/src/mesa/drivers/osmesa/meson.build                     |    3 +-
 external/mit/MesaLib/dist/src/mesa/drivers/osmesa/osmesa.c                        |    8 +-
 external/mit/MesaLib/dist/src/mesa/drivers/x11/xm_api.c                           |    4 +-
 external/mit/MesaLib/dist/src/mesa/main/api_arrayelt.c                            |  503 +-----
 external/mit/MesaLib/dist/src/mesa/main/api_arrayelt.h                            |   10 +-
 external/mit/MesaLib/dist/src/mesa/main/arrayobj.c                                |  144 +-
 external/mit/MesaLib/dist/src/mesa/main/arrayobj.h                                |   22 +-
 external/mit/MesaLib/dist/src/mesa/main/attrib.c                                  |    5 +-
 external/mit/MesaLib/dist/src/mesa/main/bufferobj.c                               |   25 +-
 external/mit/MesaLib/dist/src/mesa/main/buffers.c                                 |  150 +-
 external/mit/MesaLib/dist/src/mesa/main/context.c                                 |   25 +-
 external/mit/MesaLib/dist/src/mesa/main/context.h                                 |   62 +-
 external/mit/MesaLib/dist/src/mesa/main/dd.h                                      |   12 +-
 external/mit/MesaLib/dist/src/mesa/main/debug.c                                   |    3 +-
 external/mit/MesaLib/dist/src/mesa/main/dlist.c                                   |    3 +
 external/mit/MesaLib/dist/src/mesa/main/draw.c                                    |  250 +--
 external/mit/MesaLib/dist/src/mesa/main/draw.h                                    |    6 +-
 external/mit/MesaLib/dist/src/mesa/main/draw_validate.c                           |   21 +-
 external/mit/MesaLib/dist/src/mesa/main/enable.c                                  |   33 +-
 external/mit/MesaLib/dist/src/mesa/main/errors.c                                  |   51 +-
 external/mit/MesaLib/dist/src/mesa/main/errors.h                                  |   28 +-
 external/mit/MesaLib/dist/src/mesa/main/extensions_table.h                        |   28 +-
 external/mit/MesaLib/dist/src/mesa/main/fbobject.c                                |  176 +-
 external/mit/MesaLib/dist/src/mesa/main/fbobject.h                                |    8 +-
 external/mit/MesaLib/dist/src/mesa/main/format_info.py                            |    2 +
 external/mit/MesaLib/dist/src/mesa/meson.build                                    |    6 +-
 126 files changed, 3989 insertions(+), 3428 deletions(-)

diffs (truncated from 12275 to 300 lines):

diff -r d810b788506c -r 9b644641f5d3 external/mit/MesaLib/dist/src/mapi/new/genCommon.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/MesaLib/dist/src/mapi/new/genCommon.py       Tue Sep 24 18:00:54 2019 +0000
@@ -0,0 +1,241 @@
+#!/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%nvidia.com@localhost>
+
+import collections
+import re
+import sys
+import xml.etree.cElementTree as etree
+
+import os
+GLAPI = os.path.join(os.path.dirname(__file__), "..", "glapi", "gen")
+sys.path.insert(0, GLAPI)
+import static_data
+
+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)
+
+    # Lookup for fixed offset/slot functions and use it if available.
+    # 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.
+
+    next_slot = 0
+    for i in range(len(functions)):
+        name = functions[i].name[2:]
+
+        if name in static_data.offsets:
+            functions[i] = functions[i]._replace(slot=static_data.offsets[name])
+        elif not name.endswith("ARB") and name + "ARB" in static_data.offsets:
+            functions[i] = functions[i]._replace(slot=static_data.offsets[name + "ARB"])
+        elif not name.endswith("EXT") and name + "EXT" in static_data.offsets:
+            functions[i] = functions[i]._replace(slot=static_data.offsets[name + "EXT"])
+        else:
+            functions[i] = functions[i]._replace(slot=next_slot)
+            next_slot += 1
+
+    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"\bGLDEBUGPROCKHR\b", "GLDEBUGPROC", 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 -r d810b788506c -r 9b644641f5d3 external/mit/MesaLib/dist/src/mapi/new/gen_gldispatch_mapi.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/mit/MesaLib/dist/src/mapi/new/gen_gldispatch_mapi.py     Tue Sep 24 18:00:54 2019 +0000
@@ -0,0 +1,193 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2010 LunarG Inc.
+# (C) Copyright 2015, NVIDIA CORPORATION.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# 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 SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+# Authors:
+#    Kyle Brenneman <kbrenneman%nvidia.com@localhost>
+#
+# Based on code ogiginally by:
+#    Chia-I Wu <olv%lunarg.com@localhost>
+
+
+"""
+Generates the glapi_mapi_tmp.h header file from Khronos's XML file.
+"""
+
+import sys
+import xml.etree.cElementTree as etree
+
+import genCommon
+
+def _main():
+    target = sys.argv[1]
+    xmlFiles = sys.argv[2:]
+
+    roots = [ etree.parse(filename).getroot() for filename in xmlFiles ]
+    allFunctions = genCommon.getFunctionsFromRoots(roots)
+
+    names = genCommon.getExportNamesFromRoots(target, roots)
+    functions = [f for f in allFunctions if(f.name in names)]
+
+    if (target in ("gl", "gldispatch")):
+        assert(len(functions) == len(allFunctions))



Home | Main Index | Thread Index | Old Index