diff options
author | Mathias Fröhlich <[email protected]> | 2014-08-28 19:49:35 +0200 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2014-09-30 20:45:19 +0200 |
commit | 83c62597fc8eb38bf274fa1a3ca03c6adafb4bf9 (patch) | |
tree | 512da771be3fa564311d151785c62eb06ad40a64 /src/gallium/drivers/llvmpipe/lp_context.c | |
parent | 98d00d664009c74ac0c827b3c41c15e3fe1993d4 (diff) |
llvmpipe: Use two LLVMContexts per OpenGL context instead of a global one.
This is one step to make llvmpipe thread safe as mandated by the OpenGL
standard. Using the global LLVMContext is obviously a problem for
that kind of use pattern. The patch introduces two LLVMContext
instances that are private to an OpenGL context and used for all
compiles. One is put into struct draw_llvm and the other
one into struct llvmpipe_context.
Reviewed-by: Jose Fonseca <[email protected]>
Signed-off-by: Mathias Froehlich <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_context.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_context.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index d9696c2067d..3a9b4c22a9b 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -93,6 +93,9 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) lp_delete_setup_variants(llvmpipe); + LLVMContextDispose(llvmpipe->context); + llvmpipe->context = NULL; + align_free( llvmpipe ); } @@ -161,6 +164,10 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv ) llvmpipe_init_context_resource_funcs( &llvmpipe->pipe ); llvmpipe_init_surface_functions(llvmpipe); + llvmpipe->context = LLVMContextCreate(); + if (!llvmpipe->context) + goto fail; + /* * Create drawing context and plug our rendering stage into it. */ |