diff options
author | Mathias Fröhlich <[email protected]> | 2014-09-21 08:54:00 +0200 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2014-09-30 20:51:02 +0200 |
commit | 43e2109326d0b3bcf9b2241b054dadeceae33ca5 (patch) | |
tree | 8114619f9112f06b984f9c5542b0e31309abfd76 /src/gallium/auxiliary/draw/draw_llvm.c | |
parent | d90ff351f3a3598834f77b9c0723532b3abd3cd5 (diff) |
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 <[email protected]>
Signed-off-by: Mathias Froehlich <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 8469d6999b1..14c802b3b2a 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -480,7 +480,7 @@ get_vertex_header_ptr_type(struct draw_llvm_variant *variant) * Create per-context LLVM info. */ struct draw_llvm * -draw_llvm_create(struct draw_context *draw) +draw_llvm_create(struct draw_context *draw, LLVMContextRef context) { struct draw_llvm *llvm; @@ -493,7 +493,11 @@ draw_llvm_create(struct draw_context *draw) llvm->draw = draw; - llvm->context = LLVMContextCreate(); + llvm->context = context; + if (!llvm->context) { + llvm->context = LLVMContextCreate(); + llvm->context_owned = true; + } if (!llvm->context) goto fail; @@ -517,7 +521,8 @@ fail: void draw_llvm_destroy(struct draw_llvm *llvm) { - LLVMContextDispose(llvm->context); + if (llvm->context_owned) + LLVMContextDispose(llvm->context); llvm->context = NULL; /* XXX free other draw_llvm data? */ |