Skip to content

Commit 8f1564a

Browse files
author
devsh
committed
in thre interest of thread safety we should not have default manipulator or geometry generator because of the quant cache non-thread-safety
1 parent e217665 commit 8f1564a

File tree

5 files changed

+6
-25
lines changed

5 files changed

+6
-25
lines changed

include/nbl/asset/IAssetManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ class NBL_API2 IAssetManager : public core::IReferenceCounted
113113
friend class IAssetLoader;
114114
friend class IAssetLoader::IAssetLoaderOverride; // for access to non-const findAssets
115115

116-
core::smart_refctd_ptr<CGeometryCreator> m_geometryCreator;
117-
core::smart_refctd_ptr<CPolygonGeometryManipulator> m_meshManipulator;
118116
core::smart_refctd_ptr<CCompilerSet> m_compilerSet;
119117
// called as a part of constructor only
120118
void initializeMeshTools();

include/nbl/asset/utils/CDirQuantCacheBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ struct CDirQuantCacheBase::value_type<EF_R16G16B16A16_SNORM>
244244

245245

246246
template<typename Key, class Hash, E_FORMAT... Formats>
247-
class CDirQuantCacheBase : public impl::CDirQuantCacheBase
247+
class CDirQuantCacheBase : public virtual core::IReferenceCounted, public impl::CDirQuantCacheBase
248248
{
249249
public:
250250
template<E_FORMAT CacheFormat>

include/nbl/asset/utils/CGeometryCreator.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ namespace nbl::asset
1919
/** You can get an instance of this class through ISceneManager::getGeometryCreator() */
2020
class CGeometryCreator final : public core::IReferenceCounted
2121
{
22-
core::smart_refctd_ptr<CPolygonGeometryManipulator> m_defaultPolygonManipulator;
22+
core::smart_refctd_ptr<CQuantNormalCache> m_normalCache;
23+
core::smart_refctd_ptr<CQuantQuaternionCache> m_quaternionCache;
2324

2425
public:
25-
inline CGeometryCreator(core::smart_refctd_ptr<CPolygonGeometryManipulator> _defaultPolygonManipulator) : m_defaultPolygonManipulator(std::move(_defaultPolygonManipulator))
26+
inline CGeometryCreator(core::smart_refctd_ptr<CQuantNormalCache>&& _normalCache, core::smart_refctd_ptr<CQuantQuaternionCache>&& _quaternionCache)
27+
: m_normalCache(std::move(_normalCache)), m_quaternionCache(std::move(_quaternionCache))
2628
{
27-
assert(m_defaultPolygonManipulator);
29+
assert(m_normalCache && m_quaternionCache);
2830
}
2931

3032
//! Creates a simple cube mesh.

include/nbl/asset/utils/CPolygonGeometryManipulator.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,6 @@ class NBL_API2 CPolygonGeometryManipulator
560560
}
561561
}
562562
#endif
563-
564-
565-
//!
566-
virtual CQuantNormalCache* getQuantNormalCache() = 0;
567-
virtual CQuantQuaternionCache* getQuantQuaternionCache() = 0;
568563
};
569564

570565
#if 0

src/nbl/asset/IAssetManager.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,10 @@ std::function<void(SAssetBundle&)> nbl::asset::makeAssetDisposeFunc(const IAsset
114114

115115
void IAssetManager::initializeMeshTools()
116116
{
117-
m_meshManipulator = core::make_smart_refctd_ptr<CMeshManipulator>();
118-
m_geometryCreator = core::make_smart_refctd_ptr<CGeometryCreator>(m_meshManipulator.get());
119117
if (!m_compilerSet)
120118
m_compilerSet = core::make_smart_refctd_ptr<CCompilerSet>(core::smart_refctd_ptr(m_system));
121119
}
122120

123-
const CGeometryCreator* IAssetManager::getGeometryCreator() const
124-
{
125-
return m_geometryCreator.get();
126-
}
127-
128-
CPolygonGeometryManipulator* IAssetManager::getMeshManipulator()
129-
{
130-
return m_meshManipulator.get();
131-
}
132-
133121
void IAssetManager::addLoadersAndWriters()
134122
{
135123
#ifdef _NBL_COMPILE_WITH_STL_LOADER_
@@ -200,8 +188,6 @@ void IAssetManager::addLoadersAndWriters()
200188
SAssetBundle IAssetManager::getAssetInHierarchy_impl(system::IFile* _file, const std::string& _supposedFilename, const IAssetLoader::SAssetLoadParams& _params, uint32_t _hierarchyLevel, IAssetLoader::IAssetLoaderOverride* _override)
201189
{
202190
IAssetLoader::SAssetLoadParams params(_params);
203-
if (params.meshManipulatorOverride == nullptr)
204-
params.meshManipulatorOverride = m_meshManipulator.get();
205191

206192
IAssetLoader::SAssetLoadContext ctx{params,_file};
207193

0 commit comments

Comments
 (0)