// Specially, if node don't have uniformMap, we mark nodePtr as nullptr.
// So, all nodes without uniformMap will share same UniformIndexMap, contains only render data providers.
const auto nodePtr = uniformMapNode.Count() ? &node : nullptr;
+ const auto programPtr = &program;
const auto nodeChangeCounter = nodePtr ? uniformMapNode.GetChangeCounter() : 0;
const auto renderItemMapChangeCounter = uniformMap.GetChangeCounter();
- auto iter = std::find_if(mNodeIndexMap.begin(), mNodeIndexMap.end(), [nodePtr](RenderItemLookup& element) { return element.node == nodePtr; });
+ auto iter = std::find_if(mNodeIndexMap.begin(), mNodeIndexMap.end(), [nodePtr, programPtr](RenderItemLookup& element) { return (element.node == nodePtr && element.program == programPtr); });
- int renderItemMapIndex;
+ std::size_t renderItemMapIndex;
if(iter == mNodeIndexMap.end())
{
renderItemMapIndex = mUniformIndexMaps.size();
RenderItemLookup renderItemLookup;
renderItemLookup.node = nodePtr;
+ renderItemLookup.program = programPtr;
renderItemLookup.index = renderItemMapIndex;
renderItemLookup.nodeChangeCounter = nodeChangeCounter;
renderItemLookup.renderItemMapChangeCounter = renderItemMapChangeCounter;
/** Struct to map node to index into mNodeMapCounters and mUniformIndexMaps */
struct RenderItemLookup
{
- const SceneGraph::NodeDataProvider* node{nullptr}; ///<Node key. It can be nullptr if this NodeIndex don't need node uniform
+ const SceneGraph::NodeDataProvider* node{nullptr}; ///< Node key. It can be nullptr if this NodeIndex don't need node uniform
+ const Program* program{nullptr}; ///< Program key.
std::size_t index{0}; ///<Index into mUniformIndexMap
std::size_t nodeChangeCounter{0}; ///<The last known change counter for this node's uniform map