summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-04-26 15:31:37 +0100
committerJosé Fonseca <[email protected]>2010-04-26 16:05:06 +0100
commit6ecbbc3c056d177174c97ac4d1a57abed3ac3177 (patch)
tree938de992472d8bcf4bd742c954ba7f8c2b34eee0 /src
parent7fd9e3cfb0c6c639037d17281159270811f5b357 (diff)
draw: Always use the llvm middle end when available & enabled.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h3
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c37
2 files changed, 23 insertions, 17 deletions
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 4bb3282f62c..a2bfb693c09 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -132,6 +132,7 @@ struct draw_context
struct draw_pt_middle_end *fetch_emit;
struct draw_pt_middle_end *fetch_shade_emit;
struct draw_pt_middle_end *general;
+ struct draw_pt_middle_end *llvm;
} middle;
struct {
@@ -253,8 +254,8 @@ struct draw_context
#ifdef HAVE_LLVM
LLVMExecutionEngineRef engine;
- boolean use_llvm;
#endif
+
void *driver_private;
};
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index c40c25dc3a1..1d9395e06c3 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -97,12 +97,16 @@ draw_pt_arrays(struct draw_context *draw,
opt |= PT_SHADE;
}
- if (opt == 0)
- middle = draw->pt.middle.fetch_emit;
- else if (opt == PT_SHADE && !draw->pt.no_fse)
- middle = draw->pt.middle.fetch_shade_emit;
- else
- middle = draw->pt.middle.general;
+ if (draw->pt.middle.llvm) {
+ middle = draw->pt.middle.llvm;
+ } else {
+ if (opt == 0)
+ middle = draw->pt.middle.fetch_emit;
+ else if (opt == PT_SHADE && !draw->pt.no_fse)
+ middle = draw->pt.middle.fetch_shade_emit;
+ else
+ middle = draw->pt.middle.general;
+ }
/* Pick the right frontend
@@ -148,25 +152,26 @@ boolean draw_pt_init( struct draw_context *draw )
if (!draw->pt.middle.fetch_shade_emit)
return FALSE;
-#if HAVE_LLVM
- draw->use_llvm = debug_get_option_draw_use_llvm();
- if (draw->use_llvm)
- draw->pt.middle.general = draw_pt_fetch_pipeline_or_emit_llvm( draw );
-#else
- draw->pt.middle.general = NULL;
-#endif
-
- if (!draw->pt.middle.general)
- draw->pt.middle.general = draw_pt_fetch_pipeline_or_emit( draw );
+ draw->pt.middle.general = draw_pt_fetch_pipeline_or_emit( draw );
if (!draw->pt.middle.general)
return FALSE;
+#if HAVE_LLVM
+ if (debug_get_option_draw_use_llvm())
+ draw->pt.middle.llvm = draw_pt_fetch_pipeline_or_emit_llvm( draw );
+#endif
+
return TRUE;
}
void draw_pt_destroy( struct draw_context *draw )
{
+ if (draw->pt.middle.llvm) {
+ draw->pt.middle.llvm->destroy( draw->pt.middle.llvm );
+ draw->pt.middle.llvm = NULL;
+ }
+
if (draw->pt.middle.general) {
draw->pt.middle.general->destroy( draw->pt.middle.general );
draw->pt.middle.general = NULL;