aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-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
6 files changed, 84 insertions, 62 deletions
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);
}