| 1738 | } |
| 1739 | |
| 1740 | bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) { |
| 1741 | resolver->endResolve(EShLangCount); |
| 1742 | if (!hadError) { |
| 1743 | //Resolve uniform location, ubo/ssbo/opaque bindings across stages |
| 1744 | TResolverUniformAdaptor uniformResolve(EShLangCount, *resolver, uniformVarMap, infoSink, hadError); |
| 1745 | TResolverInOutAdaptor inOutResolve(EShLangCount, *resolver, infoSink, hadError); |
| 1746 | TSymbolValidater symbolValidater(*resolver, infoSink, inVarMaps, |
| 1747 | outVarMaps, uniformVarMap, hadError, profile, version); |
| 1748 | |
| 1749 | TVarLiveVector inVectors[EShLangCount]; |
| 1750 | TVarLiveVector outVectors[EShLangCount]; |
| 1751 | TVarLiveVector uniformVector; |
| 1752 | |
| 1753 | resolver->beginResolve(EShLangCount); |
| 1754 | for (int stage = EShLangVertex; stage < EShLangCount; stage++) { |
| 1755 | if (inVarMaps[stage] != nullptr) { |
| 1756 | inOutResolve.setStage(EShLanguage(stage)); |
| 1757 | |
| 1758 | // copy vars into a sorted list |
| 1759 | std::for_each(inVarMaps[stage]->begin(), inVarMaps[stage]->end(), |
| 1760 | [&inVectors, stage](TVarLivePair p) { inVectors[stage].push_back(p); }); |
| 1761 | std::sort(inVectors[stage].begin(), inVectors[stage].end(), |
| 1762 | [](const TVarLivePair& p1, const TVarLivePair& p2) -> bool { |
| 1763 | return TVarEntryInfo::TOrderByPriority()(p1.second, p2.second); |
| 1764 | }); |
| 1765 | |
| 1766 | std::for_each(outVarMaps[stage]->begin(), outVarMaps[stage]->end(), |
| 1767 | [&outVectors, stage](TVarLivePair p) { outVectors[stage].push_back(p); }); |
| 1768 | std::sort(outVectors[stage].begin(), outVectors[stage].end(), |
| 1769 | [](const TVarLivePair& p1, const TVarLivePair& p2) -> bool { |
| 1770 | return TVarEntryInfo::TOrderByPriority()(p1.second, p2.second); |
| 1771 | }); |
| 1772 | |
| 1773 | for (auto& var : inVectors[stage]) { symbolValidater(var); } |
| 1774 | for (auto& var : inVectors[stage]) { inOutResolve(var); } |
| 1775 | for (auto& var : outVectors[stage]) { symbolValidater(var); } |
| 1776 | for (auto& var : outVectors[stage]) { inOutResolve(var); } |
| 1777 | |
| 1778 | // copy results back into maps |
| 1779 | std::for_each(inVectors[stage].begin(), inVectors[stage].end(), |
| 1780 | [this, stage](TVarLivePair p) { |
| 1781 | auto at = inVarMaps[stage]->find(p.first); |
| 1782 | if (at != inVarMaps[stage]->end()) |
| 1783 | at->second = p.second; |
| 1784 | }); |
| 1785 | |
| 1786 | std::for_each(outVectors[stage].begin(), outVectors[stage].end(), |
| 1787 | [this, stage](TVarLivePair p) { |
| 1788 | auto at = outVarMaps[stage]->find(p.first); |
| 1789 | if (at != outVarMaps[stage]->end()) |
| 1790 | at->second = p.second; |
| 1791 | }); |
| 1792 | |
| 1793 | } |
| 1794 | if (uniformVarMap[stage] != nullptr) { |
| 1795 | uniformResolve.setStage(EShLanguage(stage)); |
| 1796 | for (auto& var : *(uniformVarMap[stage])) { uniformVector.push_back(var); } |
| 1797 | } |
no test coverage detected