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 <emil.velikov@collabora.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
Emil Velikov
2016-01-18 10:47:13 +02:00
committed by Emil Velikov
parent 2f86383091
commit 1a882fd2ee
24 changed files with 116 additions and 15 deletions

View File

@@ -86,6 +86,7 @@ ifneq ($(strip $(MESA_GPU_DRIVERS)),)
SUBDIRS := \
src/loader \
src/mapi \
src/compiler \
src/glsl \
src/mesa \
src/util \

View File

@@ -5,6 +5,7 @@ if env['platform'] == 'windows':
SConscript('getopt/SConscript')
SConscript('util/SConscript')
SConscript('compiler/SConscript')
SConscript('glsl/SConscript')
if env['hostonly']:

44
src/compiler/Android.mk Normal file
View File

@@ -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)

View File

@@ -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

View File

@@ -1,2 +1,4 @@
LIBCOMPILER_FILES = \
builtin_type_macros.h
builtin_type_macros.h \
shader_enums.c \
shader_enums.h

22
src/compiler/SConscript Normal file
View File

@@ -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')

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -41,6 +41,7 @@ env.Prepend(LIBS = [
pipe_loader,
libloader,
mesautil,
compiler,
mesa,
glsl,
gallium,

View File

@@ -6,6 +6,7 @@ env.Prepend(LIBS = [
trace,
rbug,
mesautil,
compiler,
mesa,
glsl,
gallium

View File

@@ -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)

View File

@@ -29,6 +29,7 @@ env.Prepend(LIBS = [
ws_xlib,
glapi,
mesautil,
compiler,
mesa,
glsl,
gallium,

View File

@@ -12,6 +12,7 @@ env.Prepend(LIBS = [
st_osmesa,
ws_null,
glapi,
compiler,
mesa,
gallium,
trace,

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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',

View File

@@ -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"

View File

@@ -26,7 +26,7 @@
*/
#include "nir.h"
#include "shader_enums.h"
#include "compiler/shader_enums.h"
#include <stdio.h>
#include <stdlib.h>

View File

@@ -18,6 +18,7 @@ env.Prepend(LIBPATH = env['X11_LIBPATH'])
env.Prepend(LIBS = [
glapi,
mesautil,
compiler,
glsl,
mesa,
])

View File

@@ -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 */