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
# 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
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
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;
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++) {
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:
*/
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 */
{
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) {
#include "draw_context.h"
#include "draw_vertex.h"
+#ifdef MESA_LLVM
+
#include "pipe/llvm/llvmtgsi.h"
#include "pipe/tgsi/exec/tgsi_core.h"
draw->vs.queue_nr = 0;
}
+
+#endif /* MESA_LLVM */
#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>
#include <fstream>
#include <iostream>
+#ifdef MESA_LLVM
struct ga_llvm_prog {
void *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;
}
std::cout<<"; ---------- End shader "<<prog->id<<std::endl;
}
}
+
+#endif /* MESA_LLVM */
#include "pipe/p_state.h"
+#ifdef MESA_LLVM
+
struct tgsi_exec_machine;
struct tgsi_token;
struct tgsi_sampler;
void ga_llvm_prog_dump(struct ga_llvm_prog *prog, const char *file_prefix);
+#endif /* MESA_LLVM */
+
#if defined __cplusplus
} // extern "C"
#endif
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 );
}
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 \
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;
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;