From: José Fonseca Date: Mon, 26 Apr 2010 14:31:37 +0000 (+0100) Subject: draw: Always use the llvm middle end when available & enabled. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6ecbbc3c056d177174c97ac4d1a57abed3ac3177;p=mesa.git draw: Always use the llvm middle end when available & enabled. --- 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;