aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-16 07:53:32 +0200
committermarha <marha@users.sourceforge.net>2012-07-16 07:53:32 +0200
commit01102cdf33d68a7be192a139752831ff93dee117 (patch)
tree84cc702a6d5bb77647f6df3840b41eb9a7b9faf4 /mesalib/src
parentdcf9ae77854778629cabd0d6943dda3678eb91fa (diff)
parentd09d7be8bbbb39926f44834023d7120535155829 (diff)
downloadvcxsrv-01102cdf33d68a7be192a139752831ff93dee117.tar.gz
vcxsrv-01102cdf33d68a7be192a139752831ff93dee117.tar.bz2
vcxsrv-01102cdf33d68a7be192a139752831ff93dee117.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/glsl/.gitignore mesalib/src/glsl/glcpp/.gitignore
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/glsl/.gitignore3
-rw-r--r--mesalib/src/glsl/Makefile144
-rw-r--r--mesalib/src/glsl/Makefile.am112
-rw-r--r--mesalib/src/glsl/Makefile.sources4
-rw-r--r--mesalib/src/glsl/glcpp/.gitignore1
-rw-r--r--mesalib/src/glsl/glcpp/Makefile.am57
-rw-r--r--mesalib/src/mapi/glapi/.gitignore1
-rw-r--r--mesalib/src/mapi/glapi/Makefile77
-rw-r--r--mesalib/src/mapi/glapi/Makefile.am68
-rw-r--r--mesalib/src/mapi/glapi/sources.mak2
-rw-r--r--mesalib/src/mesa/Makefile.am47
-rw-r--r--mesalib/src/mesa/Makefile.old57
-rw-r--r--mesalib/src/mesa/SConscript2
-rw-r--r--mesalib/src/mesa/sources.mak2
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp19
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c19
16 files changed, 329 insertions, 286 deletions
diff --git a/mesalib/src/glsl/.gitignore b/mesalib/src/glsl/.gitignore
index afe68a0f1..eae909cd3 100644
--- a/mesalib/src/glsl/.gitignore
+++ b/mesalib/src/glsl/.gitignore
@@ -1,8 +1,11 @@
glsl_compiler
+glsl_lexer.cc
glsl_lexer.cpp
+glsl_parser.cc
glsl_parser.cpp
glsl_parser.h
glsl_parser.output
builtin_function.cpp
builtin_compiler
glsl_test
+/Makefile
diff --git a/mesalib/src/glsl/Makefile b/mesalib/src/glsl/Makefile
deleted file mode 100644
index 3cf9fc962..000000000
--- a/mesalib/src/glsl/Makefile
+++ /dev/null
@@ -1,144 +0,0 @@
-
-#src/glsl/pp/Makefile
-
-TOP = ../..
-
-include $(TOP)/configs/current
-
-LIBNAME = glsl
-
-GLSL_SRCDIR=.
-include Makefile.sources
-
-GLCPP_SOURCES = \
- $(LIBGLCPP_GENERATED_FILES) \
- $(LIBGLCPP_FILES) \
- ralloc.c \
- glcpp/glcpp.c
-
-C_SOURCES = \
- $(LIBGLCPP_GENERATED_FILES) \
- $(LIBGLCPP_FILES) \
- $(LIBGLSL_FILES)
-
-# common sources for builtin_compiler and libglsl
-CXX_SOURCES = \
- $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
- $(LIBGLSL_CXX_FILES)
-
-LIBS = \
- $(TOP)/src/glsl/libglsl.a
-
-APPS = glsl_compiler glsl_test glcpp/glcpp
-
-GLSL2_C_SOURCES = \
- ../mesa/program/hash_table.c \
- ../mesa/program/symbol_table.c
-GLSL2_CXX_SOURCES = \
- $(GLSL_COMPILER_CXX_FILES)
-
-GLSL2_OBJECTS = \
- $(GLSL2_C_SOURCES:.c=.o) \
- $(GLSL2_CXX_SOURCES:.cpp=.o)
-
-TEST_C_SOURCES = \
- ../mesa/program/hash_table.c \
- ../mesa/program/symbol_table.c
-
-TEST_CXX_SOURCES = \
- standalone_scaffolding.cpp \
- test.cpp \
- test_optpass.cpp
-
-TEST_OBJECTS = \
- $(TEST_C_SOURCES:.c=.o) \
- $(TEST_CXX_SOURCES:.cpp=.o)
-
-### Basic defines ###
-
-DEFINES += \
- $(LIBRARY_DEFINES) \
- $(API_DEFINES)
-
-GLCPP_OBJECTS = \
- $(GLCPP_SOURCES:.c=.o) \
- ../mesa/program/hash_table.o
-
-OBJECTS = \
- $(C_SOURCES:.c=.o) \
- $(CXX_SOURCES:.cpp=.o)
-
-INCLUDES = \
- -I. \
- -I../mesa \
- -I../mapi \
- -I../../include \
- $(LIBRARY_INCLUDES)
-
-ALL_SOURCES = \
- $(C_SOURCES) \
- $(CXX_SOURCES) \
- $(GLSL2_CXX_SOURCES) \
- $(GLSL2_C_SOURCES) \
- $(TEST_CXX_SOURCES) \
- $(TEST_C_SOURCES)
-
-##### TARGETS #####
-
-default: depend lib$(LIBNAME).a $(APPS)
-
-lib$(LIBNAME).a: $(OBJECTS) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template
- $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) builtin_function.o
-
-depend: $(ALL_SOURCES) Makefile
- rm -f depend
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
-
-# Remove .o and backup files
-clean:
- rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(TEST_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak builtin_function.cpp builtin_function.o builtin_stubs.o builtin_compiler
- -rm -f $(APPS)
-
-# Dummy target
-install:
- @echo -n ""
-
-##### RULES #####
-
-glsl_compiler: $(GLSL2_OBJECTS) libglsl.a
- $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@
-
-glsl_test: $(TEST_OBJECTS) libglsl.a
- $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(TEST_OBJECTS) $(LIBS) -o $@
-
-glcpp: glcpp/glcpp
-glcpp/glcpp: $(GLCPP_OBJECTS)
- $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) -o $@
-
-.cpp.o:
- $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-glsl_lexer.cpp: glsl_lexer.ll
- $(FLEX) --nounistd -o$@ $<
-
-glsl_parser.cpp: glsl_parser.yy
- $(BISON) -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $<
-
-glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
- $(FLEX) --nounistd -o$@ $<
-
-glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
- $(BISON) -v -o "$@" --defines=glcpp/glcpp-parse.h $<
-
-builtin_compiler: $(GLSL2_OBJECTS) $(OBJECTS) builtin_stubs.o
- $(APP_CXX) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) $(GLSL2_OBJECTS) builtin_stubs.o -o $@
-
-builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/glsl/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler
- @echo Regenerating builtin_function.cpp...
- $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
-
--include depend
diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am
new file mode 100644
index 000000000..d86153c48
--- /dev/null
+++ b/mesalib/src/glsl/Makefile.am
@@ -0,0 +1,112 @@
+# Copyright © 2012 Jon TURNEY
+#
+# 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.
+
+
+# builtin_compiler is built before libglsl to generate builtin_function.cpp for libglsl.
+# For this to work, a dummy version of builtin_function.cpp, builtin_stubs.cpp, is used.
+
+# Hack to make some of the non-automake variables work.
+TOP=$(top_builddir)
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/mapi \
+ -I$(top_srcdir)/src/mesa/ \
+ $(LIBRARY_INCLUDES) \
+ $(DEFINES) \
+ $(LIBRARY_DEFINES) \
+ $(API_DEFINES)
+
+AM_CXXFLAGS = $(AM_CFLAGS)
+
+AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
+
+GLSL_SRCDIR=$(top_srcdir)/src/glsl
+include Makefile.sources
+
+noinst_LTLIBRARIES = libglslcommon.la libglsl.la
+noinst_PROGRAMS = glsl_compiler glsl_test builtin_compiler
+
+# common sources for builtin_compiler and libglsl
+libglslcommon_la_SOURCES = \
+ glsl_lexer.ll \
+ glsl_parser.cc \
+ $(LIBGLSL_FILES) \
+ $(LIBGLSL_CXX_FILES)
+
+libglslcommon_la_LIBADD = glcpp/libglcpp.la
+
+# common sources for builtin_compiler and glsl_compiler
+GLSL2_SOURCES = \
+ $(top_srcdir)/src/mesa/program/hash_table.c \
+ $(top_srcdir)/src/mesa/program/symbol_table.c \
+ $(GLSL_COMPILER_CXX_FILES)
+
+libglsl_la_SOURCES = \
+ builtin_function.cpp
+
+libglsl_la_LIBADD = libglslcommon.la
+libglsl_la_LDFLAGS =
+
+glsl_compiler_SOURCES = \
+ $(GLSL2_SOURCES)
+
+glsl_compiler_LDADD = libglsl.la
+
+glsl_test_SOURCES = \
+ $(top_srcdir)/src/mesa/program/hash_table.c \
+ $(top_srcdir)/src/mesa/program/symbol_table.c \
+ $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
+ test.cpp \
+ test_optpass.cpp
+
+glsl_test_LDADD = libglsl.la
+
+builtin_compiler_SOURCES = \
+ $(GLSL2_SOURCES) \
+ builtin_stubs.cpp
+
+builtin_compiler_LDADD = libglslcommon.la
+
+# automake <=1.11 and automake >=1.12 have different conventions for naming C++ header files
+# made by yacc. To work with both, we write our own rule rather than using automake's.
+# When (if) we require automake >=1.12 in configure.ac, this can be removed, and we can use
+# the automake rule.
+glsl_parser.cc glsl_parser.h: glsl_parser.yy
+ $(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" --defines=glsl_parser.h $<
+
+BUILT_SOURCES = glsl_parser.h builtin_function.cpp
+CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES)
+
+builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/glsl/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT)
+ $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
+
+glcpp/libglcpp.la:
+ cd glcpp ; $(MAKE) $(AM_MAKEFLAGS)
+
+SUBDIRS = glcpp
+
+# Provide compatibility with scripts for the old Mesa build system for
+# a while by putting a link to the library in the current directory.
+all-local: libglsl.la
+ ln -f .libs/libglsl.a .
+
+CLEANFILES += libglsl.a
diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources
index 0425fa33e..f2743f750 100644
--- a/mesalib/src/glsl/Makefile.sources
+++ b/mesalib/src/glsl/Makefile.sources
@@ -101,8 +101,8 @@ BUILTIN_COMPILER_CXX_FILES = \
$(GLSL_SRCDIR)/builtin_stubs.cpp
BUILTIN_COMPILER_GENERATED_CXX_FILES = \
- $(GLSL_SRCDIR)/glsl_lexer.cpp \
- $(GLSL_SRCDIR)/glsl_parser.cpp
+ $(GLSL_SRCDIR)/glsl_lexer.cc \
+ $(GLSL_SRCDIR)/glsl_parser.cc
# libglsl generated sources
LIBGLSL_GENERATED_CXX_FILES = \
diff --git a/mesalib/src/glsl/glcpp/.gitignore b/mesalib/src/glsl/glcpp/.gitignore
index 9f7e0cc3e..c3f1f6e41 100644
--- a/mesalib/src/glsl/glcpp/.gitignore
+++ b/mesalib/src/glsl/glcpp/.gitignore
@@ -4,3 +4,4 @@ glcpp-parse.output
glcpp-parse.c
glcpp-parse.h
tests/*.out
+/Makefile
diff --git a/mesalib/src/glsl/glcpp/Makefile.am b/mesalib/src/glsl/glcpp/Makefile.am
new file mode 100644
index 000000000..e7d5d2ca3
--- /dev/null
+++ b/mesalib/src/glsl/glcpp/Makefile.am
@@ -0,0 +1,57 @@
+
+# Copyright © 2012 Jon TURNEY
+#
+# 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.
+
+# Hack to make some of the non-automake variables work.
+TOP=$(top_builddir)
+
+GLSL_SRCDIR=$(top_srcdir)/src/glsl
+include ../Makefile.sources
+
+AM_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/mapi \
+ -I$(top_srcdir)/src/mesa/ \
+ $(LIBRARY_INCLUDES) \
+ $(DEFINES) \
+ $(LIBRARY_DEFINES) \
+ $(API_DEFINES)
+
+AM_YFLAGS = -v -d
+AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
+
+noinst_LTLIBRARIES = libglcpp.la
+noinst_PROGRAMS = glcpp
+
+libglcpp_la_SOURCES = \
+ glcpp-lex.l \
+ glcpp-parse.y \
+ $(LIBGLCPP_FILES)
+
+glcpp_SOURCES = \
+ ../ralloc.c \
+ $(top_srcdir)/src/mesa/program/hash_table.c \
+ glcpp.c
+
+glcpp_LDADD = libglcpp.la
+
+BUILT_SOURCES = glcpp-lex.c glcpp-parse.c glcpp-parse.h
+CLEANFILES = $(BUILT_SOURCES)
diff --git a/mesalib/src/mapi/glapi/.gitignore b/mesalib/src/mapi/glapi/.gitignore
index ecae56a3f..25d3dfdcf 100644
--- a/mesalib/src/mapi/glapi/.gitignore
+++ b/mesalib/src/mapi/glapi/.gitignore
@@ -7,3 +7,4 @@ glapi_x86.S
glapitable.h
glapitemp.h
glprocs.h
+\Makefile
diff --git a/mesalib/src/mapi/glapi/Makefile b/mesalib/src/mapi/glapi/Makefile
deleted file mode 100644
index 211f384a7..000000000
--- a/mesalib/src/mapi/glapi/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-# src/mapi/glapi/Makefile
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-TARGET = glapi
-
-MAPI = $(TOP)/src/mapi/mapi
-
-include sources.mak
-include $(MAPI)/sources.mak
-
-glapi_CPPFLAGS := \
- -I$(TOP)/include \
- -I$(TOP)/src/mapi \
- -I$(TOP)/src/mesa
-
-ifeq ($(SHARED_GLAPI),1)
-glapi_CPPFLAGS += \
- -DMAPI_MODE_BRIDGE \
- -DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\"
-glapi_SOURCES := $(MAPI_BRIDGE_FILES)
-
-glapi_GLAPI_OBJECTS :=
-glapi_ASM_OBJECTS :=
-glapi_MAPI_OBJECTS := $(notdir $(MAPI_BRIDGE_FILES:.c=.o))
-else
-glapi_CPPFLAGS += -DMAPI_MODE_UTIL
-glapi_SOURCES := $(GLAPI_SOURCES) $(MAPI_UTIL_FILES)
-
-glapi_GLAPI_OBJECTS := $(GLAPI_SOURCES:.c=.o)
-glapi_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o)
-glapi_MAPI_OBJECTS := $(notdir $(MAPI_UTIL_FILES:.c=.o))
-endif # SHARED_GLAPI
-
-glapi_OBJECTS := \
- $(glapi_GLAPI_OBJECTS) \
- $(glapi_ASM_OBJECTS) \
- $(glapi_MAPI_OBJECTS)
-
-default: depend lib$(TARGET).a
-
-lib$(TARGET).a: $(glapi_OBJECTS)
- @$(MKLIB) -o $(TARGET) -static $(glapi_OBJECTS)
-
-$(glapi_GLAPI_OBJECTS): %.o: %.c
- $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@
-
-$(glapi_ASM_OBJECTS): %.o: %.S
- $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@
-
-$(glapi_MAPI_OBJECTS): %.o: $(MAPI)/%.c
- $(CC) -c $(glapi_CPPFLAGS) $(CFLAGS) $< -o $@
-
-install:
-
-clean:
- -rm -f $(glapi_OBJECTS)
- -rm -f lib$(TARGET).a
- -rm -f depend depend.bak
-
-ifeq ($(SHARED_GLAPI),1)
-# workaround a bug in makedepend
-makedepend_CPPFLAGS := \
- $(filter-out -DMAPI_ABI_HEADER=%, $(glapi_CPPFLAGS))
-$(glapi_OBJECTS): glapi_mapi_tmp.h
-else
-makedepend_CPPFLAGS := $(glapi_CPPFLAGS)
-endif
-
-depend: $(glapi_SOURCES)
- @ echo "running $(MKDEP)"
- @ touch depend
- @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(makedepend_CPPFLAGS) \
- $(glapi_SOURCES) 2>/dev/null | sed -e 's,^$(MAPI)/,,' > depend
-
--include depend
diff --git a/mesalib/src/mapi/glapi/Makefile.am b/mesalib/src/mapi/glapi/Makefile.am
new file mode 100644
index 000000000..668d7faa9
--- /dev/null
+++ b/mesalib/src/mapi/glapi/Makefile.am
@@ -0,0 +1,68 @@
+# Copyright © 2012 Jon TURNEY
+#
+# 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.
+
+TOP = $(top_srcdir)
+include sources.mak
+include ../mapi/sources.mak
+
+AM_CPPFLAGS = \
+ $(DEFINES) \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/mapi \
+ -I$(top_srcdir)/src/mesa
+
+if HAVE_X86_ASM
+GLAPI_ASM_SOURCES = $(X86_API)
+endif
+if HAVE_X86_64_ASM
+GLAPI_ASM_SOURCES = $(X86_64_API)
+endif
+if HAVE_SPARC_ASM
+GLAPI_ASM_SOURCES = $(SPARC_API)
+endif
+
+if HAVE_SHARED_GLAPI
+AM_CPPFLAGS += \
+ -DMAPI_MODE_BRIDGE \
+ -DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\"
+glapi_GLAPI_sources =
+glapi_ASM_sources =
+glapi_MAPI_sources = $(MAPI_BRIDGE_FILES)
+else
+AM_CPPFLAGS += \
+ -DMAPI_MODE_UTIL
+glapi_GLAPI_sources = $(GLAPI_SOURCES)
+glapi_ASM_sources = $(GLAPI_ASM_SOURCES)
+glapi_MAPI_sources = $(MAPI_UTIL_FILES)
+endif
+
+noinst_LTLIBRARIES = libglapi.la
+
+libglapi_la_SOURCES = $(glapi_GLAPI_sources) $(glapi_ASM_sources) $(glapi_MAPI_sources)
+libglapi_la_LIBADD =
+libglapi_la_LDFLAGS =
+
+# Provide compatibility with scripts for the old Mesa build system for
+# a while by putting a link to libglapi.a here
+all-local: libglapi.la
+ ln -sf .libs/libglapi.a libglapi.a
+
+CLEANFILES = libglapi.a
diff --git a/mesalib/src/mapi/glapi/sources.mak b/mesalib/src/mapi/glapi/sources.mak
index dfc6cc6db..aa8a4d40a 100644
--- a/mesalib/src/mapi/glapi/sources.mak
+++ b/mesalib/src/mapi/glapi/sources.mak
@@ -12,7 +12,7 @@ GLAPI_SOURCES = \
X86_API = \
glapi_x86.S
-X86-64_API = \
+X86_64_API = \
glapi_x86-64.S
SPARC_API = \
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am
index bada7601a..54c1bf8ad 100644
--- a/mesalib/src/mesa/Makefile.am
+++ b/mesalib/src/mesa/Makefile.am
@@ -93,14 +93,53 @@ program/lex.yy.c: program/program_lexer.l
mkdir -p program
$(LEX) --never-interactive --outfile=$@ $<
-all-local:
- $(MAKE) -f $(srcdir)/Makefile.old
+noinst_LTLIBRARIES = libmesa.la libmesagallium.la
+
+SRCDIR = $(top_srcdir)/src/mesa
+include sources.mak
+
+AM_CFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS) $(LLVM_CFLAGS) $(CFLAGS)
+AM_CXXFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS) $(LLVM_CFLAGS) $(CXXFLAGS)
+
+# cannot just add $(MESA_ASM_FILES) to libmesa_la_SOURCES as it contains a configure substitution
+MESA_ASM_FILES_FOR_ARCH =
+
+if HAVE_X86_ASM
+MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
+endif
+if HAVE_X86_64_ASM
+MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
+endif
+if HAVE_SPARC_ASM
+MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
+endif
+
+libmesa_la_SOURCES = \
+ $(MESA_FILES) \
+ $(MESA_CXX_FILES) \
+ $(MESA_ASM_FILES_FOR_ARCH)
+
+libmesa_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
+libmesa_la_LDFLAGS =
+
+libmesagallium_la_SOURCES = \
+ $(MESA_GALLIUM_FILES) \
+ $(MESA_GALLIUM_CXX_FILES) \
+ $(MESA_ASM_FILES_FOR_ARCH)
+
+libmesagallium_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
+libmesagallium_la_LDFLAGS =
install-exec-local:
$(MAKE) -f $(srcdir)/Makefile.old install
-clean-local:
- $(MAKE) -f $(srcdir)/Makefile.old clean
+# Provide compatibility with scripts for the old Mesa build system for
+# a while by putting a link to the library in the current directory.
+all-local: libmesa.la libmesagallium.la
+ ln -f .libs/libmesa.a .
+ ln -f .libs/libmesagallium.a .
+
+CLEANFILES += libmesa.a libmesagallium.a
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/mesalib/src/mesa/Makefile.old b/mesalib/src/mesa/Makefile.old
index 4ea70d43d..3266a5de0 100644
--- a/mesalib/src/mesa/Makefile.old
+++ b/mesalib/src/mesa/Makefile.old
@@ -3,58 +3,10 @@
TOP = ../..
include $(TOP)/configs/current
-MESA_LIBS := libmesa.a libmesagallium.a
-DEPENDS := depend
-
SRCDIR = .
include sources.mak
-# define preprocessor flags
-MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
-
-# append include dirs
-MESA_CPPFLAGS += $(INCLUDE_DIRS)
-
-# tidy compiler flags
-CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
-CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS))
-
-# LLVM is needed for the state tracker
-MESA_CFLAGS := $(LLVM_CFLAGS) $(CFLAGS)
-MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS)
-
-%.o: %.c
- $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS)
-
-%.o: %.cpp
- $(CXX) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CXXFLAGS)
-
-%.o: %.S
- $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS)
-
-# Default: build dependencies, then asm_subdirs, GLSL built-in lib,
-# then convenience libs (.a) and finally the device drivers:
-default: $(DEPENDS) $(MESA_LIBS)
-
-######################################################################
-# Helper libraries used by many drivers:
-
-# Make archive of core mesa object files
-libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
- @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
-
-# Make archive of subset of core mesa object files for gallium
-libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
- @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
-
-######################################################################
-# Dependency generation
-
-depend: $(ALL_FILES) main/git_sha1.h
- @ echo "running $(MKDEP)"
- @ touch depend
- @$(MKDEP) $(MKDEP_OPTIONS) $(MESA_CPPFLAGS) \
- $(ALL_FILES) > /dev/null 2>/dev/null
+default:
######################################################################
# Installation rules
@@ -73,10 +25,3 @@ install-osmesa: default
# Emacs tags
tags:
etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
-
-clean:
- -rm -f */*.o
- -rm -f */*/*.o
- -rm -f depend depend.bak libmesa.a libmesagallium.a
-
--include $(DEPENDS)
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index 819a0fd7d..906c57962 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -430,7 +430,7 @@ if env['gcc'] and env['platform'] not in ('darwin', 'windows'):
elif env['machine'] == 'sparc':
mesa_sources += [
'sparc/sparc.c',
- 'sparc/clip.S',
+ 'sparc/sparc_clip.S',
'sparc/norm.S',
'sparc/xform.S',
]
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index 16b1c39c0..d22f0595c 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -307,7 +307,7 @@ X86_64_FILES = \
$(SRCDIR)/x86-64/xform4.S
SPARC_FILES = \
- $(SRCDIR)/sparc/clip.S \
+ $(SRCDIR)/sparc/sparc_clip.S \
$(SRCDIR)/sparc/norm.S \
$(SRCDIR)/sparc/xform.S
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index b6abe84ac..1d91e3661 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4615,6 +4615,25 @@ st_translate_program(
if (sysInputs & (1 << i)) {
unsigned semName = mesa_sysval_to_semantic[i];
t->systemValues[i] = ureg_DECL_system_value(ureg, numSys, semName, 0);
+ if (semName == TGSI_SEMANTIC_INSTANCEID ||
+ semName == TGSI_SEMANTIC_VERTEXID) {
+ /* From Gallium perspective, these system values are always
+ * integer, and require native integer support. However, if
+ * native integer is supported on the vertex stage but not the
+ * pixel stage (e.g, i915g + draw), Mesa will generate IR that
+ * assumes these system values are floats. To resolve the
+ * inconsistency, we insert a U2F.
+ */
+ struct st_context *st = st_context(ctx);
+ struct pipe_screen *pscreen = st->pipe->screen;
+ assert(procType == TGSI_PROCESSOR_VERTEX);
+ assert(pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS));
+ if (!ctx->Const.NativeIntegers) {
+ struct ureg_dst temp = ureg_DECL_local_temporary(t->ureg);
+ ureg_U2F( t->ureg, ureg_writemask(temp, TGSI_WRITEMASK_X), t->systemValues[i]);
+ t->systemValues[i] = ureg_scalar(ureg_src(temp), 0);
+ }
+ }
numSys++;
sysInputs &= ~(1 << i);
}
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
index e414ed88c..90af1b009 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -1159,6 +1159,25 @@ st_translate_mesa_program(
if (sysInputs & (1 << i)) {
unsigned semName = mesa_sysval_to_semantic[i];
t->systemValues[i] = ureg_DECL_system_value(ureg, numSys, semName, 0);
+ if (semName == TGSI_SEMANTIC_INSTANCEID ||
+ semName == TGSI_SEMANTIC_VERTEXID) {
+ /* From Gallium perspective, these system values are always
+ * integer, and require native integer support. However, if
+ * native integer is supported on the vertex stage but not the
+ * pixel stage (e.g, i915g + draw), Mesa will generate IR that
+ * assumes these system values are floats. To resolve the
+ * inconsistency, we insert a U2F.
+ */
+ struct st_context *st = st_context(ctx);
+ struct pipe_screen *pscreen = st->pipe->screen;
+ assert(procType == TGSI_PROCESSOR_VERTEX);
+ assert(pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS));
+ if (!ctx->Const.NativeIntegers) {
+ struct ureg_dst temp = ureg_DECL_local_temporary(t->ureg);
+ ureg_U2F( t->ureg, ureg_writemask(temp, TGSI_WRITEMASK_X), t->systemValues[i]);
+ t->systemValues[i] = ureg_scalar(ureg_src(temp), 0);
+ }
+ }
numSys++;
sysInputs &= ~(1 << i);
}