Added KRSamplerManager::destroy()

This commit is contained in:
2022-08-19 20:10:03 -07:00
parent 9f245a9765
commit 191167f9d3
3 changed files with 13 additions and 0 deletions

View File

@@ -149,6 +149,9 @@ KRContext::~KRContext()
m_pTextureManager->destroy();
m_pTextureManager.reset();
m_pPipelineManager.reset();
if (m_pSamplerManager) {
m_pSamplerManager->destroy();
}
m_pSamplerManager.reset();
m_pAnimationManager.reset();
m_pAnimationCurveManager.reset();

View File

@@ -50,6 +50,15 @@ KRSamplerManager::KRSamplerManager(KRContext& context)
KRSamplerManager::~KRSamplerManager()
{
}
void KRSamplerManager::destroy()
{
for (SamplerMap::iterator itr = m_samplers.begin(); itr != m_samplers.end(); ++itr) {
delete (*itr).second;
}
m_samplers.clear();
}
KRSampler* KRSamplerManager::getSampler(const SamplerInfo& info)

View File

@@ -65,6 +65,7 @@ public:
virtual ~KRSamplerManager();
KRSampler* getSampler(const SamplerInfo& info);
void destroy();
private:
typedef std::unordered_map<SamplerInfo, KRSampler*, SamplerInfoHasher> SamplerMap;
SamplerMap m_samplers;