Now only initializing glslang when compiling shaders
This commit is contained in:
@@ -106,7 +106,6 @@ KRContext::KRContext(const KrInitializeInfo* initializeInfo)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
createDeviceContexts();
|
createDeviceContexts();
|
||||||
glslang::InitializeProcess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KRContext::~KRContext() {
|
KRContext::~KRContext() {
|
||||||
@@ -171,7 +170,6 @@ KRContext::~KRContext() {
|
|||||||
delete m_resourceMap;
|
delete m_resourceMap;
|
||||||
m_resourceMap = NULL;
|
m_resourceMap = NULL;
|
||||||
}
|
}
|
||||||
glslang::FinalizeProcess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRContext::SetLogCallback(log_callback *log_callback, void *user_data)
|
void KRContext::SetLogCallback(log_callback *log_callback, void *user_data)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "KREngine-common.h"
|
#include "KREngine-common.h"
|
||||||
|
|
||||||
KRShaderManager::KRShaderManager(KRContext &context) : KRResourceManager(context)
|
KRShaderManager::KRShaderManager(KRContext &context) : KRResourceManager(context)
|
||||||
|
, m_initializedGlslang(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -44,6 +45,9 @@ KRShaderManager::~KRShaderManager()
|
|||||||
delete (*name_itr).second;
|
delete (*name_itr).second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (m_initializedGlslang) {
|
||||||
|
glslang::FinalizeProcess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KRResource* KRShaderManager::loadResource(const std::string& name, const std::string& extension, KRDataBlock* data)
|
KRResource* KRShaderManager::loadResource(const std::string& name, const std::string& extension, KRDataBlock* data)
|
||||||
@@ -118,5 +122,9 @@ const unordered_map<std::string, KRShader *> &KRShaderManager::get(const std::st
|
|||||||
|
|
||||||
bool KRShaderManager::compileAll()
|
bool KRShaderManager::compileAll()
|
||||||
{
|
{
|
||||||
|
if (!m_initializedGlslang) {
|
||||||
|
glslang::InitializeProcess();
|
||||||
|
m_initializedGlslang = true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
unordered_map<std::string, unordered_map<std::string, KRShader *> > m_shaders;
|
unordered_map<std::string, unordered_map<std::string, KRShader *> > m_shaders;
|
||||||
|
bool m_initializedGlslang;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(KRUNKNOWN_MANAGER_H) */
|
#endif /* defined(KRUNKNOWN_MANAGER_H) */
|
||||||
|
|||||||
Reference in New Issue
Block a user