Skip to content
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

Merged
merged 4 commits into from
Oct 15, 2019

Conversation

Mee-gu
Copy link
Contributor

@Mee-gu Mee-gu commented Oct 10, 2019

issues discuss here

pass->setProgramState(programState);

CC_SAFE_RELEASE(program);
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glprogram -> programState

Copy link
Contributor

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

* @return A Program instance.
*/
virtual Program* createBuiltinProgram(ProgramType type);

Copy link
Contributor

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.

@minggo minggo merged commit 67ae2e7 into cocos2d:v4 Oct 15, 2019
@minggo minggo added this to the 4.0 milestone Oct 15, 2019
@Mee-gu Mee-gu deleted the fixProgramStateAndProgram branch October 17, 2019 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants