[pipeline] refactor custom pipeline init (#14040)

This commit is contained in:
hyde zhou
2023-01-13 14:02:46 +08:00
committed by pandamicro
parent 75ba0aa8d5
commit 52bccdf738
50 changed files with 717 additions and 262 deletions
+2 -10
View File
@@ -178,15 +178,7 @@ void ProgramLib::registerEffect(EffectAsset *effect) {
auto *tmpl = define(shader);
tmpl->effectName = effect->getName();
}
for (auto &tech : effect->_techniques) {
for (auto &pass : tech.passes) {
// grab default property declaration if there is none
if (pass.propertyIndex.has_value() && !pass.properties.has_value()) {
pass.properties = tech.passes[pass.propertyIndex.value()].properties;
}
}
}
render::addEffectDefaultProperties(*effect);
}
IProgramInfo *ProgramLib::define(IShaderInfo &shader) {
@@ -362,7 +354,7 @@ IProgramInfo *ProgramLib::define(IShaderInfo &shader) {
* @param name Target shader name
*/
IProgramInfo *ProgramLib::getTemplate(const ccstd::string &name) {
const IProgramInfo *ProgramLib::getTemplate(const ccstd::string &name) const {
auto it = _templates.find(name);
return it != _templates.end() ? &it->second : nullptr;
}