aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/context.c
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2019-03-15 09:47:49 +0200
committerTapani Pälli <[email protected]>2019-04-16 12:58:00 +0300
commit624789e3708c87ea2a4c8d2266266b489b421cba (patch)
treec59e3a43f0d8e7f0196237d4868046681c46fce6 /src/mesa/main/context.c
parent04508f57d1d36587f3cc048f0f5dae0611f9330c (diff)
compiler/glsl: handle case where we have multiple users for types
Both Vulkan and OpenGL might be using glsl_types simultaneously or we can also have multiple concurrent Vulkan instances using glsl_types. Patch adds a one time init to track number of users and will release types only when last user calls _glsl_type_singleton_decref(). This change fixes glsl_type memory leaks we have with anv driver. v2: reuse hash_mutex, cleanup, apply fix also to radv driver and rename helper functions (Jason) v3: move init, destroy to happen on GL context init and destroy Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r--src/mesa/main/context.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index e5a89d9c2fc..7300d2f3c46 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1196,6 +1196,8 @@ _mesa_initialize_context(struct gl_context *ctx,
/* misc one-time initializations */
one_time_init(ctx);
+ _mesa_init_shader_compiler_types();
+
/* Plug in driver functions and context pointer here.
* This is important because when we call alloc_shared_state() below
* we'll call ctx->Driver.NewTextureObject() to create the default
@@ -1383,6 +1385,8 @@ _mesa_free_context_data( struct gl_context *ctx )
free(ctx->VersionString);
+ _mesa_destroy_shader_compiler_types();
+
/* unbind the context if it's currently bound */
if (ctx == _mesa_get_current_context()) {
_mesa_make_current(NULL, NULL, NULL);