-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix ProgramState and Program performance #20189
Conversation
cocos/renderer/CCMaterial.cpp
Outdated
pass->setProgramState(programState); | ||
|
||
CC_SAFE_RELEASE(program); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should release ProgramState too, as Pass::setProgramState will retain it.
|
||
auto program = backend::Device::getInstance()->newProgram(positionTextureColor_vert, fragSource.c_str()); | ||
auto glprogram = new backend::ProgramState(program); | ||
CC_SAFE_RELEASE(program); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glprogram -> programState
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be need to do autorelease for program state as the method name is createXXX
cocos/renderer/backend/Device.h
Outdated
* @return A Program instance. | ||
*/ | ||
virtual Program* createBuiltinProgram(ProgramType type); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Device do have to distinguish builtin or not. It just creates a program. Add Program::getBuiltinProgram()
is a better idea.
issues discuss here