diff options
author | Tapani Pälli <[email protected]> | 2019-03-15 09:47:49 +0200 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2019-04-16 12:58:00 +0300 |
commit | 624789e3708c87ea2a4c8d2266266b489b421cba (patch) | |
tree | c59e3a43f0d8e7f0196237d4868046681c46fce6 /src/amd/vulkan | |
parent | 04508f57d1d36587f3cc048f0f5dae0611f9330c (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/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 1f77dcadb17..1ad972a195d 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -48,6 +48,7 @@ #include "util/build_id.h" #include "util/debug.h" #include "util/mesa-sha1.h" +#include "compiler/glsl_types.h" static int radv_device_get_cache_uuid(enum radeon_family family, void *uuid) @@ -582,6 +583,7 @@ VkResult radv_CreateInstance( } _mesa_locale_init(); + glsl_type_singleton_init_or_ref(); VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false)); @@ -607,6 +609,7 @@ void radv_DestroyInstance( VG(VALGRIND_DESTROY_MEMPOOL(instance)); + glsl_type_singleton_decref(); _mesa_locale_fini(); vk_debug_report_instance_destroy(&instance->debug_report_callbacks); |