| 441 | } |
| 442 | |
| 443 | void RenderGraphCompiler::compilePasses(RenderContext* pRenderContext) |
| 444 | { |
| 445 | while (1) |
| 446 | { |
| 447 | std::string log; |
| 448 | bool success = true; |
| 449 | for (auto& p : mExecutionList) |
| 450 | { |
| 451 | try |
| 452 | { |
| 453 | p.pPass->compile(pRenderContext, prepPassCompilationData(p)); |
| 454 | } |
| 455 | catch (const std::exception& e) |
| 456 | { |
| 457 | log += std::string(e.what()) + "\n"; |
| 458 | success = false; |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | if (success) |
| 463 | return; |
| 464 | |
| 465 | // Retry |
| 466 | bool changed = false; |
| 467 | for (auto& p : mExecutionList) |
| 468 | { |
| 469 | auto newR = p.pPass->reflect(prepPassCompilationData(p)); |
| 470 | if (newR != p.reflector) |
| 471 | { |
| 472 | p.reflector = newR; |
| 473 | changed = true; |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | FALCOR_CHECK(changed, "Graph compilation failed:\n{}", log); |
| 478 | } |
| 479 | } |
| 480 | } // namespace Falcor |