mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Subsystem startup shutdown (#11128)
* refactor startup/shutdown process of BuiltinResMgr * refactor startup/shutdown process of ProgramLib
This commit is contained in:
@@ -271,9 +271,13 @@ void IProgramInfo::copyFrom(const IShaderInfo &o) {
|
||||
subpassInputs = o.subpassInputs;
|
||||
}
|
||||
|
||||
ProgramLib::ProgramLib() = default;
|
||||
ProgramLib::ProgramLib() {
|
||||
ProgramLib::instance = this;
|
||||
}
|
||||
|
||||
ProgramLib::~ProgramLib() = default;
|
||||
ProgramLib::~ProgramLib() {
|
||||
ProgramLib::instance = nullptr;
|
||||
}
|
||||
|
||||
//
|
||||
/*static*/
|
||||
@@ -281,19 +285,9 @@ ProgramLib::~ProgramLib() = default;
|
||||
ProgramLib *ProgramLib::instance = nullptr;
|
||||
|
||||
ProgramLib *ProgramLib::getInstance() {
|
||||
if (!ProgramLib::instance) {
|
||||
ProgramLib::instance = ccnew ProgramLib();
|
||||
}
|
||||
return ProgramLib::instance;
|
||||
}
|
||||
|
||||
void ProgramLib::destroyInstance() {
|
||||
if (ProgramLib::instance) {
|
||||
delete ProgramLib::instance;
|
||||
ProgramLib::instance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void ProgramLib::registerEffect(EffectAsset *effect) {
|
||||
for (auto &shader : effect->_shaders) {
|
||||
auto *tmpl = define(shader);
|
||||
|
||||
Reference in New Issue
Block a user