diff --git a/library/terraman_library_merger_pcm.cpp b/library/terraman_library_merger_pcm.cpp index 179ad0f..41b4c2f 100644 --- a/library/terraman_library_merger_pcm.cpp +++ b/library/terraman_library_merger_pcm.cpp @@ -101,7 +101,7 @@ void TerramanLibraryMergerPCM::_material_cache_get_key(Ref chunk) { chunk->material_cache_key_set(hash); chunk->material_cache_key_has_set(true); - _cache_mutex.lock(); + _material_cache_mutex.lock(); if (_material_cache.has(hash)) { Ref cc = _material_cache[hash]; @@ -110,7 +110,7 @@ void TerramanLibraryMergerPCM::_material_cache_get_key(Ref chunk) { cc->inc_ref_count(); } - _cache_mutex.unlock(); + _material_cache_mutex.unlock(); return; } @@ -162,7 +162,7 @@ void TerramanLibraryMergerPCM::_material_cache_get_key(Ref chunk) { _material_cache[hash] = cache; //unlock here, so if a different thread need the cache it will be able to immediately access the materials and surfaces when it gets it. - _cache_mutex.unlock(); + _material_cache_mutex.unlock(); //this will generate the atlases cache->refresh_rects(); @@ -179,7 +179,7 @@ Ref TerramanLibraryMergerPCM::_material_cache_get(const int } void TerramanLibraryMergerPCM::_material_cache_unref(const int key) { - _cache_mutex.lock(); + _material_cache_mutex.lock(); if (!_material_cache.has(key)) { return; @@ -197,7 +197,7 @@ void TerramanLibraryMergerPCM::_material_cache_unref(const int key) { _material_cache.erase(key); } - _cache_mutex.unlock(); + _material_cache_mutex.unlock(); } int TerramanLibraryMergerPCM::get_texture_flags() const { diff --git a/library/terraman_library_merger_pcm.h b/library/terraman_library_merger_pcm.h index 96a4076..2a94c58 100644 --- a/library/terraman_library_merger_pcm.h +++ b/library/terraman_library_merger_pcm.h @@ -54,6 +54,7 @@ class TerramanLibraryMergerPCM : public TerramanLibrary { public: bool _supports_caching(); + void _material_cache_get_key(Ref chunk); Ref _material_cache_get(const int key); void _material_cache_unref(const int key); @@ -125,7 +126,8 @@ protected: Ref _packer; Ref _prop_packer; - Mutex _cache_mutex; + Mutex _material_cache_mutex; + Mutex _prop_material_cache_mutex; }; #endif