Add a function that kills shaders and use it when reloading shader.
Thus there is no mesh corruption.
This commit is contained in:
parent
5abc404ed9
commit
d968ce11bf
@ -736,7 +736,7 @@ void IrrDriver::applyResolutionSettings()
|
|||||||
// FIXME: this load sequence is (mostly) duplicated from main.cpp!!
|
// FIXME: this load sequence is (mostly) duplicated from main.cpp!!
|
||||||
// That's just error prone
|
// That's just error prone
|
||||||
// (we're sure to update main.cpp at some point and forget this one...)
|
// (we're sure to update main.cpp at some point and forget this one...)
|
||||||
|
m_shaders->killShaders();
|
||||||
// initDevice will drop the current device.
|
// initDevice will drop the current device.
|
||||||
initDevice();
|
initDevice();
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ public:
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
inline video::E_MATERIAL_TYPE getShader(const ShaderType num) {return m_shaders->getShader(num);}
|
inline video::E_MATERIAL_TYPE getShader(const ShaderType num) {return m_shaders->getShader(num);}
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
inline void updateShaders() {m_shaders->loadShaders();}
|
inline void updateShaders() {m_shaders->killShaders();}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
inline video::IShaderConstantSetCallBack* getCallback(const ShaderType num)
|
inline video::IShaderConstantSetCallBack* getCallback(const ShaderType num)
|
||||||
{
|
{
|
||||||
|
@ -399,9 +399,6 @@ void Shaders::loadShaders()
|
|||||||
}
|
}
|
||||||
|
|
||||||
initGL();
|
initGL();
|
||||||
// Clean alive shaders
|
|
||||||
for (unsigned i = 0; i < CleanTable.size(); i++)
|
|
||||||
CleanTable[i]();
|
|
||||||
CleanTable.clear();
|
CleanTable.clear();
|
||||||
initQuadVBO();
|
initQuadVBO();
|
||||||
initQuadBuffer();
|
initQuadBuffer();
|
||||||
@ -418,6 +415,12 @@ void Shaders::loadShaders()
|
|||||||
UtilShader::ColoredLine::init();
|
UtilShader::ColoredLine::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Shaders::killShaders()
|
||||||
|
{
|
||||||
|
for (unsigned i = 0; i < CleanTable.size(); i++)
|
||||||
|
CleanTable[i]();
|
||||||
|
}
|
||||||
|
|
||||||
Shaders::~Shaders()
|
Shaders::~Shaders()
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
@ -1039,6 +1039,7 @@ public:
|
|||||||
video::IShaderConstantSetCallBack * m_callbacks[ES_COUNT];
|
video::IShaderConstantSetCallBack * m_callbacks[ES_COUNT];
|
||||||
|
|
||||||
void loadShaders();
|
void loadShaders();
|
||||||
|
void killShaders();
|
||||||
private:
|
private:
|
||||||
void check(const int num) const;
|
void check(const int num) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user