| 1363 | } |
| 1364 | |
| 1365 | void RenderGraphUI::updateDisplayData(RenderContext* pRenderContext) |
| 1366 | { |
| 1367 | uint32_t nodeIndex = 0; |
| 1368 | |
| 1369 | mOutputToInputPins.clear(); |
| 1370 | |
| 1371 | // set of field names that have a connection and are represented in the graph |
| 1372 | std::unordered_set<std::string> nodeConnectedInput; |
| 1373 | std::unordered_set<std::string> nodeConnectedOutput; |
| 1374 | std::unordered_map<std::string, uint32_t> previousGuiNodeIDs; |
| 1375 | std::unordered_set<uint32_t> existingIDs; |
| 1376 | |
| 1377 | for (const auto& currentRenderPassUI : mRenderPassUI) |
| 1378 | { |
| 1379 | existingIDs.insert(currentRenderPassUI.second.mGuiNodeID); |
| 1380 | previousGuiNodeIDs.insert(std::make_pair(currentRenderPassUI.first, currentRenderPassUI.second.mGuiNodeID)); |
| 1381 | } |
| 1382 | |
| 1383 | mpRenderGraph->compile(pRenderContext); |
| 1384 | mRenderPassUI.clear(); |
| 1385 | mInputPinStringToLinkID.clear(); |
| 1386 | |
| 1387 | // build information for displaying graph |
| 1388 | for (const auto& nameToIndex : mpRenderGraph->mNameToIndex) |
| 1389 | { |
| 1390 | auto pCurrentPass = mpRenderGraph->mpGraph->getNode(nameToIndex.second); |
| 1391 | RenderPassUI renderPassUI; |
| 1392 | bool addedExecutionInput = false; |
| 1393 | bool addedExecutionOutput = false; |
| 1394 | |
| 1395 | mAllNodeTypeStrings.insert(nameToIndex.first); |
| 1396 | |
| 1397 | while (existingIDs.find(nodeIndex) != existingIDs.end()) |
| 1398 | { |
| 1399 | nodeIndex++; |
| 1400 | } |
| 1401 | |
| 1402 | // keep the GUI id from the previous frame |
| 1403 | auto pPreviousID = previousGuiNodeIDs.find(nameToIndex.first); |
| 1404 | if (pPreviousID != previousGuiNodeIDs.end()) |
| 1405 | { |
| 1406 | renderPassUI.mGuiNodeID = pPreviousID->second; |
| 1407 | } |
| 1408 | else |
| 1409 | { |
| 1410 | renderPassUI.mGuiNodeID = nodeIndex; |
| 1411 | nodeIndex++; |
| 1412 | } |
| 1413 | |
| 1414 | // clear and rebuild reflection for each pass. |
| 1415 | // TODO: This is unsafe because render pass reflection may depend on the compile data, which isn't available here. |
| 1416 | renderPassUI.mReflection = mpRenderGraph->mNodeData[nameToIndex.second].pPass->reflect({}); |
| 1417 | |
| 1418 | // test to see if we have hit a graph output |
| 1419 | std::unordered_set<std::string> passGraphOutputs; |
| 1420 | |
| 1421 | for (const auto& output : mpRenderGraph->mOutputs) |
| 1422 | { |
nothing calls this directly
no test coverage detected