From 23edfad1fd65961b9118ff9bc8a0813c049e7104 Mon Sep 17 00:00:00 2001 From: "konstantin.matveyev" Date: Mon, 31 Jul 2017 00:53:24 +0300 Subject: [PATCH] [**] pragma(tic) fix: 'defineMap.changed flag' condition changed in State::push/popDefineList --- include/osg/State | 4 ++-- src/osg/State.cpp | 33 +++++++++++++++------------------ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/osg/State b/include/osg/State index 549098677..69a10a39f 100644 --- a/include/osg/State +++ b/include/osg/State @@ -2108,7 +2108,7 @@ inline void State::pushDefineList(DefineMap& defineMap,const StateSet::DefineLis dv.push_back(StateSet::DefinePair(aitr->second.first,aitr->second.second)); // if the back of the stack has changed since the last then mark it as changed. - bool changed = (dv[dv.size()-2].first==dv[dv.size()-1].first); + bool changed = (dv[dv.size()-2] != dv.back()); if (changed) { ds.changed = true; @@ -2177,7 +2177,7 @@ inline void State::popDefineList(DefineMap& defineMap,const StateSet::DefineList if (!dv.empty()) { // if the stack has less than 2 entries or new back vs old back are different then mark the DefineStack as changed - if ((dv.size()<2) || (dv[dv.size()-2].first!=dv.back().first)) + if ((dv.size() < 2) || (dv[dv.size()-2] != dv.back())) { ds.changed = true; defineMap.changed = true; diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 0e92946ce..8145c48ae 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -1828,30 +1828,27 @@ void State::frameCompleted() bool State::DefineMap::updateCurrentDefines() { - if (changed) + if (!changed) + return false; + + currentDefines.clear(); + for(DefineStackMap::const_iterator itr = map.begin(); + itr != map.end(); + ++itr) { - currentDefines.clear(); - for(DefineStackMap::const_iterator itr = map.begin(); - itr != map.end(); - ++itr) + const DefineStack::DefineVec& dv = itr->second.defineVec; + if (!dv.empty()) { - const DefineStack::DefineVec& dv = itr->second.defineVec; - if (!dv.empty()) + const StateSet::DefinePair& dp = dv.back(); + if (dp.second & osg::StateAttribute::ON) { - const StateSet::DefinePair& dp = dv.back(); - if (dp.second & osg::StateAttribute::ON) - { - currentDefines[itr->first] = dp; - } + currentDefines[itr->first] = dp; } } - changed = false; - return true; - } - else - { - return false; } + changed = false; + + return true; } std::string State::getDefineString(const osg::ShaderDefines& shaderDefines)