Hello,

I did run into an infinite loop in ShaderCacheTreeV3::sub method. I have
no clue what is actually happening, therefore I will just outline my
setup. I have build a scene graph with some of the geometry cores shared
by different material branches. The materials I use fall into two
groups. The first one is just a classical OpenGL material, nothing fancy
there. The second one is a ShaderProgram material with a vertex,
geometry and fragment shader responsible for rendering the silhouettes
of the geometry. The ShaderProgram chunks are shared among all of the
materials in the second group. Overall this setup works quite well, but
sometimes my application freezes. As it turned out it is hanging in the
following snipped of OpenSG code:

OSGShaderCacheTree.inl : 3255

template<class ObjectT, UInt32 LevelBits> inline
void ShaderCacheTreeV3<ObjectT, LevelBits>::sub(UInt32 uiIdx)
{
    IdType uiStartLevel  = IdType((uiIdx - 1) * LevelFactor);

    if(uiStartLevel >= _vLevelEntries.size())
    {
        return;
    }

    UInt32    uiLevelSub = (uiStartLevel * LevelBits);
    UInt32    uiCurrIdx  = uiIdx - uiLevelSub;
    UInt32    uiCurrBits = IdxToBits[uiCurrIdx];

    TreeNode *pCurrNode  = _vLevelEntries[uiStartLevel];

    for(; pCurrNode != NULL; pCurrNode = pCurrNode->_pNext)
    {
        for(UInt32 i = 0; i < LevelSize; ++i)
        {
            TreeNode *pChild = pCurrNode->_vChildren[i].asT2();

            if(0x0000 != (i & uiCurrBits) && pChild != NULL)
            {
                if(pChild->_pNext == NULL)
                {
                    pChild->_pPrev->_pNext = NULL;
                }
                else
                {
                    pChild->_pPrev->_pNext = pChild->_pNext;
                    pChild->_pNext->_pPrev = pChild->_pPrev;
                }
                
                pChild->_pPrev = NULL;
                pChild->_pNext = NULL;

                eraseNode(pCurrNode->_vChildren[i].asT2());
                pCurrNode->_vJumps   [i] = 0;
                pCurrNode->_vChildren[i].setAsT2(NULL);
            }
            else if(pCurrNode->_vChildren[i].asT1() != NULL)
            {
                pCurrNode->_vChildren[i].setAsT1(NULL);
                pCurrNode->_vJumps   [i] = 0;
            }
        }
    }
}

Closer inspection showed me that the pCurrNode = pCurrNode->_pNext is
responsible for the infinite loop. Unfortunately, I do not understand
what is actually happening. Below you can find the involved call stack.

>
OSGSystemD.dll!OSG::ShaderCacheTreeV3<OSG::ShaderExecutableChunk,3>::sub
(unsigned int uiIdx=40)  Line 3272      C++
 
OSGSystemD.dll!OSG::ShaderCache::removeShaderProgram(OSG::FieldContainer
* pContainer=0x00000000224480f8, const unsigned __int64 whichField=0)
Line 606        C++
 
OSGSystemD.dll!boost::_mfi::mf2<void,OSG::ShaderCache,OSG::FieldContaine
r * __ptr64,unsigned __int64>::operator()(OSG::ShaderCache *
p=0x00000000185bfb00, OSG::FieldContainer * a1=0x00000000224480f8,
unsigned __int64 a2=0)  Line 281        C++
 
OSGSystemD.dll!boost::_bi::list3<boost::_bi::value<OSG::ShaderCache *
__ptr64>,boost::arg<1>,boost::arg<2>
>::operator()<boost::_mfi::mf2<void,OSG::ShaderCache,OSG::FieldContainer
* __ptr64,unsigned __int64>,boost::_bi::list3<OSG::FieldContainer *
__ptr64 & __ptr64,unsigned __int64 & __ptr64,unsigned int & __ptr64>
>(boost::_bi::type<void> __formal={...},
boost::_mfi::mf2<void,OSG::ShaderCache,OSG::FieldContainer *,unsigned
__int64> & f={...}, boost::_bi::list3<OSG::FieldContainer * &,unsigned
__int64 &,unsigned int &> & a={...}, boost::_bi::type<void>
__formal={...})  Line 393       C++
 
OSGSystemD.dll!boost::_bi::bind_t<void,boost::_mfi::mf2<void,OSG::Shader
Cache,OSG::FieldContainer * __ptr64,unsigned
__int64>,boost::_bi::list3<boost::_bi::value<OSG::ShaderCache *
__ptr64>,boost::arg<1>,boost::arg<2> > >::operator()<OSG::FieldContainer
* __ptr64,unsigned __int64,unsigned int>(OSG::FieldContainer * &
a1=0x00000000224480f8, unsigned __int64 & a2=0, unsigned int & a3=1)
Line 117        C++
 
OSGSystemD.dll!boost::detail::function::void_function_obj_invoker3<boost
::_bi::bind_t<void,boost::_mfi::mf2<void,OSG::ShaderCache,OSG::FieldCont
ainer * __ptr64,unsigned
__int64>,boost::_bi::list3<boost::_bi::value<OSG::ShaderCache *
__ptr64>,boost::arg<1>,boost::arg<2> > >,void,OSG::FieldContainer *
__ptr64,unsigned __int64,unsigned
int>::invoke(boost::detail::function::function_buffer &
function_obj_ptr={...}, OSG::FieldContainer * a0=0x00000000224480f8,
unsigned __int64 a1=0, unsigned int a2=1)  Line 154     C++
        OSGSystemD.dll!boost::function3<void,OSG::FieldContainer *
__ptr64,unsigned __int64,unsigned int>::operator()(OSG::FieldContainer *
a0=0x00000000224480f8, unsigned __int64 a1=0, unsigned int a2=1)  Line
761     C++
        OSGSystemD.dll!OSG::ShaderProgram::resolveLinks()  Line 550
C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x00000000224480f8)  Line 113     C++
 
OSGSystemD.dll!OSG::PointerAccessHandler<OSG::UnrecordedRefCountPolicy>:
:onSub(OSG::PointerMFieldBase * const __formal=0x00000000221eaa28,
OSG::FieldContainer * const pObj=0x00000000224480f8)  Line 74   C++
 
OSGSystemD.dll!OSG::PointerMFieldCommon<OSG::PointerAccessHandler<OSG::U
nrecordedRefCountPolicy>,0>::ptrStoreClear()  Line 320 + 0x1b bytes
C++
        OSGSystemD.dll!OSG::PointerMField<OSG::ShaderProgram *
__ptr64,OSG::UnrecordedRefCountPolicy,0>::clear()  Line 1118    C++
        OSGSystemD.dll!OSG::ShaderProgramChunkBase::clearVertexShaders()
Line 467        C++
        OSGSystemD.dll!OSG::ShaderProgramChunkBase::resolveLinks()  Line
1100    C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x00000000221ea928)  Line 113     C++
 
OSGSystemD.dll!OSG::PointerAccessHandler<OSG::UnrecordedRefCountPolicy>:
:onSub(OSG::PointerMFieldBase * const __formal=0x00000000212d3a58,
OSG::FieldContainer * const pObj=0x00000000221ea928)  Line 74   C++
 
OSGSystemD.dll!OSG::PointerMFieldCommon<OSG::PointerAccessHandler<OSG::U
nrecordedRefCountPolicy>,0>::ptrStoreClear()  Line 320 + 0x1b bytes
C++
        OSGSystemD.dll!OSG::PointerMField<OSG::StateChunk *
__ptr64,OSG::UnrecordedRefCountPolicy,0>::clear()  Line 1118    C++
        OSGSystemD.dll!OSG::ChunkMaterial::clearChunks()  Line 338
C++
        OSGSystemD.dll!OSG::ChunkMaterialBase::resolveLinks()  Line 583
C++
        OSGSystemD.dll!OSG::SimpleMaterialBase::resolveLinks()  Line
1022    C++
        OSGSystemD.dll!OSG::SimpleMaterial::resolveLinks()  Line 106
C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x00000000212d39a8)  Line 113     C++
 
OSGSystemD.dll!OSG::PointerAccessHandler<OSG::UnrecordedRefCountPolicy>:
:onSub(OSG::PointerMFieldBase * const __formal=0x000000001ec78c78,
OSG::FieldContainer * const pObj=0x00000000212d39a8)  Line 74   C++
 
OSGSystemD.dll!OSG::PointerMFieldCommon<OSG::PointerAccessHandler<OSG::U
nrecordedRefCountPolicy>,0>::ptrStoreClear()  Line 320 + 0x1b bytes
C++
        OSGSystemD.dll!OSG::PointerMField<OSG::Material *
__ptr64,OSG::UnrecordedRefCountPolicy,0>::clear()  Line 1118    C++
        OSGSystemD.dll!OSG::SwitchMaterialBase::clearMaterials()  Line
301     C++
        OSGSystemD.dll!OSG::SwitchMaterialBase::resolveLinks()  Line 621
C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x000000001ec78bd0)  Line 113     C++
 
OSGSystemD.dll!OSG::PointerAccessHandler<OSG::UnrecordedRefCountPolicy>:
:onSub(OSG::PointerSFieldBase * const __formal=0x000000001ec78dd0,
OSG::FieldContainer * const pObj=0x000000001ec78bd0)  Line 66   C++
 
OSGSystemD.dll!OSG::PointerAccessHandler<OSG::UnrecordedRefCountPolicy>:
:onReplace(OSG::PointerSFieldBase * const pSField=0x000000001ec78dd0,
OSG::FieldContainer * const pOldObj=0x000000001ec78bd0,
OSG::FieldContainer * const pNewObj=0x0000000000000000)  Line 84
C++
 
OSGSystemD.dll!OSG::PointerSFieldCommon<OSG::PointerAccessHandler<OSG::U
nrecordedRefCountPolicy>,0>::ptrStoreSet(OSG::FieldContainer * const
pNewObj=0x0000000000000000)  Line 109   C++
        OSGSystemD.dll!OSG::PointerSField<OSG::Material *
__ptr64,OSG::UnrecordedRefCountPolicy,0>::setValue(OSG::Material * const
value=0x0000000000000000)  Line 118     C++
        OSGSystemD.dll!OSG::MaterialGroupBase::setMaterial(OSG::Material
* const value=0x0000000000000000)  Line 92      C++
        OSGSystemD.dll!OSG::MaterialGroupBase::resolveLinks()  Line 477
C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x000000001ec78ce0)  Line 113     C++
 
OSGBaseD.dll!OSG::ChildAccessHandler<OSG::UnrecordedRefCountPolicy>::onR
eplace(OSG::PointerSFieldBase * const pSField=0x000000001ec786b0,
OSG::FieldContainer * const pOldObj=0x000000001ec78ce0,
OSG::FieldContainer * const pNewObj=0x0000000000000000)  Line 172
C++
 
OSGBaseD.dll!OSG::PointerSFieldCommon<OSG::ChildAccessHandler<OSG::Unrec
ordedRefCountPolicy>,1>::ptrStoreSet(OSG::FieldContainer * const
pNewObj=0x0000000000000000)  Line 109   C++
        OSGBaseD.dll!OSG::ChildPointerSField<OSG::NodeCore *
__ptr64,OSG::UnrecordedRefCountPolicy,1>::setValue(OSG::NodeCore * const
value=0x0000000000000000)  Line 110     C++
        OSGBaseD.dll!OSG::Node::resolveLinks()  Line 1010       C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x000000001ec785a0)  Line 113     C++
 
OSGBaseD.dll!OSG::ChildAccessHandler<OSG::UnrecordedRefCountPolicy>::onS
ub(OSG::PointerMFieldBase * const pMField=0x000000001ec77f48,
OSG::FieldContainer * const pObj=0x000000001ec785a0)  Line 153  C++
 
OSGBaseD.dll!OSG::PointerMFieldCommon<OSG::ChildAccessHandler<OSG::Unrec
ordedRefCountPolicy>,1>::ptrStoreClear()  Line 320 + 0x1a bytes C++
        OSGBaseD.dll!OSG::ChildPointerMField<OSG::Node *
__ptr64,OSG::UnrecordedRefCountPolicy,1>::clear()  Line 1089    C++
        OSGBaseD.dll!OSG::Node::resolveLinks()  Line 1012       C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x000000001ec77e70)  Line 113     C++
 
OSGBaseD.dll!OSG::ChildAccessHandler<OSG::UnrecordedRefCountPolicy>::onS
ub(OSG::PointerMFieldBase * const pMField=0x000000001ebff818,
OSG::FieldContainer * const pObj=0x000000001ec77e70)  Line 153  C++
 
OSGBaseD.dll!OSG::PointerMFieldCommon<OSG::ChildAccessHandler<OSG::Unrec
ordedRefCountPolicy>,1>::ptrStoreClear()  Line 320 + 0x1a bytes C++
        OSGBaseD.dll!OSG::ChildPointerMField<OSG::Node *
__ptr64,OSG::UnrecordedRefCountPolicy,1>::clear()  Line 1089    C++
        OSGBaseD.dll!OSG::Node::resolveLinks()  Line 1012       C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x000000001ebff740)  Line 113     C++
 
OSGBaseD.dll!OSG::ChildAccessHandler<OSG::UnrecordedRefCountPolicy>::onS
ub(OSG::PointerMFieldBase * const pMField=0x000000001ebffc38,
OSG::FieldContainer * const pObj=0x000000001ebff740)  Line 153  C++
 
OSGBaseD.dll!OSG::PointerMFieldCommon<OSG::ChildAccessHandler<OSG::Unrec
ordedRefCountPolicy>,1>::ptrStoreClear()  Line 320 + 0x1a bytes C++
        OSGBaseD.dll!OSG::ChildPointerMField<OSG::Node *
__ptr64,OSG::UnrecordedRefCountPolicy,1>::clear()  Line 1089    C++
        OSGBaseD.dll!OSG::Node::resolveLinks()  Line 1012       C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x000000001ebffb60)  Line 113     C++
 
OSGBaseD.dll!OSG::ChildAccessHandler<OSG::UnrecordedRefCountPolicy>::onS
ub(OSG::PointerMFieldBase * const pMField=0x000000001ebffe48,
OSG::FieldContainer * const pObj=0x000000001ebffb60)  Line 153  C++
 
OSGBaseD.dll!OSG::PointerMFieldCommon<OSG::ChildAccessHandler<OSG::Unrec
ordedRefCountPolicy>,1>::ptrStoreClear()  Line 320 + 0x1a bytes C++
        OSGBaseD.dll!OSG::ChildPointerMField<OSG::Node *
__ptr64,OSG::UnrecordedRefCountPolicy,1>::clear()  Line 1089    C++
        OSGBaseD.dll!OSG::Node::resolveLinks()  Line 1012       C++
        OSGBaseD.dll!OSG::FieldContainer::subReferenceUnrecorded()  Line
456     C++
 
OSGBaseD.dll!OSG::UnrecordedRefCountPolicy::subRef(OSG::FieldContainer *
const pObject=0x000000001ebffd70)  Line 113     C++
 
OSGBaseD.dll!OSG::ChildAccessHandler<OSG::UnrecordedRefCountPolicy>::onS
ub(OSG::PointerMFieldBase * const pMField=0x000000000ba1c3b0,
OSG::FieldContainer * const pObj=0x000000001ebffd70)  Line 153  C++
 
OSGBaseD.dll!OSG::PointerMFieldCommon<OSG::ChildAccessHandler<OSG::Unrec
ordedRefCountPolicy>,1>::ptrStoreErase(std::_Vector_iterator<OSG::FieldC
ontainer *,std::allocator<OSG::FieldContainer *> > *
pos=0x000000001ebffd70 {_sfVolume={...} _sfParent={...}
_mfChildren={...} ...})  Line 278       C++
 
OSGBaseD.dll!OSG::PointerMFieldCommon<OSG::ChildAccessHandler<OSG::Unrec
ordedRefCountPolicy>,1>::ptrStoreErase(const unsigned int index=0)  Line
299 + 0x6c bytes        C++
        OSGBaseD.dll!OSG::ChildPointerMField<OSG::Node *
__ptr64,OSG::UnrecordedRefCountPolicy,1>::erase(unsigned __int64
index=0)  Line 1001     C++
        OSGBaseD.dll!OSG::Node::subChild(OSG::Node * const
childP=0x000000001ebffd70)  Line 311    C++
        RenderEngineD.dll!RenderEngine::system::SceneImp::Destroy(const
RenderEngine::Handle & handle={...})  Line 304  C++

>From the application prespective, I did delete one of my solid bodies,
i.e. destroyed the associated scene graph parent node with the two
branches responsible for rendering the opaque faces and the silhouettes.
However, not every deletion operation leads to the hanging.

Any idea how I can track this problem?

Any help would really be appreciated. 

Best,
Johannes




____________
Virus checked by G DATA AntiVirusKit
Version: AVF 22.554 from 26.02.2012
Virus news: www.antiviruslab.com

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to