OSDN Git Service

compiler/glsl: handle case where we have multiple users for types
authorTapani Pälli <tapani.palli@intel.com>
Fri, 15 Mar 2019 07:47:49 +0000 (09:47 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Tue, 16 Apr 2019 09:58:00 +0000 (12:58 +0300)
commit624789e3708c87ea2a4c8d2266266b489b421cba
treec59e3a43f0d8e7f0196237d4868046681c46fce6
parent04508f57d1d36587f3cc048f0f5dae0611f9330c
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 <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/amd/vulkan/radv_device.c
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/glsl_parser_extras.h
src/compiler/glsl/standalone.cpp
src/compiler/glsl_types.cpp
src/compiler/glsl_types.h
src/intel/vulkan/anv_device.c
src/mesa/main/context.c