Skip to content

Commit

Permalink
Main: Technique - avoid deadlock when shadow_*_material refers to self
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Jun 2, 2023
1 parent 65f6cde commit cda5d69
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions OgreMain/src/OgreTechnique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,27 +538,26 @@ namespace Ogre {
(*il)->pass->_load();
}

if (mShadowCasterMaterial)
{
mShadowCasterMaterial->load();
}
else if (!mShadowCasterMaterialName.empty())
if (!mShadowCasterMaterial && !mShadowCasterMaterialName.empty())
{
// in case we could not get material as it wasn't yet parsed/existent at that time.
mShadowCasterMaterial = MaterialManager::getSingleton().getByName(mShadowCasterMaterialName);
if (mShadowCasterMaterial)
mShadowCasterMaterial->load();
}
if (mShadowReceiverMaterial)

if (mShadowCasterMaterial && mShadowCasterMaterial.get() != getParent())
{
mShadowReceiverMaterial->load();
mShadowCasterMaterial->load();
}
else if (!mShadowReceiverMaterialName.empty())

if(!mShadowReceiverMaterial && !mShadowReceiverMaterialName.empty())
{
// in case we could not get material as it wasn't yet parsed/existent at that time.
mShadowReceiverMaterial = MaterialManager::getSingleton().getByName(mShadowReceiverMaterialName);
if (mShadowReceiverMaterial)
mShadowReceiverMaterial->load();
}

if (mShadowReceiverMaterial && mShadowReceiverMaterial.get() != getParent())
{
mShadowReceiverMaterial->load();
}
}
//-----------------------------------------------------------------------------
Expand Down

0 comments on commit cda5d69

Please sign in to comment.