[Mesa-dev] [PATCH 4/9] compiler: introduce a libcompiler static library

Emil Velikov emil.l.velikov at gmail.com
Wed Nov 25 13:31:58 PST 2015


From: Emil Velikov <emil.velikov at collabora.com>

Currently it's an empty library, although it'll be used to store common
code between GLSL and NIR that is compiler specific (rather than generic
as the one in src/util).

XXX: strictly speaking we could add a python/mako parser to generate the
relevant files instead including builtin_type_macros.h in such a manner.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 configure.ac                                     |  1 +
 src/Makefile.am                                  |  3 +++
 src/compiler/Makefile.am                         | 25 ++++++++++++++++++++++++
 src/compiler/Makefile.sources                    |  2 ++
 src/{glsl/nir => compiler}/builtin_type_macros.h |  0
 src/glsl/Makefile.sources                        |  1 -
 src/glsl/builtin_types.cpp                       |  2 +-
 src/glsl/nir/glsl_types.cpp                      |  2 +-
 src/glsl/nir/glsl_types.h                        |  4 ++--
 9 files changed, 35 insertions(+), 5 deletions(-)
 create mode 100644 src/compiler/Makefile.am
 create mode 100644 src/compiler/Makefile.sources
 rename src/{glsl/nir => compiler}/builtin_type_macros.h (100%)

diff --git a/configure.ac b/configure.ac
index 4016871..fcffc19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2346,6 +2346,7 @@ CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
 dnl Substitute the config
 AC_CONFIG_FILES([Makefile
 		src/Makefile
+		src/compiler/Makefile
 		src/egl/Makefile
 		src/egl/main/egl.pc
 		src/egl/wayland/wayland-drm/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 0d49bcd..6357d10 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,6 +21,9 @@
 
 SUBDIRS = . gtest util mapi/glapi/gen mapi
 
+# XXX: conditionally include
+SUBDIRS += compiler
+
 if NEED_OPENGL_COMMON
 SUBDIRS += glsl mesa
 endif
diff --git a/src/compiler/Makefile.am b/src/compiler/Makefile.am
new file mode 100644
index 0000000..8ed8205
--- /dev/null
+++ b/src/compiler/Makefile.am
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2015 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 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 (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 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.
+
+include Makefile.sources
+
+EXTRA_DIST = $(LIBCOMPILER_FILES)
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
new file mode 100644
index 0000000..f154062
--- /dev/null
+++ b/src/compiler/Makefile.sources
@@ -0,0 +1,2 @@
+LIBCOMPILER_FILES = \
+	builtin_type_macros.h
diff --git a/src/glsl/nir/builtin_type_macros.h b/src/compiler/builtin_type_macros.h
similarity index 100%
rename from src/glsl/nir/builtin_type_macros.h
rename to src/compiler/builtin_type_macros.h
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index 133d06a..fa6ed3c 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -22,7 +22,6 @@ NIR_FILES = \
 	nir/glsl_to_nir.h \
 	nir/glsl_types.cpp \
 	nir/glsl_types.h \
-	nir/builtin_type_macros.h \
 	nir/nir.c \
 	nir/nir.h \
 	nir/nir_array.h \
diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
index bbdcd19..4402e28 100644
--- a/src/glsl/builtin_types.cpp
+++ b/src/glsl/builtin_types.cpp
@@ -112,7 +112,7 @@ static const struct glsl_struct_field gl_FogParameters_fields[] = {
    glsl_struct_field(glsl_type::float_type, "scale"),
 };
 
-#include "builtin_type_macros.h"
+#include "compiler/builtin_type_macros.h"
 /** @} */
 
 /**
diff --git a/src/glsl/nir/glsl_types.cpp b/src/glsl/nir/glsl_types.cpp
index 3cf2f03..bb2f24a 100644
--- a/src/glsl/nir/glsl_types.cpp
+++ b/src/glsl/nir/glsl_types.cpp
@@ -1746,5 +1746,5 @@ glsl_type::coordinate_components() const
 
 #define STRUCT_TYPE(NAME)
 
-#include "builtin_type_macros.h"
+#include "compiler/builtin_type_macros.h"
 /** @} */
diff --git a/src/glsl/nir/glsl_types.h b/src/glsl/nir/glsl_types.h
index 1dd28a6..c249ecc 100644
--- a/src/glsl/nir/glsl_types.h
+++ b/src/glsl/nir/glsl_types.h
@@ -204,7 +204,7 @@ struct glsl_type {
 #undef  STRUCT_TYPE
 #define STRUCT_TYPE(NAME) \
    static const glsl_type *const struct_##NAME##_type;
-#include "builtin_type_macros.h"
+#include "compiler/builtin_type_macros.h"
    /*@}*/
 
    /**
@@ -779,7 +779,7 @@ private:
 #define DECL_TYPE(NAME, ...) static const glsl_type _##NAME##_type;
 #undef  STRUCT_TYPE
 #define STRUCT_TYPE(NAME)        static const glsl_type _struct_##NAME##_type;
-#include "builtin_type_macros.h"
+#include "compiler/builtin_type_macros.h"
    /*@}*/
 
    /**
-- 
2.6.2



More information about the mesa-dev mailing list