Ogre Version: 2.3
Operating System: Win10
Render System: DirectX 11
Hi, im getting an OGRE_ASSERT_LOW failure on HlmsManager::getBasicBlock when i create a Datablock( when retrieving macroblock for the datablock to be precise). can someone explain why i am getting this, Thanks.
Code: Select all
template <typename T, HlmsBasicBlock type, size_t maxLimit>
T* HlmsManager::getBasicBlock( typename vector<T>::type &container, const T &baseParams )
{
assert( mRenderSystem && "A render system must be selected first!" );
assert( baseParams.mBlockType == type &&
"baseParams.mBlockType should always be BLOCK_MACRO or BLOCK_BLEND! "
"You can ignore this assert, but it usually indicates memory corruption"
"(or you created the block without its default constructor)." );
typename vector<T>::type::iterator itor = std::find( container.begin(), container.end(),
baseParams );
if( itor == container.end() )
{
OGRE_ASSERT_LOW( container.size() <= maxLimit &&
"Exceeded the max number of blocks that can be created during "
"the lifetime of an application!!!");
container.push_back( baseParams );
container.back().mRefCount = 0;
container.back().mId = std::numeric_limits<uint16>::max();
container.back().mLifetimeId = static_cast<uint16>( container.size() - 1u );
container.back().mBlockType = type;
itor = container.end() - 1u;
}
if( !itor->mRefCount )
{
OGRE_ASSERT_LOW( itor->mId == std::numeric_limits<uint16>::max() ); // assertion failure
const size_t idx = getFreeBasicBlock( type, &*itor );
itor->mId = static_cast<uint16>( idx );
}
return &(*itor);
}
im only getting this assertion failure when i create lot of datablocks ( like more than 10,000 subMeshes. each one has its own unique datablock ). Heres how i create a Datablock for each SubMesh.
Code: Select all
Ogre::HlmsManager* pHlmsManager = Ogre::Root::getSingleton().getHlmsManager();
Ogre::HlmsPbsDatablock* pDataBlock = static_cast<Ogre::HlmsPbsDatablock*>( pHlmsManager->getDatablockNoDefault(sMaterialName) );
if( !pDataBlock )
{
/*
...
retrieving fTransperncy
...
*/
Ogre::HlmsBlendblock blend_block = Ogre::HlmsBlendblock{};
Ogre::HlmsMacroblock macro_block = Ogre::HlmsMacroblock{};
if(fTransparency>0.00001)
{
blend_block.setBlendType( Ogre::SceneBlendType::SBT_TRANSPARENT_ALPHA );
macro_block.mDepthWrite = false;
}
macro_block.mCullMode = Ogre::CullingMode::CULL_NONE;
Ogre::HlmsPbs* pHlmsPbs = static_cast<Ogre::HlmsPbs*>( pHlmsManager->getHlms( Ogre::HlmsTypes::HLMS_PBS ) );
pDataBlock = static_cast<Ogre::HlmsPbsDatablock*>( pHlmsPbs->createDatablock(sMaterialName, sMaterialName, macro_block, blend_block, {} ) ); // Getting Assertion Failure during this operation
/**
...
Setting Other Material Properties
...
**/
}
return pDataBlock;