summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/default3
-rw-r--r--configs/linux-llvm16
-rw-r--r--src/mesa/pipe/draw/draw_private.h2
-rw-r--r--src/mesa/pipe/draw/draw_vertex_fetch.c4
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader.c7
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader_llvm.c4
-rw-r--r--src/mesa/pipe/llvm/llvmtgsi.cpp6
-rw-r--r--src/mesa/pipe/llvm/llvmtgsi.h4
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c4
-rw-r--r--src/mesa/sources2
-rw-r--r--src/mesa/state_tracker/st_program.c6
11 files changed, 41 insertions, 17 deletions
diff --git a/configs/default b/configs/default
index 9379833a9c..a7de3f813d 100644
--- a/configs/default
+++ b/configs/default
@@ -40,8 +40,6 @@ GLUT_LIB = glut
GLW_LIB = GLw
OSMESA_LIB = OSMesa
-LLVM_CFLAGS=-DMESA_NO_LLVM=1
-LLVM_CXXFLAGS=-DMESA_NO_LLVM=1
# Library names (actual file names)
GL_LIB_NAME = lib$(GL_LIB).so
@@ -67,6 +65,7 @@ DRIVER_DIRS = x11 osmesa
# Which subdirs under $(TOP)/progs/ to enter:
PROGRAM_DIRS = demos redbook samples glsl xdemos
+
# Library/program dependencies
#EXTRA_LIB_PATH ?=
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
diff --git a/configs/linux-llvm b/configs/linux-llvm
index addefaa511..8e9b408861 100644
--- a/configs/linux-llvm
+++ b/configs/linux-llvm
@@ -11,21 +11,21 @@ LLVM_VERSION := $(shell llvm-config --version)
ifeq ($(LLVM_VERSION),)
$(warning Could not find LLVM! Make Sure 'llvm-config' is in the path)
- MESA_NO_LLVM=1
+ MESA_LLVM=0
else
- MESA_NO_LLVM=0
+ MESA_LLVM=1
$(info Using LLVM version: $(LLVM_VERSION))
endif
-ifeq ($(MESA_NO_LLVM),0)
-# LLVM_CFLAGS=`llvm-config --cflags` -DMESA_NO_LLVM=0
- LLVM_CFLAGS=-DMESA_NO_LLVM=0
- LLVM_CXXFLAGS=`llvm-config --cxxflags` -DMESA_NO_LLVM=0 -Wno-long-long
+ifeq ($(MESA_LLVM),1)
+# LLVM_CFLAGS=`llvm-config --cflags` -DMESA_LLVM=1
+ LLVM_CFLAGS=-DMESA_LLVM=1
+ LLVM_CXXFLAGS=`llvm-config --cxxflags` -DMESA_LLVM=1 -Wno-long-long
LLVM_LDFLAGS=`llvm-config --ldflags`
LLVM_LIBS=`llvm-config --libs`
else
- LLVM_CFLAGS=-DMESA_NO_LLVM=1
- LLVM_CXXFLAGS=-DMESA_NO_LLVM=1
+ LLVM_CFLAGS=
+ LLVM_CXXFLAGS=
endif
GL_LIB_DEPS = $(LLVM_LDFLAGS) $(LLVM_LIBS) $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index b672cc2e8b..e4c0551124 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -251,7 +251,9 @@ extern void draw_vertex_cache_reset_vertex_ids( struct draw_context *draw );
extern void draw_vertex_shader_queue_flush( struct draw_context *draw );
+#ifdef MESA_LLVM
extern void draw_vertex_shader_queue_flush_llvm( struct draw_context *draw );
+#endif
struct tgsi_exec_machine;
diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c
index 1b093b7342..de1cd06da6 100644
--- a/src/mesa/pipe/draw/draw_vertex_fetch.c
+++ b/src/mesa/pipe/draw/draw_vertex_fetch.c
@@ -96,7 +96,7 @@ void draw_vertex_fetch( struct draw_context *draw,
for (j = 0; j < count; j++) {
uint attr;
- printf("fetch vertex %u: \n", j);
+ /*printf("fetch vertex %u: \n", j);*/
/* loop over vertex attributes (vertex shader inputs) */
for (attr = 0; attr < draw->vertex_shader->state->num_inputs; attr++) {
@@ -111,7 +111,7 @@ void draw_vertex_fetch( struct draw_context *draw,
fetch_attrib4(src, draw->vertex_element[attr].src_format, p);
- printf("> %u: %f %f %f %f\n", attr, p[0], p[1], p[2], p[3]);
+ /*printf(" %u: %f %f %f %f\n", attr, p[0], p[1], p[2], p[3]);*/
/* Transform to AoS xxxx/yyyy/zzzz/wwww representation:
*/
diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c
index fb20dfa4e1..24cbf20fc7 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader.c
@@ -161,6 +161,10 @@ run_vertex_program(struct draw_context *draw,
vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
#if DBG
printf("output[%d][%d]: %f %f %f %f\n", j, slot,
+ vOut[j]->data[slot][0],
+ vOut[j]->data[slot][1],
+ vOut[j]->data[slot][2],
+ vOut[j]->data[slot][3]);
#endif
}
} /* loop over vertices */
@@ -175,10 +179,13 @@ void draw_vertex_shader_queue_flush( struct draw_context *draw )
{
unsigned i, j;
+// fprintf(stderr, " q(%d) ", draw->vs.queue_nr );
+#ifdef MESA_LLVM
if (draw->vertex_shader->state->llvm_prog) {
draw_vertex_shader_queue_flush_llvm(draw);
return;
}
+#endif
/* run vertex shader on vertex cache entries, four per invokation */
for (i = 0; i < draw->vs.queue_nr; i += 4) {
diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
index bcc44f7980..99f0aca9e5 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
@@ -35,6 +35,8 @@
#include "draw_context.h"
#include "draw_vertex.h"
+#ifdef MESA_LLVM
+
#include "pipe/llvm/llvmtgsi.h"
#include "pipe/tgsi/exec/tgsi_core.h"
@@ -199,3 +201,5 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw)
draw->vs.queue_nr = 0;
}
+
+#endif /* MESA_LLVM */
diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp
index ade4573fb8..066175cdf9 100644
--- a/src/mesa/pipe/llvm/llvmtgsi.cpp
+++ b/src/mesa/pipe/llvm/llvmtgsi.cpp
@@ -10,7 +10,6 @@
#include "pipe/tgsi/exec/tgsi_util.h"
#include "pipe/tgsi/exec/tgsi_parse.h"
#include "pipe/tgsi/exec/tgsi_dump.h"
-//#include "pipe/tgsi/tgsi_platform.h"
#include <llvm/Module.h>
#include <llvm/CallingConv.h>
@@ -36,6 +35,7 @@
#include <fstream>
#include <iostream>
+#ifdef MESA_LLVM
struct ga_llvm_prog {
void *module;
@@ -159,7 +159,7 @@ translate_instruction(llvm::Module *module,
} else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) {
val = storage->tempElement(src->SrcRegister.Index);
} else {
- fprintf(stderr, "ERROR: not support llvm source\n");
+ fprintf(stderr, "ERROR: not supported llvm source\n");
return;
}
@@ -751,3 +751,5 @@ void ga_llvm_prog_dump(struct ga_llvm_prog *prog, const char *file_prefix)
std::cout<<"; ---------- End shader "<<prog->id<<std::endl;
}
}
+
+#endif /* MESA_LLVM */
diff --git a/src/mesa/pipe/llvm/llvmtgsi.h b/src/mesa/pipe/llvm/llvmtgsi.h
index 2b9540f747..40798f9217 100644
--- a/src/mesa/pipe/llvm/llvmtgsi.h
+++ b/src/mesa/pipe/llvm/llvmtgsi.h
@@ -7,6 +7,8 @@ extern "C" {
#include "pipe/p_state.h"
+#ifdef MESA_LLVM
+
struct tgsi_exec_machine;
struct tgsi_token;
struct tgsi_sampler;
@@ -29,6 +31,8 @@ int ga_llvm_prog_exec(struct ga_llvm_prog *prog,
void ga_llvm_prog_dump(struct ga_llvm_prog *prog, const char *file_prefix);
+#endif /* MESA_LLVM */
+
#if defined __cplusplus
} // extern "C"
#endif
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 00afcd930a..3371b109fc 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -109,7 +109,9 @@ shade_quad(
machine->InterpCoefs );
}
else {
- //ga_llvm_prog_exec(softpipe->fs->llvm_prog);
+#ifdef MESA_LLVM
+ /*ga_llvm_prog_exec(softpipe->fs->llvm_prog);*/
+#endif
quad->mask &= tgsi_exec_machine_run( machine );
}
diff --git a/src/mesa/sources b/src/mesa/sources
index 1bc45c9813..6d1ba9b9bd 100644
--- a/src/mesa/sources
+++ b/src/mesa/sources
@@ -189,7 +189,7 @@ TGSIDECO_SOURCES = \
TGSIMESA_SOURCES = \
pipe/tgsi/mesa/mesa_to_tgsi.c
-ifeq ($(MESA_NO_LLVM),0)
+ifeq ($(MESA_LLVM),1)
LLVMTGSI_SOURCES = \
pipe/llvm/llvmtgsi.cpp \
pipe/llvm/storage.cpp \
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 0f9d769264..6794227e13 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -251,7 +251,9 @@ st_translate_vertex_program(struct st_context *st,
tokensOut, maxTokens);
vs.tokens = tokensOut;
+#ifdef MESA_LLVM
vs.llvm_prog = ga_llvm_from_tgsi(st->pipe, vs.tokens);
+#endif
cso = st_cached_vs_state(st, &vs);
stvp->vs = cso;
@@ -407,7 +409,9 @@ st_translate_fragment_program(struct st_context *st,
tokensOut, maxTokens);
fs.tokens = tokensOut;
- fs.llvm_prog = ga_llvm_from_tgsi(st->pipe, fs.tokens);
+#ifdef MESA_LLVM
+ /*fs.llvm_prog = ga_llvm_from_tgsi(st->pipe, fs.tokens);*/
+#endif
cso = st_cached_fs_state(st, &fs);
stfp->fs = cso;