|
@@ -163,11 +163,10 @@ cocos2d::TrianglesCommand* SkeletonBatch::addCommand(cocos2d::Renderer* renderer
|
|
CCASSERT(programState, "programState should not be null");
|
|
CCASSERT(programState, "programState should not be null");
|
|
|
|
|
|
auto& pipelinePS = command->getPipelineDescriptor().programState;
|
|
auto& pipelinePS = command->getPipelineDescriptor().programState;
|
|
- if (pipelinePS != programState)
|
|
|
|
|
|
+ if (pipelinePS == nullptr || pipelinePS->getProgram() != programState->getProgram())
|
|
{
|
|
{
|
|
CC_SAFE_RELEASE(pipelinePS);
|
|
CC_SAFE_RELEASE(pipelinePS);
|
|
- pipelinePS = programState;
|
|
|
|
- CC_SAFE_RETAIN(pipelinePS);
|
|
|
|
|
|
+ pipelinePS = programState->clone();
|
|
|
|
|
|
updateProgramStateLayout(pipelinePS);
|
|
updateProgramStateLayout(pipelinePS);
|
|
}
|
|
}
|
|
@@ -175,8 +174,8 @@ cocos2d::TrianglesCommand* SkeletonBatch::addCommand(cocos2d::Renderer* renderer
|
|
pipelinePS->setUniform(_locMVP, projectionMat.m, sizeof(projectionMat.m));
|
|
pipelinePS->setUniform(_locMVP, projectionMat.m, sizeof(projectionMat.m));
|
|
pipelinePS->setTexture(_locTexture, 0, texture->getBackendTexture());
|
|
pipelinePS->setTexture(_locTexture, 0, texture->getBackendTexture());
|
|
|
|
|
|
- command->init(globalOrder, texture, blendType, triangles, mv, flags);
|
|
|
|
- renderer->addCommand(command);
|
|
|
|
|
|
+ command->init(globalOrder, texture, blendType, triangles, mv, flags);
|
|
|
|
+ renderer->addCommand(command);
|
|
return command;
|
|
return command;
|
|
}
|
|
}
|
|
|
|
|