Mesa (master): draw llvm: fix constructor mess

Zack Rusin zack at kemper.freedesktop.org
Mon Apr 19 16:48:35 UTC 2010


Module: Mesa
Branch: master
Commit: 7c4208c3a0f48955720f41b3cb320a120c505ba6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c4208c3a0f48955720f41b3cb320a120c505ba6

Author: Zack Rusin <zackr at vmware.com>
Date:   Mon Apr 19 12:46:08 2010 -0400

draw llvm: fix constructor mess

use just one constructor to figure out whether to use llvm.

---

 src/gallium/auxiliary/draw/draw_context.c |    8 ++++++++
 src/gallium/auxiliary/draw/draw_context.h |    7 -------
 src/gallium/auxiliary/draw/draw_llvm.c    |   22 +---------------------
 src/gallium/drivers/llvmpipe/lp_context.c |    8 --------
 4 files changed, 9 insertions(+), 36 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 5726444..0d8f880 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -38,6 +38,9 @@
 #include "draw_vs.h"
 #include "draw_gs.h"
 
+#if HAVE_LLVM
+#include "gallivm/lp_bld_init.h"
+#endif
 
 struct draw_context *draw_create( struct pipe_context *pipe )
 {
@@ -45,6 +48,11 @@ struct draw_context *draw_create( struct pipe_context *pipe )
    if (draw == NULL)
       goto fail;
 
+#if HAVE_LLVM
+   assert(lp_build_engine);
+   draw->engine = lp_build_engine;
+#endif
+
    if (!draw_init(draw))
       goto fail;
 
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 0d32830..51767bb 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -197,11 +197,4 @@ boolean draw_need_pipeline(const struct draw_context *draw,
                            const struct pipe_rasterizer_state *rasterizer,
                            unsigned prim );
 
-#ifdef HAVE_LLVM
-/*******************************************************************************
- * LLVM integration
- */
-struct draw_context *draw_create_with_llvm(void);
-#endif
-
 #endif /* DRAW_CONTEXT_H */
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index a5403a4..e3ef9e4 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -196,7 +196,7 @@ draw_llvm_create(struct draw_context *draw)
    init_globals(llvm);
 
 
-#if 1
+#if 0
    LLVMDumpModule(llvm->module);
 #endif
 
@@ -223,26 +223,6 @@ draw_llvm_prepare(struct draw_llvm *llvm, int num_inputs)
    return variant;
 }
 
-
-struct draw_context *draw_create_with_llvm(void)
-{
-   struct draw_context *draw = CALLOC_STRUCT( draw_context );
-   if (draw == NULL)
-      goto fail;
-
-   assert(lp_build_engine);
-   draw->engine = lp_build_engine;
-
-   if (!draw_init(draw))
-      goto fail;
-
-   return draw;
-
-fail:
-   draw_destroy( draw );
-   return NULL;
-}
-
 static void
 generate_vs(struct draw_llvm *llvm,
             LLVMBuilderRef builder,
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index efdc245..f7cf06d 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -45,10 +45,6 @@
 #include "lp_query.h"
 #include "lp_setup.h"
 
-
-#define USE_DRAW_LLVM 1
-
-
 static void llvmpipe_destroy( struct pipe_context *pipe )
 {
    struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
@@ -162,11 +158,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
    /*
     * Create drawing context and plug our rendering stage into it.
     */
-#if USE_DRAW_LLVM
-   llvmpipe->draw = draw_create_with_llvm(&llvmpipe->pipe);
-#else
    llvmpipe->draw = draw_create(&llvmpipe->pipe);
-#endif
    if (!llvmpipe->draw)
       goto fail;
 




More information about the mesa-commit mailing list