summaryrefslogtreecommitdiff
path: root/lib/mesa/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa/src')
-rw-r--r--lib/mesa/src/egl/main/egldefines.h2
-rw-r--r--lib/mesa/src/egl/main/egldevice.h2
-rw-r--r--lib/mesa/src/egl/meson.build23
-rw-r--r--lib/mesa/src/gbm/meson.build4
-rw-r--r--lib/mesa/src/mapi/es1api/meson.build11
-rw-r--r--lib/mesa/src/mapi/es2api/meson.build9
-rw-r--r--lib/mesa/src/mapi/glapi/gen/EXT_multisampled_render_to_texture.xml34
-rw-r--r--lib/mesa/src/mapi/glapi/gen/meson.build8
-rw-r--r--lib/mesa/src/mapi/glapi/meson.build3
-rw-r--r--lib/mesa/src/mapi/meson.build2
-rw-r--r--lib/mesa/src/mapi/new/genCommon.py241
-rwxr-xr-xlib/mesa/src/mapi/new/gen_gldispatch_mapi.py193
-rw-r--r--lib/mesa/src/mapi/shared-glapi/meson.build3
-rw-r--r--lib/mesa/src/meson.build3
14 files changed, 510 insertions, 28 deletions
diff --git a/lib/mesa/src/egl/main/egldefines.h b/lib/mesa/src/egl/main/egldefines.h
index d0502f330..c925e0ca5 100644
--- a/lib/mesa/src/egl/main/egldefines.h
+++ b/lib/mesa/src/egl/main/egldefines.h
@@ -34,8 +34,6 @@
#ifndef EGLDEFINES_INCLUDED
#define EGLDEFINES_INCLUDED
-#include "util/macros.h"
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/lib/mesa/src/egl/main/egldevice.h b/lib/mesa/src/egl/main/egldevice.h
index acd040c80..883f96f8e 100644
--- a/lib/mesa/src/egl/main/egldevice.h
+++ b/lib/mesa/src/egl/main/egldevice.h
@@ -31,9 +31,9 @@
#include <stdbool.h>
+#include <stddef.h>
#include "egltypedefs.h"
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/lib/mesa/src/egl/meson.build b/lib/mesa/src/egl/meson.build
index 51b7a9a99..b7ff09e9f 100644
--- a/lib/mesa/src/egl/meson.build
+++ b/lib/mesa/src/egl/meson.build
@@ -1,4 +1,4 @@
-# Copyright © 2017 Intel Corporation
+# Copyright © 2017 Intel 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
@@ -62,28 +62,28 @@ files_egl = files(
g_egldispatchstubs_c = custom_target(
'g_egldispatchstubs.c',
input : [
- 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py',
+ 'generate/gen_egl_dispatch.py',
'generate/egl.xml', 'generate/egl_other.xml'
],
output : 'g_egldispatchstubs.c',
command : [
- prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@', '@INPUT3@'
+ prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@',
],
- depend_files : files('generate/genCommon.py'),
+ depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ],
capture : true,
)
g_egldispatchstubs_h = custom_target(
'g_egldispatchstubs.h',
input : [
- 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py',
+ 'generate/gen_egl_dispatch.py',
'generate/egl.xml', 'generate/egl_other.xml'
],
output : 'g_egldispatchstubs.h',
command : [
- prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@', '@INPUT3@'
+ prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@',
],
- depend_files : files('generate/genCommon.py'),
+ depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ],
capture : true,
)
@@ -93,9 +93,6 @@ if with_dri2
'drivers/dri2/egl_dri2.h',
'drivers/dri2/egl_dri2_fallbacks.h',
)
- c_args_for_egl += [
- '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
- ]
link_for_egl += [libloader, libxmlconfig]
incs_for_egl += inc_loader
@@ -202,11 +199,13 @@ if with_tests
test('egl-symbols-check',
find_program('egl-symbols-check'),
env : env_test,
- args : libegl
+ args : libegl,
+ suite : ['egl'],
)
endif
test('egl-entrypoint-check',
find_program('egl-entrypoint-check'),
- env : [ 'srcdir=' + meson.current_source_dir() ]
+ env : ['srcdir=' + meson.current_source_dir()],
+ suite : ['egl'],
)
endif
diff --git a/lib/mesa/src/gbm/meson.build b/lib/mesa/src/gbm/meson.build
index 719f9c1a9..b2ad66735 100644
--- a/lib/mesa/src/gbm/meson.build
+++ b/lib/mesa/src/gbm/meson.build
@@ -37,7 +37,6 @@ incs_gbm = [
if with_dri2
files_gbm += files('backends/dri/gbm_dri.c', 'backends/dri/gbm_driint.h')
deps_gbm += dep_libdrm # TODO: pthread-stubs
- args_gbm += '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path)
endif
if with_platform_wayland
deps_gbm += dep_wayland_server
@@ -72,6 +71,7 @@ if with_tests
'gbm-symbols-check',
find_program('gbm-symbols-check'),
env : env_test,
- args : libgbm
+ args : libgbm,
+ suite : ['gbm'],
)
endif
diff --git a/lib/mesa/src/mapi/es1api/meson.build b/lib/mesa/src/mapi/es1api/meson.build
index d8a77a41d..14ca49c14 100644
--- a/lib/mesa/src/mapi/es1api/meson.build
+++ b/lib/mesa/src/mapi/es1api/meson.build
@@ -20,10 +20,10 @@
es1_glapi_mapi_tmp_h = custom_target(
'es1_glapi_mapi_tmp.h',
- input : [mapi_abi_py, gl_and_es_api_files],
+ input : [glapi_gen_mapi_py, glapi_gen_gl_xml],
output : 'glapi_mapi_tmp.h',
- command : [prog_python, '@INPUT0@', '--printer', 'es1api', '@INPUT1@'],
- depend_files : api_xml_files,
+ command : [prog_python, '@INPUT0@', 'glesv1', '@INPUT1@'],
+ depend_files : glapi_gen_mapi_deps,
capture : true,
)
@@ -38,7 +38,7 @@ libglesv1_cm = shared_library(
include_directories : [inc_src, inc_include, inc_mapi],
link_with : libglapi,
dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl],
- version : '1.0.0',
+ version : '1.1.0',
install : true,
)
@@ -56,6 +56,7 @@ if with_tests
'es1-ABI-check',
find_program('ABI-check'),
env : env_test,
- args : libglesv1_cm
+ args : libglesv1_cm,
+ suite : ['mapi'],
)
endif
diff --git a/lib/mesa/src/mapi/es2api/meson.build b/lib/mesa/src/mapi/es2api/meson.build
index 891e6f7b2..a7f0904b6 100644
--- a/lib/mesa/src/mapi/es2api/meson.build
+++ b/lib/mesa/src/mapi/es2api/meson.build
@@ -20,10 +20,10 @@
es2_glapi_mapi_tmp_h = custom_target(
'es2_glapi_mapi_tmp.h',
- input : [mapi_abi_py, gl_and_es_api_files],
+ input : [glapi_gen_mapi_py, glapi_gen_gl_xml],
output : 'glapi_mapi_tmp.h',
- command : [prog_python, '@INPUT0@', '--printer', 'es2api', '@INPUT1@'],
- depend_files : api_xml_files,
+ command : [prog_python, '@INPUT0@', 'glesv2', '@INPUT1@'],
+ depend_files : glapi_gen_mapi_deps,
capture : true,
)
@@ -56,6 +56,7 @@ if with_tests
'es2-ABI-check',
find_program('ABI-check'),
env : env_test,
- args : libgles2
+ args : libgles2,
+ suite : ['mapi'],
)
endif
diff --git a/lib/mesa/src/mapi/glapi/gen/EXT_multisampled_render_to_texture.xml b/lib/mesa/src/mapi/glapi/gen/EXT_multisampled_render_to_texture.xml
new file mode 100644
index 000000000..d76ecd47d
--- /dev/null
+++ b/lib/mesa/src/mapi/glapi/gen/EXT_multisampled_render_to_texture.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_EXT_multisampled_render_to_texture" number="106">
+
+ <enum name="RENDERBUFFER_SAMPLES_EXT" value="0x8CAB"/>
+ <enum name="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT" value="0x8D56"/>
+ <enum name="MAX_SAMPLES_EXT" value="0x8D57"/>
+ <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT" value="0x8D6C"/>
+
+<!-- Already defined in EXT_framebuffer_object.xml
+ <function name="RenderbufferStorageMultisampleEXT" es2="2.0">
+ <param name="target" type="GLenum"/>
+ <param name="samples" type="GLsizei"/>
+ <param name="internalformat" type="GLenum"/>
+ <param name="width" type="GLsizei"/>
+ <param name="height" type="GLsizei"/>
+ </function>
+-->
+
+ <function name="FramebufferTexture2DMultisampleEXT" es2="2.0" desktop="false">
+ <param name="target" type="GLenum"/>
+ <param name="attachment" type="GLenum"/>
+ <param name="textarget" type="GLenum"/>
+ <param name="texture" type="GLuint"/>
+ <param name="level" type="GLint"/>
+ <param name="samples" type="GLsizei"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/lib/mesa/src/mapi/glapi/gen/meson.build b/lib/mesa/src/mapi/glapi/gen/meson.build
index f494e9707..ecfa1a7f7 100644
--- a/lib/mesa/src/mapi/glapi/gen/meson.build
+++ b/lib/mesa/src/mapi/glapi/gen/meson.build
@@ -18,6 +18,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+glapi_gen_gl_xml = files('../registry/gl.xml')
+glapi_gen_mapi_deps = [
+ glapi_gen_gl_xml,
+ genCommon_py,
+ glapi_gen_gl_xml,
+]
+
gl_and_es_api_files = files('gl_and_es_API.xml')
api_xml_files = files(
@@ -107,6 +114,7 @@ api_xml_files = files(
'EXT_external_objects_fd.xml',
'EXT_framebuffer_object.xml',
'EXT_gpu_shader4.xml',
+ 'EXT_multisampled_render_to_texture.xml',
'EXT_packed_depth_stencil.xml',
'EXT_provoking_vertex.xml',
'EXT_separate_shader_objects.xml',
diff --git a/lib/mesa/src/mapi/glapi/meson.build b/lib/mesa/src/mapi/glapi/meson.build
index 048bee8a1..7e8bc38a8 100644
--- a/lib/mesa/src/mapi/glapi/meson.build
+++ b/lib/mesa/src/mapi/glapi/meson.build
@@ -87,6 +87,7 @@ if with_any_opengl and not with_shared_glapi and with_tests
include_directories : [inc_include, inc_src, inc_mesa, inc_mapi],
link_with : [libglapi_static],
dependencies : [idep_gtest, dep_thread],
- )
+ ),
+ suite : ['mapi'],
)
endif
diff --git a/lib/mesa/src/mapi/meson.build b/lib/mesa/src/mapi/meson.build
index 798586bfb..3e79bbaa7 100644
--- a/lib/mesa/src/mapi/meson.build
+++ b/lib/mesa/src/mapi/meson.build
@@ -25,6 +25,8 @@ files_mapi_util = files(
'u_execmem.h',
)
+genCommon_py = files('new/genCommon.py')
+glapi_gen_mapi_py = files('new/gen_gldispatch_mapi.py')
mapi_abi_py = files('mapi_abi.py')
subdir('glapi')
diff --git a/lib/mesa/src/mapi/new/genCommon.py b/lib/mesa/src/mapi/new/genCommon.py
new file mode 100644
index 000000000..bf71de148
--- /dev/null
+++ b/lib/mesa/src/mapi/new/genCommon.py
@@ -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>
+
+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 --git a/lib/mesa/src/mapi/new/gen_gldispatch_mapi.py b/lib/mesa/src/mapi/new/gen_gldispatch_mapi.py
new file mode 100755
index 000000000..86958de30
--- /dev/null
+++ b/lib/mesa/src/mapi/new/gen_gldispatch_mapi.py
@@ -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>
+#
+# Based on code ogiginally by:
+# Chia-I Wu <olv@lunarg.com>
+
+
+"""
+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))
+ assert(all(functions[i] == allFunctions[i] for i in range(len(functions))))
+ assert(all(functions[i].slot == i for i in range(len(functions))))
+
+ print(r"""
+/* This file is automatically generated by mapi_abi.py. Do not modify. */
+
+#ifndef _GLAPI_TMP_H_
+#define _GLAPI_TMP_H_
+typedef int GLclampx;
+#endif /* _GLAPI_TMP_H_ */
+""".lstrip("\n"))
+
+ print(generate_defines(functions))
+ if target == "gldispatch":
+ print(generate_table(functions, allFunctions))
+ print(generate_noop_array(functions))
+ print(generate_public_stubs(functions))
+ print(generate_public_entries(functions))
+ if target == "gldispatch":
+ print(generate_public_entries_table(functions))
+ print(generate_undef_public_entries())
+ print(generate_stub_asm_gcc(functions))
+
+def generate_defines(functions):
+ text = r"""
+#ifdef MAPI_TMP_DEFINES
+#define GL_GLEXT_PROTOTYPES
+#include "GL/gl.h"
+#include "GL/glext.h"
+
+""".lstrip("\n")
+ for func in functions:
+ text += "GLAPI {f.rt} APIENTRY {f.name}({f.decArgs});\n".format(f=func)
+ text += "#undef MAPI_TMP_DEFINES\n"
+ text += "#endif /* MAPI_TMP_DEFINES */\n"
+ return text
+
+def generate_table(functions, allFunctions):
+ text = "#ifdef MAPI_TMP_TABLE\n"
+ text += "#define MAPI_TABLE_NUM_STATIC %d\n" % (len(allFunctions))
+ text += "#define MAPI_TABLE_NUM_DYNAMIC %d\n" % (genCommon.MAPI_TABLE_NUM_DYNAMIC,)
+ text += "#undef MAPI_TMP_TABLE\n"
+ text += "#endif /* MAPI_TMP_TABLE */\n"
+ return text
+
+def generate_noop_array(functions):
+ text = "#ifdef MAPI_TMP_NOOP_ARRAY\n"
+ text += "#ifdef DEBUG\n\n"
+
+ for func in functions:
+ text += "static {f.rt} APIENTRY noop{f.basename}({f.decArgs})\n".format(f=func)
+ text += "{\n"
+ if (len(func.args) > 0):
+ text += " "
+ for arg in func.args:
+ text += " (void) {a.name};".format(a=arg)
+ text += "\n"
+ text += " noop_warn(\"{f.name}\");\n".format(f=func)
+ if (func.hasReturn()):
+ text += " return ({f.rt}) 0;\n".format(f=func)
+ text += "}\n\n"
+
+ text += "const mapi_func table_noop_array[] = {\n"
+ for func in functions:
+ text += " (mapi_func) noop{f.basename},\n".format(f=func)
+ for i in range(genCommon.MAPI_TABLE_NUM_DYNAMIC - 1):
+ text += " (mapi_func) noop_generic,\n"
+ text += " (mapi_func) noop_generic\n"
+ text += "};\n\n"
+ text += "#else /* DEBUG */\n\n"
+ text += "const mapi_func table_noop_array[] = {\n"
+ for i in range(len(functions) + genCommon.MAPI_TABLE_NUM_DYNAMIC - 1):
+ text += " (mapi_func) noop_generic,\n"
+ text += " (mapi_func) noop_generic\n"
+
+ text += "};\n\n"
+ text += "#endif /* DEBUG */\n"
+ text += "#undef MAPI_TMP_NOOP_ARRAY\n"
+ text += "#endif /* MAPI_TMP_NOOP_ARRAY */\n"
+ return text
+
+def generate_public_stubs(functions):
+ text = "#ifdef MAPI_TMP_PUBLIC_STUBS\n"
+
+ text += "static const struct mapi_stub public_stubs[] = {\n"
+ for func in functions:
+ text += " { \"%s\", %d, NULL },\n" % (func.name, func.slot)
+ text += "};\n"
+ text += "#undef MAPI_TMP_PUBLIC_STUBS\n"
+ text += "#endif /* MAPI_TMP_PUBLIC_STUBS */\n"
+ return text
+
+def generate_public_entries(functions):
+ text = "#ifdef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN\n"
+
+ for func in functions:
+ retStr = ("return " if func.hasReturn() else "")
+ text += r"""
+GLAPI {f.rt} APIENTRY {f.name}({f.decArgs})
+{{
+ const struct _glapi_table *_tbl = entry_current_get();
+ mapi_func _func = ((const mapi_func *) _tbl)[{f.slot}];
+ {retStr}(({f.rt} (APIENTRY *)({f.decArgs})) _func)({f.callArgs});
+}}
+
+""".lstrip("\n").format(f=func, retStr=retStr)
+
+ text += "\n"
+ text += "#endif /* MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN */\n"
+ return text
+
+def generate_public_entries_table(functions):
+ text = "#ifdef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN\n"
+ text += "static const mapi_func public_entries[] = {\n"
+ for func in functions:
+ text += " (mapi_func) %s,\n" % (func.name,)
+ text += "};\n"
+ text += "#endif /* MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN */\n"
+ return text
+
+def generate_undef_public_entries():
+ text = "#ifdef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN\n"
+ text += "#undef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN\n"
+ text += "#endif /* MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN */\n"
+ return text
+
+def generate_stub_asm_gcc(functions):
+ text = "#ifdef MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN\n"
+ text += "__asm__(\n"
+
+ for func in functions:
+ text += 'STUB_ASM_ENTRY("%s")"\\n"\n' % (func.name,)
+ text += '"\\t"STUB_ASM_CODE("%d")"\\n"\n\n' % (func.slot,)
+
+ text += ");\n"
+ text += "#undef MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN\n"
+ text += "#endif /* MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN */\n"
+ return text
+
+if (__name__ == "__main__"):
+ _main()
+
diff --git a/lib/mesa/src/mapi/shared-glapi/meson.build b/lib/mesa/src/mapi/shared-glapi/meson.build
index 3f041471f..828d14bfd 100644
--- a/lib/mesa/src/mapi/shared-glapi/meson.build
+++ b/lib/mesa/src/mapi/shared-glapi/meson.build
@@ -60,6 +60,7 @@ if with_any_opengl and with_tests
include_directories : [inc_src, inc_include, inc_mapi],
link_with : [libglapi],
dependencies : [dep_thread, idep_gtest],
- )
+ ),
+ suite : ['mapi'],
)
endif
diff --git a/lib/mesa/src/meson.build b/lib/mesa/src/meson.build
index 3b91c6a88..ae094fccf 100644
--- a/lib/mesa/src/meson.build
+++ b/lib/mesa/src/meson.build
@@ -63,6 +63,9 @@ endif
if with_gallium_vc4 or with_gallium_v3d
subdir('broadcom')
endif
+if with_gallium_freedreno
+ subdir('freedreno')
+endif
if with_dri_i965 or with_intel_vk
subdir('intel')
endif