Material.getBestTechnique(...) may return NULL, if a material could not be successfully compiled.
Now in several places, OGRE depends on getBestTechnique() without checking for NULL, e.g.
OgreManualObject::getShadowVolumeRenderableIterator(...):
Code: Select all
Technique* t = mat->getBestTechnique(0, *seci);
for (unsigned short p = 0; p < t->getNumPasses(); ++p)
Code: Select all
Technique* lateTech = pass->getParent()->getParent()->getBestTechnique();
if (lateTech->getNumPasses() <= pass->getIndex())
InstanceBatchShader::calculateMaxNumInstances(...):
Code: Select all
Technique *technique = mMaterial->getBestTechnique();
if( technique )
- Is it intended not to check at some places, e.g. due to performance reasons?
- If this is so, wouldn't it be better to throw directly, when a faulty material is detected? Currently, it is only logged* - but will lead to an inevitable crash in some situations. An instant throw would leave the causing material as the last message in the log, making it easier to find the problem.
*see Material::compile():
Code: Select all
if (mSupportedTechniques.empty())
{
LogManager::getSingleton().stream(LML_CRITICAL)
<< "WARNING: material " << mName << " has no supportable "
<< "Techniques and will be blank. Explanation: \n" << mUnsupportedReasons;
}