Fix to address issue introduced in PR #1787 where the same ProgramState was being used for each attachment, but would cause problems if the attachments did not use the same texture. (#1801)

This commit is contained in:
RH 2020-10-27 19:34:31 +11:00 committed by GitHub
parent 5a1d53bb16
commit f06fd410e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,11 +163,10 @@ cocos2d::TrianglesCommand* SkeletonBatch::addCommand(cocos2d::Renderer* renderer
CCASSERT(programState, "programState should not be null");
auto& pipelinePS = command->getPipelineDescriptor().programState;
if (pipelinePS != programState)
if (pipelinePS == nullptr || pipelinePS->getProgram() != programState->getProgram())
{
CC_SAFE_RELEASE(pipelinePS);
pipelinePS = programState;
CC_SAFE_RETAIN(pipelinePS);
pipelinePS = programState->clone();
updateProgramStateLayout(pipelinePS);
}