Cleanup some code.

This commit is contained in:
Zack Rusin 2007-10-24 08:34:01 -04:00
parent 5040eefbb7
commit d76a7b61bb
11 changed files with 41 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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:
*/

View File

@ -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) {

View File

@ -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 */

View File

@ -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 */

View File

@ -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

View File

@ -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 );
}

View File

@ -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 \

View File

@ -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;