diff options
author | Emil Velikov <[email protected]> | 2016-01-18 10:47:13 +0200 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-01-26 16:08:20 +0000 |
commit | 1a882fd2ee84ae28a06cf07902dc4645d8ad4a6d (patch) | |
tree | dc85ad30ac20db8eecc658e7efcb3b0d7de898af /src | |
parent | 2f86383091bde24a2a0b90a43c11a13165f8c397 (diff) |
nir: move shader_enums.[ch] to compiler
This way one can reuse it in glsl, nir or other infrastructure without
pulling nir as dependency.
Signed-off-by: Emil Velikov <[email protected]>
Acked-by: Matt Turner <[email protected]>
Acked-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src')
23 files changed, 115 insertions, 15 deletions
diff --git a/src/SConscript b/src/SConscript index 106b87d4251..8acf9b04ab6 100644 --- a/src/SConscript +++ b/src/SConscript @@ -5,6 +5,7 @@ if env['platform'] == 'windows': SConscript('getopt/SConscript') SConscript('util/SConscript') +SConscript('compiler/SConscript') SConscript('glsl/SConscript') if env['hostonly']: diff --git a/src/compiler/Android.mk b/src/compiler/Android.mk new file mode 100644 index 00000000000..8ebd49778ef --- /dev/null +++ b/src/compiler/Android.mk @@ -0,0 +1,44 @@ +# Mesa 3-D graphics library +# +# 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 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. + +LOCAL_PATH := $(call my-dir) + +include $(LOCAL_PATH)/Makefile.sources + +# --------------------------------------- +# Build libmesa_compiler +# --------------------------------------- + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(LIBCOMPILER_FILES) + +LOCAL_C_INCLUDES := \ + $(MESA_TOP)/src/mapi \ + $(MESA_TOP)/src/mesa \ + $(MESA_TOP)/src/gallium/include \ + $(MESA_TOP)/src/gallium/auxiliary + +LOCAL_MODULE := libmesa_compiler + +include $(MESA_COMMON_MK) +include $(BUILD_STATIC_LIBRARY) diff --git a/src/compiler/Makefile.am b/src/compiler/Makefile.am index 8ed8205fd73..fd1dd4b6d30 100644 --- a/src/compiler/Makefile.am +++ b/src/compiler/Makefile.am @@ -22,4 +22,25 @@ include Makefile.sources -EXTRA_DIST = $(LIBCOMPILER_FILES) +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/mapi \ + -I$(top_srcdir)/src/mesa/ \ + -I$(top_srcdir)/src/gallium/include \ + -I$(top_srcdir)/src/gallium/auxiliary \ + $(DEFINES) + +AM_CFLAGS = \ + $(VISIBILITY_CFLAGS) \ + $(MSVC2013_COMPAT_CFLAGS) + +AM_CXXFLAGS = \ + $(VISIBILITY_CXXFLAGS) \ + $(MSVC2013_COMPAT_CXXFLAGS) + +noinst_LTLIBRARIES = libcompiler.la + +libcompiler_la_SOURCES = $(LIBCOMPILER_FILES) + +EXTRA_DIST = SConscript diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index f154062d04c..73e1771c8a7 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -1,2 +1,4 @@ LIBCOMPILER_FILES = \ - builtin_type_macros.h + builtin_type_macros.h \ + shader_enums.c \ + shader_enums.h diff --git a/src/compiler/SConscript b/src/compiler/SConscript new file mode 100644 index 00000000000..412da0e62bd --- /dev/null +++ b/src/compiler/SConscript @@ -0,0 +1,22 @@ +Import('*') + +env = env.Clone() + +env.MSVC2013Compat() + +env.Prepend(CPPPATH = [ + '#include', + '#src', + '#src/mapi', + '#src/mesa', + '#src/gallium/include', + '#src/gallium/auxiliary', +]) + +sources = env.ParseSourceList('Makefile.sources', 'LIBCOMPILER_FILES') + +compiler = env.ConvenienceLibrary( + target = 'compiler', + source = sources +) +Export('compiler') diff --git a/src/glsl/nir/shader_enums.c b/src/compiler/shader_enums.c index 942d152b129..942d152b129 100644 --- a/src/glsl/nir/shader_enums.c +++ b/src/compiler/shader_enums.c diff --git a/src/glsl/nir/shader_enums.h b/src/compiler/shader_enums.h index efc0b0d515e..efc0b0d515e 100644 --- a/src/glsl/nir/shader_enums.h +++ b/src/compiler/shader_enums.h diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index dfda80f228f..0d6eb76eabd 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -27,7 +27,7 @@ #include "glsl/nir/nir_control_flow.h" #include "glsl/nir/nir_builder.h" #include "glsl/list.h" -#include "glsl/nir/shader_enums.h" +#include "compiler/shader_enums.h" #include "nir/tgsi_to_nir.h" #include "tgsi/tgsi_parse.h" diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.h b/src/gallium/drivers/freedreno/ir3/ir3_nir.h index 534199d3744..311a40338e5 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_nir.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.h @@ -30,7 +30,7 @@ #define IR3_NIR_H_ #include "glsl/nir/nir.h" -#include "glsl/nir/shader_enums.h" +#include "compiler/shader_enums.h" #include "ir3_shader.h" diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h index b3c28a41387..03d4fa2e927 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h @@ -30,7 +30,7 @@ #define IR3_SHADER_H_ #include "pipe/p_state.h" -#include "glsl/nir/shader_enums.h" +#include "compiler/shader_enums.h" #include "ir3.h" #include "disasm.h" diff --git a/src/gallium/targets/dri/SConscript b/src/gallium/targets/dri/SConscript index b4516598675..bf3baa7094b 100644 --- a/src/gallium/targets/dri/SConscript +++ b/src/gallium/targets/dri/SConscript @@ -41,6 +41,7 @@ env.Prepend(LIBS = [ pipe_loader, libloader, mesautil, + compiler, mesa, glsl, gallium, diff --git a/src/gallium/targets/haiku-softpipe/SConscript b/src/gallium/targets/haiku-softpipe/SConscript index 210721c420f..b7c13731d68 100644 --- a/src/gallium/targets/haiku-softpipe/SConscript +++ b/src/gallium/targets/haiku-softpipe/SConscript @@ -6,6 +6,7 @@ env.Prepend(LIBS = [ trace, rbug, mesautil, + compiler, mesa, glsl, gallium diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript index 594f34d7fad..3a63e3e6a3e 100644 --- a/src/gallium/targets/libgl-gdi/SConscript +++ b/src/gallium/targets/libgl-gdi/SConscript @@ -50,7 +50,7 @@ if env['gles']: opengl32 = env.SharedLibrary( target ='opengl32', source = sources, - LIBS = wgl + ws_gdi + glapi + mesa + drivers + gallium + glsl + env['LIBS'], + LIBS = wgl + ws_gdi + glapi + compiler + mesa + drivers + gallium + glsl + env['LIBS'], ) env.Alias('opengl32', opengl32) diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript index 687a8b9d3ed..e1c78dd06a0 100644 --- a/src/gallium/targets/libgl-xlib/SConscript +++ b/src/gallium/targets/libgl-xlib/SConscript @@ -29,6 +29,7 @@ env.Prepend(LIBS = [ ws_xlib, glapi, mesautil, + compiler, mesa, glsl, gallium, diff --git a/src/gallium/targets/osmesa/SConscript b/src/gallium/targets/osmesa/SConscript index 4a9115ba1cf..eeaacbcaf64 100644 --- a/src/gallium/targets/osmesa/SConscript +++ b/src/gallium/targets/osmesa/SConscript @@ -12,6 +12,7 @@ env.Prepend(LIBS = [ st_osmesa, ws_null, glapi, + compiler, mesa, gallium, trace, diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk index f63b7daf26e..9cbb9a339a1 100644 --- a/src/glsl/Android.mk +++ b/src/glsl/Android.mk @@ -44,6 +44,8 @@ LOCAL_C_INCLUDES := \ $(MESA_TOP)/src/gallium/include \ $(MESA_TOP)/src/gallium/auxiliary +LOCAL_STATIC_LIBRARIES := libmesa_compiler + LOCAL_MODULE := libmesa_glsl include $(LOCAL_PATH)/Android.gen.mk diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am index ba7af7c779d..07d5267df5a 100644 --- a/src/glsl/Makefile.am +++ b/src/glsl/Makefile.am @@ -137,7 +137,10 @@ glcpp_glcpp_LDADD = \ $(top_builddir)/src/libglsl_util.la \ -lm -libglsl_la_LIBADD = libglcpp.la +libglsl_la_LIBADD = \ + $(top_builddir)/src/compiler/libcompiler.la \ + libglcpp.la + libglsl_la_SOURCES = \ glsl_lexer.cpp \ glsl_parser.cpp \ @@ -147,6 +150,9 @@ libglsl_la_SOURCES = \ $(NIR_GENERATED_FILES) \ $(GLSL_TO_NIR_FILES) +libnir_la_LIBADD = \ + $(top_builddir)/src/compiler/libcompiler.la + libnir_la_SOURCES = \ $(NIR_FILES) \ $(NIR_GENERATED_FILES) diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources index 8b43eb88bec..5a576bc3c7e 100644 --- a/src/glsl/Makefile.sources +++ b/src/glsl/Makefile.sources @@ -81,9 +81,7 @@ NIR_FILES = \ nir/nir_vla.h \ nir/nir_worklist.c \ nir/nir_worklist.h \ - nir/nir_types.cpp \ - nir/shader_enums.h \ - nir/shader_enums.c + nir/nir_types.cpp # libglsl diff --git a/src/glsl/SConscript b/src/glsl/SConscript index a9d38c163b7..e89d4e0eb01 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -65,7 +65,6 @@ for l in ('LIBGLCPP_FILES', 'LIBGLSL_FILES'): # XXX: Remove this once we build NIR and NIR_FILES. glsl_sources += [ 'nir/glsl_types.cpp', - 'nir/shader_enums.c', ] if env['msvc']: @@ -115,7 +114,7 @@ if env['platform'] == 'windows': 'user32', ]) -env.Prepend(LIBS = [glsl]) +env.Prepend(LIBS = [compiler, glsl]) glsl_compiler = env.Program( target = 'glsl_compiler', diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index e2bd2bfa025..79b35f7a416 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -35,7 +35,7 @@ #include "util/set.h" #include "util/bitset.h" #include "nir_types.h" -#include "shader_enums.h" +#include "compiler/shader_enums.h" #include <stdio.h> #include "nir_opcodes.h" diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c index be9ca4e0f57..48ecb48a620 100644 --- a/src/glsl/nir/nir_print.c +++ b/src/glsl/nir/nir_print.c @@ -26,7 +26,7 @@ */ #include "nir.h" -#include "shader_enums.h" +#include "compiler/shader_enums.h" #include <stdio.h> #include <stdlib.h> diff --git a/src/mesa/drivers/x11/SConscript b/src/mesa/drivers/x11/SConscript index d29f9874f44..45419973d39 100644 --- a/src/mesa/drivers/x11/SConscript +++ b/src/mesa/drivers/x11/SConscript @@ -18,6 +18,7 @@ env.Prepend(LIBPATH = env['X11_LIBPATH']) env.Prepend(LIBS = [ glapi, mesautil, + compiler, glsl, mesa, ]) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 15dd1ca7cdf..f3102dc21e3 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -42,7 +42,7 @@ #include "main/config.h" #include "glapi/glapi.h" #include "math/m_matrix.h" /* GLmatrix */ -#include "glsl/nir/shader_enums.h" +#include "compiler/shader_enums.h" #include "main/formats.h" /* MESA_FORMAT_COUNT */ |