diff options
author | Zack Rusin <zack@tungstengraphics.com> | 2007-10-29 08:27:32 -0400 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2007-10-29 16:14:10 +0000 |
commit | 25b17b213b7ba0d1b93ec37211504ee489944ce8 (patch) | |
tree | 5bc773224011ccc2e06e93f73952ef886e351953 /src/mesa/pipe/draw | |
parent | abe8cd19171def0de000e58b9f71c43adf4c6336 (diff) |
Refactor the LLVM code a bit.
Move the CPU vertex shader execution code to the draw
module, remove traces of LLVM from the state tracker,
abstract execution engine for the purposes of the draw module.
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r-- | src/mesa/pipe/draw/draw_private.h | 8 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex_shader.c | 10 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex_shader_llvm.c | 2 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index ac47d2a76f..f52ff0bd44 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -50,6 +50,8 @@ #include "pipe/tgsi/exec/tgsi_core.h" +struct gallivm_prog; +struct gallivm_cpu_engine; /** * Basic vertex info. * Carry some useful information around with the vertices in the prim pipe. @@ -127,6 +129,9 @@ struct draw_vertex_shader { #if defined(__i386__) || defined(__386__) struct x86_function sse2_program; #endif +#ifdef MESA_LLVM + struct gallivm_prog *llvm_prog; +#endif }; /** @@ -226,6 +231,9 @@ struct draw_context } pq; int use_sse : 1; +#ifdef MESA_LLVM + struct gallivm_cpu_engine *engine; +#endif }; diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index 9dbb317f2a..7fd17292b8 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -39,6 +39,7 @@ #include "x86/rtasm/x86sse.h" #include "pipe/tgsi/exec/tgsi_core.h" +#include "pipe/llvm/llvmtgsi.h" #define DBG 0 @@ -187,7 +188,7 @@ void draw_vertex_shader_queue_flush( struct draw_context *draw ) // fprintf(stderr, " q(%d) ", draw->vs.queue_nr ); #ifdef MESA_LLVM - if (draw->vertex_shader->state->llvm_prog) { + if (draw->vertex_shader->llvm_prog) { draw_vertex_shader_queue_flush_llvm(draw); return; } @@ -233,6 +234,13 @@ draw_create_vertex_shader(struct draw_context *draw, tgsi_emit_sse2( sh->tokens, &vs->sse2_program ); } #endif +#ifdef MESA_LLVM + vs->llvm_prog = gallivm_from_tgsi(shader->tokens); + if (!draw->engine) + draw->engine = gallivm_cpu_engine_create(vs->llvm_prog); + else + gallivm_cpu_jit_compile(draw->engine, vs->llvm_prog); +#endif return vs; } diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c index c0720d2872..b340ab38fd 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c +++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c @@ -125,7 +125,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) float inputs[VS_QUEUE_LENGTH][PIPE_MAX_SHADER_INPUTS][4]; float outputs[VS_QUEUE_LENGTH][PIPE_MAX_SHADER_INPUTS][4]; float (*consts)[4] = (float (*)[4]) draw->mapped_constants; - struct gallivm_prog *prog = (struct gallivm_prog *)draw->vertex_shader->state->llvm_prog; + struct gallivm_prog *prog = draw->vertex_shader->llvm_prog; const float *scale = draw->viewport.scale; const float *trans = draw->viewport.translate; |