From d09d7be8bbbb39926f44834023d7120535155829 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 16 Jul 2012 07:49:02 +0200 Subject: libX11 mesa git update 16 Jul 2012 --- mesalib/Makefile.am | 6 +- mesalib/configs/current.in | 3 +- mesalib/configure.ac | 32 +++-- mesalib/src/glsl/.gitignore | 3 + mesalib/src/glsl/Makefile | 144 --------------------- mesalib/src/glsl/Makefile.am | 112 ++++++++++++++++ mesalib/src/glsl/Makefile.sources | 4 +- mesalib/src/glsl/glcpp/.gitignore | 1 + mesalib/src/glsl/glcpp/Makefile.am | 57 ++++++++ mesalib/src/mapi/glapi/.gitignore | 1 + mesalib/src/mapi/glapi/Makefile | 77 ----------- mesalib/src/mapi/glapi/Makefile.am | 68 ++++++++++ mesalib/src/mapi/glapi/sources.mak | 2 +- mesalib/src/mesa/Makefile.am | 47 ++++++- mesalib/src/mesa/Makefile.old | 57 +------- mesalib/src/mesa/SConscript | 2 +- mesalib/src/mesa/sources.mak | 2 +- mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 19 +++ mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c | 19 +++ 19 files changed, 352 insertions(+), 304 deletions(-) delete mode 100644 mesalib/src/glsl/Makefile create mode 100644 mesalib/src/glsl/Makefile.am create mode 100644 mesalib/src/glsl/glcpp/Makefile.am delete mode 100644 mesalib/src/mapi/glapi/Makefile create mode 100644 mesalib/src/mapi/glapi/Makefile.am (limited to 'mesalib') diff --git a/mesalib/Makefile.am b/mesalib/Makefile.am index 8210fccd4..b2c810aef 100644 --- a/mesalib/Makefile.am +++ b/mesalib/Makefile.am @@ -58,9 +58,9 @@ PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION) EXTRA_FILES = \ aclocal.m4 \ configure \ - src/glsl/glsl_parser.cpp \ + src/glsl/glsl_parser.cc \ src/glsl/glsl_parser.h \ - src/glsl/glsl_lexer.cpp \ + src/glsl/glsl_lexer.cc \ src/glsl/glcpp/glcpp-lex.c \ src/glsl/glcpp/glcpp-parse.c \ src/glsl/glcpp/glcpp-parse.h \ @@ -80,7 +80,7 @@ IGNORE_FILES = \ parsers: configure -@touch $(top_builddir)/configs/current - $(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp + $(MAKE) -C src/glsl glsl_parser.cc glsl_parser.h glsl_lexer.cc $(MAKE) -C src/glsl/glcpp glcpp-lex.c glcpp-parse.c glcpp-parse.h $(MAKE) -C src/mesa program/lex.yy.c program/program_parse.tab.c program/program_parse.tab.h diff --git a/mesalib/configs/current.in b/mesalib/configs/current.in index f4858bdfa..dc0dea835 100644 --- a/mesalib/configs/current.in +++ b/mesalib/configs/current.in @@ -47,7 +47,6 @@ DLOPEN_LIBS = @DLOPEN_LIBS@ # Source selection MESA_ASM_FILES = @MESA_ASM_FILES@ -GLAPI_ASM_SOURCES = @GLAPI_ASM_SOURCES@ # Misc tools and flags MAKE = @MAKE@ @@ -147,8 +146,8 @@ VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@ GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) @GLAPI_LIB_DEPS@ # DRI dependencies -MESA_MODULES = @MESA_MODULES@ DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ +GALLIUM_DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @GALLIUM_DRI_LIB_DEPS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIB = @LIBDRM_LIBS@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 08ea5beb4..9227474f1 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -454,7 +454,6 @@ AC_ARG_ENABLE([asm], ) asm_arch="" MESA_ASM_FILES="" -GLAPI_ASM_SOURCES="" AC_MSG_CHECKING([whether to enable assembly]) test "x$enable_asm" = xno && AC_MSG_RESULT([no]) # disable if cross compiling on x86/x86_64 since we must run gen_matypes @@ -503,19 +502,16 @@ if test "x$enable_asm" = xyes; then x86) DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" MESA_ASM_FILES='$(X86_FILES)' - GLAPI_ASM_SOURCES='$(X86_API)' AC_MSG_RESULT([yes, x86]) ;; x86_64) DEFINES="$DEFINES -DUSE_X86_64_ASM" MESA_ASM_FILES='$(X86_64_FILES)' - GLAPI_ASM_SOURCES='$(X86-64_API)' AC_MSG_RESULT([yes, x86_64]) ;; sparc) DEFINES="$DEFINES -DUSE_SPARC_ASM" MESA_ASM_FILES='$(SPARC_FILES)' - GLAPI_ASM_SOURCES='$(SPARC_API)' AC_MSG_RESULT([yes, sparc]) ;; *) @@ -524,7 +520,6 @@ if test "x$enable_asm" = xyes; then esac fi AC_SUBST([MESA_ASM_FILES]) -AC_SUBST([GLAPI_ASM_SOURCES]) dnl PIC code macro MESA_PIC_FLAGS @@ -1065,17 +1060,17 @@ GLAPI_LIB_DEPS="-lpthread $SELINUX_LIBS" AC_SUBST([GLAPI_LIB_DEPS]) -dnl Setup default DRI CFLAGS -DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a' -MESA_MODULES='$(TOP)/src/mesa/libmesa.a' +dnl dri libraries are linking with mesa +DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.la' +GALLIUM_DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a' +dnl ... or dricore? if test "x$enable_dri" = xyes && test "x$driglx_direct" = xyes ; then - DRI_LIB_DEPS="-L\$(TOP)/\$(LIB_DIR) -ldricore$VERSION" - MESA_MODULES="\$(TOP)/\$(LIB_DIR)/libdricore$VERSION.so" + DRI_LIB_DEPS="\$(TOP)/src/mesa/libdricore/libdricore${VERSION}.la" + GALLIUM_DRI_LIB_DEPS="\$(TOP)/\$(LIB_DIR)/libdricore${VERSION}.so" HAVE_DRICORE=yes fi AM_CONDITIONAL(HAVE_DRICORE, test x$HAVE_DRICORE = xyes) -AC_SUBST([MESA_MODULES]) AC_SUBST([HAVE_XF86VIDMODE]) @@ -1250,10 +1245,12 @@ if test "x$enable_dri" = xyes; then # put all the necessary libs together DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS" + GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS" fi AC_SUBST([DRI_DIRS]) AC_SUBST([EXPAT_INCLUDES]) AC_SUBST([DRI_LIB_DEPS]) +AC_SUBST([GALLIUM_DRI_LIB_DEPS]) case $DRI_DIRS in *i915*|*i965*) @@ -1351,10 +1348,14 @@ if test "x$enable_osmesa" = xyes; then OSMESA_MESA_DEPS="" OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" fi + +OSMESA_VERSION=`echo "$VERSION" | $SED 's/\./:/g'` + AC_SUBST([OSMESA_LIB_DEPS]) AC_SUBST([OSMESA_MESA_DEPS]) AC_SUBST([OSMESA_PC_REQ]) AC_SUBST([OSMESA_PC_LIB_PRIV]) +AC_SUBST([OSMESA_VERSION]) dnl dnl gbm configuration @@ -1727,8 +1728,9 @@ for plat in $egl_platforms; do [AC_MSG_ERROR([cannot find libwayland-client])]) GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland" - m4_ifdef([WAYLAND_SCANNER_RULES], - [WAYLAND_SCANNER_RULES(['$(top_srcdir)/src/egl/wayland/wayland-drm/protocol'])]) + WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client` + AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],, + [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH]) ;; x11) @@ -2147,9 +2149,12 @@ AC_CONFIG_FILES([configs/current src/egl/wayland/wayland-egl/Makefile src/egl/wayland/wayland-egl/wayland-egl.pc src/egl/wayland/wayland-drm/Makefile + src/glsl/Makefile + src/glsl/glcpp/Makefile src/glsl/tests/Makefile src/glx/Makefile src/glx/tests/Makefile + src/mapi/glapi/Makefile src/mapi/glapi/gen/Makefile src/mapi/shared-glapi/Makefile src/mapi/glapi/tests/Makefile @@ -2169,6 +2174,7 @@ AC_CONFIG_FILES([configs/current src/mesa/drivers/dri/r200/Makefile src/mesa/drivers/dri/radeon/Makefile src/mesa/drivers/dri/swrast/Makefile + src/mesa/drivers/osmesa/Makefile src/mesa/drivers/x11/Makefile src/mesa/gl.pc src/mesa/osmesa.pc]) diff --git a/mesalib/src/glsl/.gitignore b/mesalib/src/glsl/.gitignore index d26839a3e..c9a9f30f0 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 24a7119ca..64033e2aa 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); } -- cgit v1.2.3