cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.24k stars 7.06k forks source link

Lazy initialization of shader programs in GLProgramCache #15637

Open ryukbk opened 8 years ago

ryukbk commented 8 years ago

(originally from http://discuss.cocos2d-x.org/t/lazy-initialization-of-shader-programs-in-glprogramcache/29306/1)

Looking into GLProgramCache::loadDefaultGLPrograms() & GLProgramCache::reloadDefaultGLPrograms() (which is called when the renderer is recreated on Android), there are some shaders which are not necessary for certain use cases (not all apps use 3D / CCDrawNode / distance field etc.) and they are always initialized regardless. Compiling shaders and linking them are quite slow, is there any plan to move the shader initialization to the initialization of each related component?

crazyhappygame commented 8 years ago

15746 It will be very useful for windows phones