mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
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:
parent
5a1d53bb16
commit
f06fd410e8
@ -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);
|
||||
}
|
||||
@ -175,8 +174,8 @@ cocos2d::TrianglesCommand* SkeletonBatch::addCommand(cocos2d::Renderer* renderer
|
||||
pipelinePS->setUniform(_locMVP, projectionMat.m, sizeof(projectionMat.m));
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user