Mesa (master): draw: Make it possible to create a llvm free context

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Mon Jan 9 20:40:25 UTC 2012


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

Author: Jakob Bornecrantz <wallbraker at gmail.com>
Date:   Mon Jan  9 00:00:34 2012 +0100

draw: Make it possible to create a llvm free context

Signed-off-by: Jakob Bornecrantz <wallbraker at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/auxiliary/draw/draw_context.c |   48 ++++++++++++++++++++---------
 src/gallium/auxiliary/draw/draw_context.h |    2 +
 2 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 9c00687..f4b1f8c 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -65,30 +65,19 @@ draw_get_option_use_llvm(void)
 #endif
 
 
-
-/**
- * Create new draw module context.
- */
-struct draw_context *
-draw_create(struct pipe_context *pipe)
-{
-   return draw_create_gallivm(pipe, NULL);
-}
-
-
-
 /**
  * Create new draw module context with gallivm state for LLVM JIT.
  */
-struct draw_context *
-draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm)
+static struct draw_context *
+draw_create_context(struct pipe_context *pipe, boolean try_llvm,
+                    struct gallivm_state *gallivm)
 {
    struct draw_context *draw = CALLOC_STRUCT( draw_context );
    if (draw == NULL)
       goto fail;
 
 #if HAVE_LLVM
-   if (draw_get_option_use_llvm()) {
+   if (try_llvm && draw_get_option_use_llvm()) {
       if (!gallivm) {
          gallivm = gallivm_create();
          draw->own_gallivm = gallivm;
@@ -112,6 +101,35 @@ fail:
 }
 
 
+/**
+ * Create new draw module context, with LLVM JIT.
+ */
+struct draw_context *
+draw_create(struct pipe_context *pipe)
+{
+   return draw_create_context(pipe, TRUE, NULL);
+}
+
+
+/**
+ * Create a new draw context, without LLVM JIT.
+ */
+struct draw_context *
+draw_create_no_llvm(struct pipe_context *pipe)
+{
+   return draw_create_context(pipe, FALSE, NULL);
+}
+
+
+/**
+ * Create new draw module context with gallivm state for LLVM JIT.
+ */
+struct draw_context *
+draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm)
+{
+   return draw_create_context(pipe, TRUE, gallivm);
+}
+
 
 boolean draw_init(struct draw_context *draw)
 {
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 93577d0..7655ad0 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -54,6 +54,8 @@ struct gallivm_state;
 
 struct draw_context *draw_create( struct pipe_context *pipe );
 
+struct draw_context *draw_create_no_llvm(struct pipe_context *pipe);
+
 struct draw_context *
 draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm);
 




More information about the mesa-commit mailing list