I got this exception:
Code: Select all
11:09:07: OGRE EXCEPTION(1:InvalidStateException): Last frame called map( bAdvanceFrame = false ) but didn't call advanceFrame!!!. in BufferPacked::map at C:\ogremygui\OGRE\OgreMain\src\Vao\OgreBufferPacked.cpp (line 190)
Code: Select all
if( //This is a different frame from the last time we called map
mLastFrameMapped != currentFrame &&
//map was called, but bAdvanceFrame was not.
(int)(mLastFrameMapped - mLastFrameMappedAndAdvanced) > 0 )
{
OGRE_EXCEPT( Exception::ERR_INVALID_STATE,
"Last frame called map( bAdvanceFrame = false ) but "
"didn't call advanceFrame!!!.", "BufferPacked::map" );
}
Code: Select all
float* RESTRICT_ALIAS_RETURN HlmsBufferManager::mapNextTexBuffer( CommandBuffer *commandBuffer,
size_t minimumSizeBytes )
{
...
mRealStartMappedTexBuffer = reinterpret_cast<float*>(
texBuffer->map( mTexLastOffset,
texBuffer->getNumElements() - mTexLastOffset, /////////// here
false ) );
Code: Select all
for (const auto& action : mLightmapBakingActions) {
beforeLightBakingAction(action); // change visilibty mask, move camera etc
sceneManager->updateSceneGraph();
auto bakingWorkspace = action.worspace;
bakingWorkspace->_beginUpdate(false);
bakingWorkspace->_update();
bakingWorkspace->_endUpdate(false);
sceneManager->clearFrameData();
afterLightBakingAction(idx); // restore changed things
}
In the second bake in the loop (I have 5 actions in the loop), although (int)(mLastFrameMapped - mLastFrameMappedAndAdvanced) > 0 is true (150>149), but mLastFrameMapped == currentFrame (both 150) so the exception was not raised.
However, after all the baking actions, when updating PCC probes:
Code: Select all
void ParallaxCorrectedCubemap::updateExpensiveCollectedDirtyProbes( uint16 iterationThreshold )
{
RenderSystem *renderSystem = mSceneManager->getDestinationRenderSystem();
HlmsManager *hlmsManager = mRoot->getHlmsManager();
const uint32 oldVisibilityMask = mSceneManager->getVisibilityMask();
mSceneManager->setVisibilityMask( 0xffffffff );
for( size_t i=0; i<mNumCollectedProbes; ++i )
{
if( (mCollectedProbes[i]->mDirty || !mCollectedProbes[i]->mStatic) &&
mCollectedProbes[i]->mNumIterations > iterationThreshold )
{
setFinalProbeTo( i );
for( int j=0; j<mCollectedProbes[i]->mNumIterations; ++j )
{
renderSystem->_beginFrameOnce();
mCopyWorkspace->_beginUpdate( true );
if( j == 0 )
mCollectedProbes[i]->_clearCubemap();
mCopyWorkspace->_update();
mCollectedProbes[i]->_updateRender(); //////////////////////////////////////here
mCopyWorkspace->_endUpdate( true );