diff options
| author | Mathias Fröhlich <Mathias.Froehlich@gmx.net> | 2014-09-21 08:54:00 +0200 |
|---|---|---|
| committer | Mathias Fröhlich <Mathias.Froehlich@gmx.net> | 2014-09-30 20:51:02 +0200 |
| commit | 43e2109326d0b3bcf9b2241b054dadeceae33ca5 (patch) | |
| tree | 8114619f9112f06b984f9c5542b0e31309abfd76 /src/gallium/auxiliary/draw/draw_context.c | |
| parent | d90ff351f3a3598834f77b9c0723532b3abd3cd5 (diff) | |
| download | external_mesa3d-43e2109326d0b3bcf9b2241b054dadeceae33ca5.tar.gz external_mesa3d-43e2109326d0b3bcf9b2241b054dadeceae33ca5.tar.bz2 external_mesa3d-43e2109326d0b3bcf9b2241b054dadeceae33ca5.zip | |
llvmpipe: Reuse llvmpipes LLVMContext in the draw context.
Reuse the LLVMContext already allocated in llvmpipe_context
for draw_llvm if ppossible. This should decrease the memory
footprint of an llvmpipe context.
v2: Fix compile with llvm disabled.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_context.c')
| -rw-r--r-- | src/gallium/auxiliary/draw/draw_context.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 85f8e26eb3..b0f4ca2c4c 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -81,7 +81,8 @@ draw_get_option_use_llvm(void) * Create new draw module context with gallivm state for LLVM JIT. */ static struct draw_context * -draw_create_context(struct pipe_context *pipe, boolean try_llvm) +draw_create_context(struct pipe_context *pipe, void *context, + boolean try_llvm) { struct draw_context *draw = CALLOC_STRUCT( draw_context ); if (draw == NULL) @@ -92,7 +93,7 @@ draw_create_context(struct pipe_context *pipe, boolean try_llvm) #if HAVE_LLVM if (try_llvm && draw_get_option_use_llvm()) { - draw->llvm = draw_llvm_create(draw); + draw->llvm = draw_llvm_create(draw, (LLVMContextRef)context); } #endif @@ -120,17 +121,26 @@ err_out: struct draw_context * draw_create(struct pipe_context *pipe) { - return draw_create_context(pipe, TRUE); + return draw_create_context(pipe, NULL, TRUE); } +#if HAVE_LLVM +struct draw_context * +draw_create_with_llvm_context(struct pipe_context *pipe, + void *context) +{ + return draw_create_context(pipe, context, TRUE); +} +#endif + /** * 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); + return draw_create_context(pipe, NULL, FALSE); } |
