| 453 | } |
| 454 | |
| 455 | void RenderGraph::update(const ref<RenderGraph>& pGraph) |
| 456 | { |
| 457 | // Fill in missing passes from referenced graph. |
| 458 | for (const auto& nameIndexPair : pGraph->mNameToIndex) |
| 459 | { |
| 460 | ref<RenderPass> pRenderPass = pGraph->mNodeData[nameIndexPair.second].pPass; |
| 461 | if (!doesPassExist(nameIndexPair.first)) |
| 462 | addPass(pRenderPass, nameIndexPair.first); |
| 463 | } |
| 464 | |
| 465 | // Remove nodes that should no longer be within the graph. |
| 466 | std::vector<std::string> passesToRemove; |
| 467 | |
| 468 | for (const auto& nameIndexPair : mNameToIndex) |
| 469 | { |
| 470 | if (!pGraph->doesPassExist(nameIndexPair.first)) |
| 471 | { |
| 472 | passesToRemove.push_back(nameIndexPair.first); |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | for (const std::string& passName : passesToRemove) |
| 477 | { |
| 478 | removePass(passName); |
| 479 | } |
| 480 | |
| 481 | // Remove all edges from this graph. |
| 482 | for (uint32_t i = 0; i < mpGraph->getCurrentEdgeId(); ++i) |
| 483 | { |
| 484 | if (!mpGraph->doesEdgeExist(i)) |
| 485 | { |
| 486 | continue; |
| 487 | } |
| 488 | |
| 489 | mpGraph->removeEdge(i); |
| 490 | } |
| 491 | mEdgeData.clear(); |
| 492 | |
| 493 | // Add all edges from the other graph. |
| 494 | for (uint32_t i = 0; i < pGraph->mpGraph->getCurrentEdgeId(); ++i) |
| 495 | { |
| 496 | if (!pGraph->mpGraph->doesEdgeExist(i)) |
| 497 | { |
| 498 | continue; |
| 499 | } |
| 500 | |
| 501 | const DirectedGraph::Edge* pEdge = pGraph->mpGraph->getEdge(i); |
| 502 | std::string dst = pGraph->mNodeData.find(pEdge->getDestNode())->second.name; |
| 503 | std::string src = pGraph->mNodeData.find(pEdge->getSourceNode())->second.name; |
| 504 | |
| 505 | if ((mNameToIndex.find(src) != mNameToIndex.end()) && (mNameToIndex.find(dst) != mNameToIndex.end())) |
| 506 | { |
| 507 | if (pGraph->mEdgeData[i].dstField.size()) |
| 508 | dst += std::string(".") + pGraph->mEdgeData[i].dstField; |
| 509 | if (pGraph->mEdgeData[i].srcField.size()) |
| 510 | src += std::string(".") + pGraph->mEdgeData[i].srcField; |
| 511 | addEdge(src, dst); |
| 512 | } |
nothing calls this directly
no test coverage detected